99b5b51a30b2838b5cadd9af491f28569009a478
[openocd.git] / tcl / target / ti_k3.cfg
1 # SPDX-License-Identifier: GPL-2.0-or-later
2 # Copyright (C) 2019-2021 Texas Instruments Incorporated - http://www.ti.com/
3 #
4 # Texas Instruments K3 devices:
5 # * AM654x: https://www.ti.com/lit/pdf/spruid7
6 # Has 4 ARMV8 Cores and 2 R5 Cores and an M3
7 # * J721E: https://www.ti.com/lit/pdf/spruil1
8 # Has 2 ARMV8 Cores and 6 R5 Cores and an M3
9 # * J7200: https://www.ti.com/lit/pdf/spruiu1
10 # Has 2 ARMV8 Cores and 4 R5 Cores and an M3
11 # * J721S2: https://www.ti.com/lit/pdf/spruj28
12 # Has 2 ARMV8 Cores and 6 R5 Cores and an M4F
13 # * AM642: https://www.ti.com/lit/pdf/spruim2
14 # Has 2 ARMV8 Cores and 4 R5 Cores, M4F and an M3
15 # * AM625: https://www.ti.com/lit/pdf/spruiv7a
16 # Has 4 ARMV8 Cores and 1 R5 Core and an M4F
17 # * AM62a7: https://www.ti.com/lit/pdf/spruj16a
18 # Has 4 ARMV8 Cores and 2 R5 Cores
19 #
20
21 source [find target/swj-dp.tcl]
22
23 if { [info exists SOC] } {
24 set _soc $SOC
25 } else {
26 set _soc am654
27 }
28
29 # set V8_SMP_DEBUG to non 0 value in board if you'd like to use SMP debug
30 if { [info exists V8_SMP_DEBUG] } {
31 set _v8_smp_debug $V8_SMP_DEBUG
32 } else {
33 set _v8_smp_debug 0
34 }
35
36 # Common Definitions
37
38 # System Controller is the very first processor - all current SoCs have it.
39 set CM3_CTIBASE {0x3C016000}
40
41 # sysctrl power-ap unlock offsets
42 set _sysctrl_ap_unlock_offsets {0xf0 0x44}
43
44 # All the ARMV8s are the next processors.
45 # CL0,CORE0 CL0,CORE1 CL1,CORE0 CL1,CORE1
46 set ARMV8_DBGBASE {0x90410000 0x90510000 0x90810000 0x90910000}
47 set ARMV8_CTIBASE {0x90420000 0x90520000 0x90820000 0x90920000}
48
49 # And we add up the R5s
50 # (0)MCU 0 (1)MCU 1 (2)MAIN_0_0 (3)MAIN_0_1 (4)MAIN_1_0 (5)MAIN_1_1
51 set R5_DBGBASE {0x9d010000 0x9d012000 0x9d410000 0x9d412000 0x9d510000 0x9d512000}
52 set R5_CTIBASE {0x9d018000 0x9d019000 0x9d418000 0x9d419000 0x9d518000 0x9d519000}
53 set R5_NAMES {mcu_r5.0 mcu_r5.1 main0_r5.0 main0_r5.1 main1_r5.0 main1_r5.1}
54
55 # Finally an General Purpose(GP) MCU
56 set CM4_CTIBASE {0x20001000}
57
58 # General Purpose MCU (M4) may be present on some very few SoCs
59 set _gp_mcu_cores 0
60 # General Purpose MCU power-ap unlock offsets
61 set _gp_mcu_ap_unlock_offsets {0xf0 0x60}
62
63 # Set configuration overrides for each SOC
64 switch $_soc {
65 am654 {
66 set _CHIPNAME am654
67 set _K3_DAP_TAPID 0x0bb5a02f
68
69 # AM654 has 2 clusters of 2 A53 cores each.
70 set _armv8_cpu_name a53
71 set _armv8_cores 4
72
73 # AM654 has 1 cluster of 2 R5s cores.
74 set _r5_cores 2
75 set R5_NAMES {mcu_r5.0 mcu_r5.1}
76
77 # Sysctrl power-ap unlock offsets
78 set _sysctrl_ap_unlock_offsets {0xf0 0x50}
79 }
80 am642 {
81 set _CHIPNAME am642
82 set _K3_DAP_TAPID 0x0bb3802f
83
84 # AM642 has 1 clusters of 2 A53 cores each.
85 set _armv8_cpu_name a53
86 set _armv8_cores 2
87 set ARMV8_DBGBASE {0x90010000 0x90110000}
88 set ARMV8_CTIBASE {0x90020000 0x90120000}
89
90 # AM642 has 2 cluster of 2 R5s cores.
91 set _r5_cores 4
92 set R5_NAMES {main0_r5.0 main0_r5.1 main1_r5.0 main1_r5.1}
93 set R5_DBGBASE {0x9d410000 0x9d412000 0x9d510000 0x9d512000}
94 set R5_CTIBASE {0x9d418000 0x9d419000 0x9d518000 0x9d519000}
95
96 # M4 processor
97 set _gp_mcu_cores 1
98 }
99 am625 {
100 set _CHIPNAME am625
101 set _K3_DAP_TAPID 0x0bb7e02f
102
103 # AM625 has 1 clusters of 4 A53 cores.
104 set _armv8_cpu_name a53
105 set _armv8_cores 4
106 set ARMV8_DBGBASE {0x90010000 0x90110000 0x90210000 0x90310000}
107 set ARMV8_CTIBASE {0x90020000 0x90120000 0x90220000 0x90320000}
108
109 # AM625 has 1 cluster of 1 R5s core.
110 set _r5_cores 1
111 set R5_NAMES {main0_r5.0}
112 set R5_DBGBASE {0x9d410000}
113 set R5_CTIBASE {0x9d418000}
114
115 # sysctrl CTI base
116 set CM3_CTIBASE {0x20001000}
117 # Sysctrl power-ap unlock offsets
118 set _sysctrl_ap_unlock_offsets {0xf0 0x78}
119
120 # M4 processor
121 set _gp_mcu_cores 1
122 set _gp_mcu_ap_unlock_offsets {0xf0 0x7c}
123 }
124 am62a7 {
125 set _CHIPNAME am62a7
126 set _K3_DAP_TAPID 0x0bb8d02f
127
128 # AM62a7 has 1 clusters of 4 A53 cores.
129 set _armv8_cpu_name a53
130 set _armv8_cores 4
131 set ARMV8_DBGBASE {0x90010000 0x90110000 0x90210000 0x90310000}
132 set ARMV8_CTIBASE {0x90020000 0x90120000 0x90220000 0x90320000}
133
134 # AM62a7 has 2 cluster of 1 R5s core.
135 set _r5_cores 2
136 set R5_NAMES {main0_r5.0 mcu0_r5.0}
137 set R5_DBGBASE {0x9d410000 0x9d810000}
138 set R5_CTIBASE {0x9d418000 0x9d818000}
139
140 # sysctrl CTI base
141 set CM3_CTIBASE {0x20001000}
142 # Sysctrl power-ap unlock offsets
143 set _sysctrl_ap_unlock_offsets {0xf0 0x78}
144 }
145 j721e {
146 set _CHIPNAME j721e
147 set _K3_DAP_TAPID 0x0bb6402f
148 # J721E has 1 cluster of 2 A72 cores.
149 set _armv8_cpu_name a72
150 set _armv8_cores 2
151
152 # J721E has 3 clusters of 2 R5 cores each.
153 set _r5_cores 6
154 }
155 j7200 {
156 set _CHIPNAME j7200
157 set _K3_DAP_TAPID 0x0bb6d02f
158
159 # J7200 has 1 cluster of 2 A72 cores.
160 set _armv8_cpu_name a72
161 set _armv8_cores 2
162
163 # J7200 has 2 clusters of 2 R5 cores each.
164 set _r5_cores 4
165 set R5_DBGBASE {0x9d010000 0x9d012000 0x9d110000 0x9d112000}
166 set R5_CTIBASE {0x9d018000 0x9d019000 0x9d118000 0x9d119000}
167
168 # M3 CTI base
169 set CM3_CTIBASE {0x20001000}
170 }
171 j721s2 {
172 set _CHIPNAME j721s2
173 set _K3_DAP_TAPID 0x0bb7502f
174
175 # J721s2 has 1 cluster of 2 A72 cores.
176 set _armv8_cpu_name a72
177 set _armv8_cores 2
178
179 # J721s2 has 3 clusters of 2 R5 cores each.
180 set _r5_cores 6
181
182 # sysctrl CTI base
183 set CM3_CTIBASE {0x20001000}
184 # Sysctrl power-ap unlock offsets
185 set _sysctrl_ap_unlock_offsets {0xf0 0x78}
186
187 # M4 processor
188 set _gp_mcu_cores 1
189 set _gp_mcu_ap_unlock_offsets {0xf0 0x7c}
190 }
191 default {
192 echo "'$_soc' is invalid!"
193 }
194 }
195
196 swj_newdap $_CHIPNAME cpu -irlen 4 -expected-id $_K3_DAP_TAPID -ignore-version
197
198 dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu
199
200 set _TARGETNAME $_CHIPNAME.cpu
201
202 set _CTINAME $_CHIPNAME.cti
203
204 # sysctrl is always present
205 cti create $_CTINAME.sysctrl -dap $_CHIPNAME.dap -ap-num 7 -baseaddr [lindex $CM3_CTIBASE 0]
206 target create $_TARGETNAME.sysctrl cortex_m -dap $_CHIPNAME.dap -ap-num 7 -defer-examine
207 $_TARGETNAME.sysctrl configure -event reset-assert { }
208
209 proc sysctrl_up {} {
210 # To access sysctrl, we need to enable the JTAG access for the same.
211 # Ensure Power-AP unlocked
212 $::_CHIPNAME.dap apreg 3 [lindex $::_sysctrl_ap_unlock_offsets 0] 0x00190000
213 $::_CHIPNAME.dap apreg 3 [lindex $::_sysctrl_ap_unlock_offsets 1] 0x00102098
214
215 $::_TARGETNAME.sysctrl arp_examine
216 }
217
218 $_TARGETNAME.sysctrl configure -event gdb-attach {
219 sysctrl_up
220 # gdb-attach default rule
221 halt 1000
222 }
223
224 proc _cpu_no_smp_up {} {
225 set _current_target [target current]
226 set _current_type [$_current_target cget -type]
227
228 $_current_target arp_examine
229 $_current_target $_current_type dbginit
230 }
231
232 proc _armv8_smp_up {} {
233 for { set _core 0 } { $_core < $::_armv8_cores } { incr _core } {
234 $::_TARGETNAME.$::_armv8_cpu_name.$_core arp_examine
235 $::_TARGETNAME.$::_armv8_cpu_name.$_core aarch64 dbginit
236 $::_TARGETNAME.$::_armv8_cpu_name.$_core aarch64 smp on
237 }
238 # Set Default target as core 0
239 targets $::_TARGETNAME.$::_armv8_cpu_name.0
240 }
241
242 set _v8_smp_targets ""
243
244 for { set _core 0 } { $_core < $_armv8_cores } { incr _core } {
245
246 cti create $_CTINAME.$_armv8_cpu_name.$_core -dap $_CHIPNAME.dap -ap-num 1 \
247 -baseaddr [lindex $ARMV8_CTIBASE $_core]
248
249 target create $_TARGETNAME.$_armv8_cpu_name.$_core aarch64 -dap $_CHIPNAME.dap \
250 -dbgbase [lindex $ARMV8_DBGBASE $_core] -cti $_CTINAME.$_armv8_cpu_name.$_core -defer-examine
251
252 set _v8_smp_targets "$_v8_smp_targets $_TARGETNAME.$_armv8_cpu_name.$_core"
253
254 if { $_v8_smp_debug == 0 } {
255 $_TARGETNAME.$_armv8_cpu_name.$_core configure -event gdb-attach {
256 _cpu_no_smp_up
257 # gdb-attach default rule
258 halt 1000
259 }
260 } else {
261 $_TARGETNAME.$_armv8_cpu_name.$_core configure -event gdb-attach {
262 _armv8_smp_up
263 # gdb-attach default rule
264 halt 1000
265 }
266 }
267 }
268
269 # Setup ARMV8 proc commands based on CPU to prevent people confusing SoCs
270 set _armv8_up_cmd "$_armv8_cpu_name"_up
271 # Available if V8_SMP_DEBUG is set to non-zero value
272 set _armv8_smp_cmd "$_armv8_cpu_name"_smp
273
274 if { $_v8_smp_debug == 0 } {
275 proc $_armv8_up_cmd { args } {
276 foreach _core $args {
277 targets $_core
278 _cpu_no_smp_up
279 }
280 }
281 } else {
282 proc $_armv8_smp_cmd { args } {
283 _armv8_smp_up
284 }
285 # Declare SMP
286 target smp $:::_v8_smp_targets
287 }
288
289 for { set _core 0 } { $_core < $_r5_cores } { incr _core } {
290 set _r5_name [lindex $R5_NAMES $_core]
291 cti create $_CTINAME.$_r5_name -dap $_CHIPNAME.dap -ap-num 1 \
292 -baseaddr [lindex $R5_CTIBASE $_core]
293
294 # inactive core examination will fail - wait till startup of additional core
295 target create $_TARGETNAME.$_r5_name cortex_r4 -dap $_CHIPNAME.dap \
296 -dbgbase [lindex $R5_DBGBASE $_core] -ap-num 1 -defer-examine
297
298 $_TARGETNAME.$_r5_name configure -event gdb-attach {
299 _cpu_no_smp_up
300 # gdb-attach default rule
301 halt 1000
302 }
303 }
304
305 proc r5_up { args } {
306 foreach _core $args {
307 targets $_core
308 _cpu_no_smp_up
309 }
310 }
311
312 if { $_gp_mcu_cores != 0 } {
313 cti create $_CTINAME.gp_mcu -dap $_CHIPNAME.dap -ap-num 8 -baseaddr [lindex $CM4_CTIBASE 0]
314 target create $_TARGETNAME.gp_mcu cortex_m -dap $_CHIPNAME.dap -ap-num 8 -defer-examine
315 $_TARGETNAME.gp_mcu configure -event reset-assert { }
316
317 proc gp_mcu_up {} {
318 # To access GP MCU, we need to enable the JTAG access for the same.
319 # Ensure Power-AP unlocked
320 $::_CHIPNAME.dap apreg 3 [lindex $::_gp_mcu_ap_unlock_offsets 0] 0x00190000
321 $::_CHIPNAME.dap apreg 3 [lindex $::_gp_mcu_ap_unlock_offsets 1] 0x00102098
322
323 $::_TARGETNAME.gp_mcu arp_examine
324 }
325
326 $_TARGETNAME.gp_mcu configure -event gdb-attach {
327 gp_mcu_up
328 # gdb-attach default rule
329 halt 1000
330 }
331 }

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)