jtag newtap change & huge manual update
[fw/openocd] / src / target / target / str912.cfg
index 6f605b06f6f4887e8a00778c2c6cdeb53ee39231..3b7d7ff1082e6fc21b236ad985f869380c61a1b8 100644 (file)
@@ -1,29 +1,58 @@
 # script for str9
 
-# jtag speed. We need to stick to 16kHz until we've finished reset.
+if { [info exists CHIPNAME] } {        
+   set  _CHIPNAME $CHIPNAME    
+} else {        
+   set  _CHIPNAME str912
+}
 
-jtag_rclk 16
+if { [info exists ENDIAN] } {  
+   set  _ENDIAN $ENDIAN    
+} else {        
+   set  _ENDIAN little
+}
 
 
+
+# jtag speed. We need to stick to 16kHz until we've finished reset.
+jtag_rclk 16
+
 jtag_nsrst_delay 100
 jtag_ntrst_delay 100
 
 #use combined on interfaces or targets that can't set TRST/SRST separately
 reset_config trst_and_srst
 
-#jtag scan chain
-#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
-jtag_device 8 0x1 0x1 0xfe
-jtag_device 4 0x1 0xf 0xe
-jtag_device 5 0x1 0x1 0x1e
+if { [info exists FLASHTAPID ] } {
+   set _FLASHTAPID $FLASHTAPID
+} else {
+   set _FLASHTAPID 0x25966041
+}
+jtag newtap $_CHIPNAME flash -irlen 8 -ircapture 0x1 -irmask 0xfe -expected-id $_FLASHTAPID
+
+if { [info exists CPUTAPID ] } {
+   set _CPUTAPID $CPUTAPID
+} else {
+   set _CPUTAPID 0x25966041
+}
+jtag newtap $_CHIPNAME cpu   -irlen 4 -ircapture 0x1 -irmask 0xe -expected-id $_CPUTAPID
+
+
+if { [info exists BSTAPID ] } {
+   set _BSTAPID $BSTAPID
+} else {
+   set _BSTAPID 0x1457f041
+}
+jtag newtap $_CHIPNAME bs    -irlen 5 -ircapture 0x1 -irmask 0x1e -expected-id $_BSTAPID
 
-target create target0 arm966e -endian little -chain-position 1 -variant arm966e
+set _TARGETNAME [format "%s.cpu" $_CHIPNAME]
+target create $_TARGETNAME arm966e -endian $_ENDIAN -chain-position $_TARGETNAME -variant arm966e
 
-[new_target_name] configure -event reset-start { jtag_rclk 16 }
+$_TARGETNAME configure -event reset-start { jtag_rclk 16 }
 
-[new_target_name] configure -event reset-init {
+$_TARGETNAME configure -event reset-init {
        # We can increase speed now that we know the target is halted.
-       jtag_rclk 3000
+       #jtag_rclk 3000
        
        # -- Enable 96K RAM
        # PFQBC enabled / DTCM & AHB wait-states disabled
@@ -33,7 +62,7 @@ target create target0 arm966e -endian little -chain-position 1 -variant arm966e
        flash protect 0 0 7 off
 }
 
-[new_target_name] configure -work-area-virt 0 -work-area-phys 0x50000000 -work-area-size 16384 -work-area-backup 0
+$_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x50000000 -work-area-size 16384 -work-area-backup 0
 
 #flash bank str9x <base> <size> 0 0 <target#> <variant>
 flash bank str9x 0x00000000 0x00080000 0 0 0