tcl/target/ti_k3: Rename m3 target as sysctrl
[fw/openocd] / tcl / target / psoc6.cfg
index ad9aba569d20727511b34a78eaaed2a66e98829e..bf63fd5d43246d98e019798e5f52b490a370590c 100644 (file)
@@ -6,7 +6,7 @@
 
 source [find target/swj-dp.tcl]
 
-adapter_khz 1000
+adapter speed 1000
 
 global _CHIPNAME
 if { [info exists CHIPNAME] } {
@@ -82,19 +82,30 @@ proc psoc6_deassert_post { target } {
        $target arp_examine
 
        global RESET_MODE
+       global TARGET
+
        if { $RESET_MODE ne "run" } {
                $target arp_poll
                $target arp_poll
                set st [$target curstate]
+
                if { $st eq "reset" } {
                        # we assume running state follows
                        # if reset accidentally halts, waiting is useless
                        catch { $target arp_waitstate running 100 }
                        set st [$target curstate]
                }
+
                if { $st eq "running" } {
                        echo "$target: Ran after reset and before halt..."
-                       $target arp_halt
+                       if { $target eq "${TARGET}.cm0" } {
+                               # Try to cleanly reset whole system
+                               # and halt the CM0 at entry point
+                               psoc6 reset_halt
+                               $target arp_waitstate halted 100
+                       } else {
+                               $target arp_halt
+                       }
                }
        }
 }
@@ -133,3 +144,7 @@ if { $_ENABLE_CM0 } {
        # Use CM0+ by default on dual-core devices
        targets ${TARGET}.cm0
 }
+
+if {[using_jtag]} {
+       jtag newtap $_CHIPNAME bs -irlen 18 -expected-id 0x2e200069
+}