| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- if { [info exists CHIPNAME] } {
- set _CHIPNAME $CHIPNAME
- } else {
- set _CHIPNAME pic32mm
- }
- if { [info exists ENDIAN] } {
- set _ENDIAN $ENDIAN
- } else {
- set _ENDIAN little
- }
- if { [info exists CPUTAPID] } {
- set _CPUTAPID $CPUTAPID
- } else {
- set _CPUTAPID 0x3771e053
- }
- adapter srst delay 100
- jtag_ntrst_delay 100
- #jtag scan chain
- #format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
- jtag newtap $_CHIPNAME cpu -irlen 5 -ircapture 0x1 -irmask 0x1f -expected-id $_CPUTAPID -expected-id 0x4771e053
- set _TARGETNAME $_CHIPNAME.cpu
- target create $_TARGETNAME mips_m4k -endian $_ENDIAN -chain-position $_TARGETNAME
- #We initially set the work area size to the size of RAM of the smallest device. The 'pic32mm find_work_area' command executed during 'reset init' will extend it later.
- $_TARGETNAME configure -work-area-phys 0xa0000000 -work-area-size 4096 -work-area-backup 0
- $_TARGETNAME configure -event reset-init {
- #
- # Set system clock to 8Mhz if the default clock configuration is set
- #
- global _TARGETNAME
- set _SYSKEY 0xbf803670
- set _OSCCON_CLR 0xbf802684
- # SYSKEY register, make sure OSCCON is locked
- mww $_SYSKEY 0x0
- # SYSKEY register, write unlock sequence
- mww $_SYSKEY 0xaa996655
- mww $_SYSKEY 0x556699aa
- # OSCCON register + 4, clear OSCCON FRCDIV and NOSC bits, configuring the clock to run from FRC divided by 1
- mww $_OSCCON_CLR 0x07000700
- # SYSKEY register, relock OSCCON
- mww $_SYSKEY 0x0
-
- pic32mm find_work_area
- }
- #This disables the mips_m4k_bulk_write_memory() optimization that does not properly work on PIC32 targets.
- $_TARGETNAME mips_m4k disable_bulk_memory_write
- set _FLASHNAME $_CHIPNAME.flash0
- flash bank $_FLASHNAME pic32mm 0x1fc00000 0 0 0 $_TARGETNAME
- # add virtual banks for kseg0 and kseg1
- flash bank vbank0 virtual 0xbfc00000 0 0 0 $_TARGETNAME $_FLASHNAME
- flash bank vbank1 virtual 0x9fc00000 0 0 0 $_TARGETNAME $_FLASHNAME
- set _FLASHNAME $_CHIPNAME.flash1
- flash bank $_FLASHNAME pic32mm 0x1d000000 0 0 0 $_TARGETNAME
- # add virtual banks for kseg0 and kseg1
- flash bank vbank2 virtual 0xbd000000 0 0 0 $_TARGETNAME $_FLASHNAME
- flash bank vbank3 virtual 0x9d000000 0 0 0 $_TARGETNAME $_FLASHNAME
|