2 if { [info exists CHIPNAME] } {
3 set _CHIPNAME $CHIPNAME
8 if { [info exists ENDIAN] } {
14 if { [info exists CPUTAPID ] } {
15 set _CPUTAPID $CPUTAPID
17 # force an error till we get a good number
18 set _CPUTAPID 0x30938053
21 # default working area is 16384
22 if { [info exists WORKAREASIZE] } {
23 set _WORKAREASIZE $WORKAREASIZE
25 set _WORKAREASIZE 0x4000
29 adapter_nsrst_delay 100
33 #format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
34 jtag newtap $_CHIPNAME cpu -irlen 5 -ircapture 0x1 -irmask 0x1f -expected-id $_CPUTAPID
36 set _TARGETNAME $_CHIPNAME.cpu
37 target create $_TARGETNAME mips_m4k -endian $_ENDIAN -chain-position $_TARGETNAME
40 # At reset the pic32mx does not allow code execution from RAM
41 # we have to setup the BMX registers to allow this.
42 # One limitation is that we loose the first 2k of RAM.
45 global _PIC32MX_DATASIZE
46 global _PIC32MX_PROGSIZE
47 set _PIC32MX_DATASIZE 0x800
48 set _PIC32MX_PROGSIZE [expr ($_WORKAREASIZE - $_PIC32MX_DATASIZE)]
50 $_TARGETNAME configure -work-area-phys 0xa0000800 -work-area-size $_PIC32MX_PROGSIZE -work-area-backup 0
51 $_TARGETNAME configure -event reset-init {
53 # from reset the pic32 cannot execute code in ram - enable ram execution
54 # minimum offset from start of ram is 2k
57 global _PIC32MX_DATASIZE
58 global _PIC32MX_PROGSIZE
61 mww 0xbf882000 0x001f0040
62 # BMXDKPBA: 2k kernel data @ 0xa0000800
63 mww 0xbf882010 $_PIC32MX_DATASIZE
64 # BMXDUDBA: 16k kernel program @ 0xa0000800
65 mww 0xbf882020 $_PIC32MX_PROGSIZE
66 # BMXDUPBA: 0k user program
67 mww 0xbf882030 $_PIC32MX_PROGSIZE
70 set _FLASHNAME $_CHIPNAME.flash0
71 flash bank $_FLASHNAME pic32mx 0x1fc00000 0 0 0 $_TARGETNAME
72 # add virtual banks for kseg0 and kseg1
73 flash bank vbank0 virtual 0xbfc00000 0 0 0 $_TARGETNAME $_FLASHNAME
74 flash bank vbank1 virtual 0x9fc00000 0 0 0 $_TARGETNAME $_FLASHNAME
76 set _FLASHNAME $_CHIPNAME.flash1
77 flash bank $_FLASHNAME pic32mx 0x1d000000 0 0 0 $_TARGETNAME
78 # add virtual banks for kseg0 and kseg1
79 flash bank vbank2 virtual 0xbd000000 0 0 0 $_TARGETNAME $_FLASHNAME
80 flash bank vbank3 virtual 0x9d000000 0 0 0 $_TARGETNAME $_FLASHNAME