tcl/target/ti_k3: Add a gdb-attach event hook for armv8 and simplify startup function 16/6616/7
authorNishanth Menon <nm@ti.com>
Tue, 1 Mar 2022 15:09:55 +0000 (09:09 -0600)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sat, 12 Mar 2022 09:41:04 +0000 (09:41 +0000)
Since we can detect the type of target as well, reuse the _cpu_no_smp_up
function name and use the target name to simplify the _up function and
maintain consistency with what we introduced for r5.

Lets introduce gdb-attach event in a much cleaner fashion.

NOTE: we add a halt 1000 to retain the default gdb-attach hook behavior

While at it, fix a minor type of s/are/as in "Set Default target are
core 0" and simplify the foreach usage.

Signed-off-by: Nishanth Menon <nm@ti.com>
Change-Id: I3259b7c3ae4c71b06d921edfaefe17c03bb673dc
Reviewed-on: https://review.openocd.org/c/openocd/+/6616
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
tcl/target/ti_k3.cfg

index 883197b14b28f906087b04553fa243159621ec4e..f2267ca12979969e941fb0d03ac8b852b039ae15 100644 (file)
@@ -154,6 +154,16 @@ proc _cpu_no_smp_up {} {
        $_current_target $_current_type dbginit
 }
 
+proc _armv8_smp_up {} {
+       for { set _core 0 } { $_core < $::_armv8_cores } { incr _core } {
+               $::_TARGETNAME.$::_armv8_cpu_name.$_core arp_examine
+               $::_TARGETNAME.$::_armv8_cpu_name.$_core aarch64 dbginit
+               $::_TARGETNAME.$::_armv8_cpu_name.$_core aarch64 smp on
+       }
+       # Set Default target as core 0
+       targets $::_TARGETNAME.$::_armv8_cpu_name.0
+}
+
 set _v8_smp_targets ""
 
 for { set _core 0 } { $_core < $_armv8_cores } { incr _core } {
@@ -165,6 +175,20 @@ for { set _core 0 } { $_core < $_armv8_cores } { incr _core } {
                -dbgbase [lindex $ARMV8_DBGBASE $_core] -cti $_CTINAME.$_armv8_cpu_name.$_core -defer-examine
 
        set _v8_smp_targets "$_v8_smp_targets $_TARGETNAME.$_armv8_cpu_name.$_core"
+
+       if { $_v8_smp_debug == 0 } {
+               $_TARGETNAME.$_armv8_cpu_name.$_core configure -event gdb-attach {
+                       _cpu_no_smp_up
+                       # gdb-attach default rule
+                       halt 1000
+               }
+       } else {
+               $_TARGETNAME.$_armv8_cpu_name.$_core configure -event gdb-attach {
+                       _armv8_smp_up
+                       # gdb-attach default rule
+                       halt 1000
+               }
+       }
 }
 
 # Setup ARMV8 proc commands based on CPU to prevent people confusing SoCs
@@ -174,22 +198,15 @@ set _armv8_smp_cmd "$_armv8_cpu_name"_smp
 
 if { $_v8_smp_debug == 0 } {
        proc $_armv8_up_cmd { args } {
-               foreach { _core } [set args] {
-                       $::_TARGETNAME.$::_armv8_cpu_name.$_core arp_examine
-                       $::_TARGETNAME.$::_armv8_cpu_name.$_core aarch64 dbginit
+               foreach _core $args {
+                       targets $_core
+                       _cpu_no_smp_up
                }
        }
 } else {
        proc $_armv8_smp_cmd { args } {
-               for { set _core 0 } { $_core < $::_armv8_cores } { incr _core } {
-                       $::_TARGETNAME.$::_armv8_cpu_name.$_core arp_examine
-                       $::_TARGETNAME.$::_armv8_cpu_name.$_core aarch64 dbginit
-                       $::_TARGETNAME.$::_armv8_cpu_name.$_core aarch64 smp on
-               }
-               # Set Default target are core 0
-               targets $::_TARGETNAME.$::_armv8_cpu_name.0
+               _armv8_smp_up
        }
-
        # Declare SMP
        target smp $:::_v8_smp_targets
 }

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)