|
From: openocd-gerrit <ope...@us...> - 2026-07-25 10:44:43
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via b158f02a24ca3214343afc4050c19ca0f234a99f (commit)
from b1da42b16c713b2e940bc378133316639a101067 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit b158f02a24ca3214343afc4050c19ca0f234a99f
Author: Zane Leung <zhe...@sp...>
Date: Wed Jun 24 11:10:20 2026 +0800
tcl/target: Add SpacemiT keystone k3 config
Add basic connection details with keystone k3
Change-Id: I0f7b743ae9da99deca72e8a09f7eb69c02bafc60
Signed-off-by: Zane Leung <zhe...@sp...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9753
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/tcl/target/spacemit-k3.cfg b/tcl/target/spacemit-k3.cfg
new file mode 100644
index 000000000..53d1f66e0
--- /dev/null
+++ b/tcl/target/spacemit-k3.cfg
@@ -0,0 +1,135 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+#
+# SpacemiT Key Stone K3 target
+#
+# https://www.spacemit.com/products/keystone/k3
+#
+
+transport select jtag
+adapter speed 2000
+
+if { [info exists SPEED] } {
+ set _SPEED $SPEED
+} else {
+ set _SPEED 8000
+}
+
+if { [info exists CHIPNAME] } {
+ set _CHIPNAME $CHIPNAME
+} else {
+ set _CHIPNAME k3
+}
+
+# Set TARGET to "rcpu" to enable JTAG for RCPU
+if { [info exists TARGET] } {
+ set _TARGET $TARGET
+} else {
+ set _TARGET acpu
+}
+
+if { $_TARGET == "rcpu" } {
+ set _CPUTAPID 0x10308A6D
+ set _DRVAL 0xe
+} else {
+ set _CPUTAPID 0x10000E21
+ set _DRVAL 0xa
+}
+
+if { [info exists CLUSTERS] } {
+ set _CLUSTERS $CLUSTERS
+} else {
+ set _CLUSTERS {0 1 2 3}
+}
+
+for {set i 0} {$i < 4} {incr i} {
+ if { [info exists CLUSTER${i}_COREIDS] } {
+ set _CLUSTER${i}_COREIDS [set CLUSTER${i}_COREIDS]
+ } else {
+ set _CLUSTER${i}_COREIDS {0 1 2 3}
+ }
+}
+
+if { [info exists SECJTAG] } {
+ set _SECJTAG $SECJTAG
+} else {
+ set _SECJTAG 0
+}
+
+if { $_SECJTAG == 1 } {
+ jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id $_CPUTAPID
+} else {
+ jtag newtap pre unknown -irlen 1 -expected-id 0x00000000 -disable
+ jtag configure pre.unknown -event tap-enable ""
+
+ jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id $_CPUTAPID -disable
+ jtag configure $_CHIPNAME.cpu -event tap-enable ""
+
+ jtag newtap post unknown -irlen 9 -expected-id 0x08502C0D -ignore-version
+
+ jtag configure post.unknown -event setup {
+ global _CHIPNAME _DRVAL
+
+ irscan post.unknown 0x98
+ drscan post.unknown 16 $_DRVAL
+
+ jtag tapenable pre.unknown
+ jtag tapenable $_CHIPNAME.cpu
+ }
+}
+
+set _smp_command "target smp"
+
+if { $_TARGET == "rcpu" } {
+ set _TARGETNAME $_CHIPNAME.$_TARGET
+ foreach coreid $_CLUSTER0_COREIDS {
+ if { $coreid >= 2 } {
+ echo [format "Warning: rcpu index %u is out of range (0..1), it will be ignored" $coreid]
+ continue
+ }
+ target create $_TARGETNAME.$coreid riscv -chain-position $_CHIPNAME.cpu \
+ -coreid $coreid
+
+ if { $coreid == 0 } {
+ $_TARGETNAME.$coreid configure -rtos hwthread
+ }
+
+ set _smp_command "$_smp_command $_TARGETNAME.$coreid"
+ }
+} else {
+ foreach cluster $_CLUSTERS {
+ if { $cluster < 2 } {
+ set _TARGETNAME $_CHIPNAME.x100
+ } elseif { $cluster < 4 } {
+ set _TARGETNAME $_CHIPNAME.a100
+ } else {
+ echo [format "Warning: acpu cluster %u is out of range (0..3), it will be ignored" $cluster]
+ continue
+ }
+
+ set dbgbase [expr {$cluster * 0x400}]
+ foreach coreid [set _CLUSTER${cluster}_COREIDS] {
+ if { $coreid >= 4 } {
+ echo [format "Warning: acpu index %u is out of range (0..3), it will be ignored" $coreid]
+ continue
+ }
+ set hartid [expr {$cluster * 4 + $coreid}]
+ target create $_TARGETNAME.$hartid riscv -chain-position $_CHIPNAME.cpu \
+ -coreid $coreid -dbgbase $dbgbase
+
+ if { $hartid == 0 } {
+ $_TARGETNAME.$hartid configure -rtos hwthread
+ }
+
+ set _smp_command "$_smp_command $_TARGETNAME.$hartid"
+ }
+ }
+}
+
+eval $_smp_command
+
+[target current] configure -event examine-end {
+ adapter speed $_SPEED
+ puts [ adapter speed ]
+ puts [ targets ]
+}
-----------------------------------------------------------------------
Summary of changes:
tcl/target/{spacemit-k1.cfg => spacemit-k3.cfg} | 47 +++++++++++++++++--------
1 file changed, 33 insertions(+), 14 deletions(-)
copy tcl/target/{spacemit-k1.cfg => spacemit-k3.cfg} (64%)
hooks/post-receive
--
Main OpenOCD repository
|