1 if { [info exists CHIPNAME] } {
2 set _CHIPNAME $CHIPNAME
7 if { [info exists ENDIAN] } {
13 if { [info exists CPUTAPID] } {
14 set _CPUTAPID $CPUTAPID
16 set _CPUTAPID 0x30938053
19 # default working area is 16384
20 if { [info exists WORKAREASIZE] } {
21 set _WORKAREASIZE $WORKAREASIZE
23 set _WORKAREASIZE 0x4000
26 adapter_nsrst_delay 100
30 #format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
31 jtag newtap $_CHIPNAME cpu -irlen 5 -ircapture 0x1 -irmask 0x1f -expected-id $_CPUTAPID
33 set _TARGETNAME $_CHIPNAME.cpu
34 target create $_TARGETNAME mips_m4k -endian $_ENDIAN -chain-position $_TARGETNAME
37 # At reset the pic32mx does not allow code execution from RAM
38 # we have to setup the BMX registers to allow this.
39 # One limitation is that we loose the first 2k of RAM.
42 global _PIC32MX_DATASIZE
44 set _PIC32MX_DATASIZE 0x800
45 set _PIC32MX_PROGSIZE [expr ($_WORKAREASIZE - $_PIC32MX_DATASIZE)]
47 $_TARGETNAME configure -work-area-phys 0xa0000800 -work-area-size $_PIC32MX_PROGSIZE -work-area-backup 0
48 $_TARGETNAME configure -event reset-init {
50 # from reset the pic32 cannot execute code in ram - enable ram execution
51 # minimum offset from start of ram is 2k
54 global _PIC32MX_DATASIZE
58 mww 0xbf882000 0x001f0040
59 # BMXDKPBA: 2k kernel data @ 0xa0000000
60 mww 0xbf882010 $_PIC32MX_DATASIZE
61 # BMXDUDBA: 14k kernel program @ 0xa0000800 - (BMXDUDBA - BMXDKPBA)
62 mww 0xbf882020 $_WORKAREASIZE
63 # BMXDUPBA: 0k user program - (BMXDUPBA - BMXDUDBA)
64 mww 0xbf882030 $_WORKAREASIZE
67 set _FLASHNAME $_CHIPNAME.flash0
68 flash bank $_FLASHNAME pic32mx 0x1fc00000 0 0 0 $_TARGETNAME
69 # add virtual banks for kseg0 and kseg1
70 flash bank vbank0 virtual 0xbfc00000 0 0 0 $_TARGETNAME $_FLASHNAME
71 flash bank vbank1 virtual 0x9fc00000 0 0 0 $_TARGETNAME $_FLASHNAME
73 set _FLASHNAME $_CHIPNAME.flash1
74 flash bank $_FLASHNAME pic32mx 0x1d000000 0 0 0 $_TARGETNAME
75 # add virtual banks for kseg0 and kseg1
76 flash bank vbank2 virtual 0xbd000000 0 0 0 $_TARGETNAME $_FLASHNAME
77 flash bank vbank3 virtual 0x9d000000 0 0 0 $_TARGETNAME $_FLASHNAME