aboutsummaryrefslogtreecommitdiff
path: root/tcl
diff options
context:
space:
mode:
authorNishanth Menon <nm@ti.com>2022-03-01 09:09:55 -0600
committerAntonio Borneo <borneo.antonio@gmail.com>2022-03-12 09:41:04 +0000
commit4ea21b95f9562ae13ef200461180bc72bbad8926 (patch)
tree7d28017fc64e80bf469fcc9a88897f15bfbd882b /tcl
parent3ba2b515b528094b43d5be5056b9e52f1dc33969 (diff)
downloadriscv-openocd-4ea21b95f9562ae13ef200461180bc72bbad8926.zip
riscv-openocd-4ea21b95f9562ae13ef200461180bc72bbad8926.tar.gz
riscv-openocd-4ea21b95f9562ae13ef200461180bc72bbad8926.tar.bz2
tcl/target/ti_k3: Add a gdb-attach event hook for armv8 and simplify startup function
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>
Diffstat (limited to 'tcl')
-rw-r--r--tcl/target/ti_k3.cfg39
1 files changed, 28 insertions, 11 deletions
diff --git a/tcl/target/ti_k3.cfg b/tcl/target/ti_k3.cfg
index 883197b..f2267ca 100644
--- a/tcl/target/ti_k3.cfg
+++ b/tcl/target/ti_k3.cfg
@@ -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
}