bb2a991ce5941e39ddcb2cda0867297267717954
[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 # * J784S4/AM69: http://www.ti.com/lit/zip/spruj52
14 # Has 8 ARMV8 Cores and 8 R5 Cores
15 # * AM642: https://www.ti.com/lit/pdf/spruim2
16 # Has 2 ARMV8 Cores and 4 R5 Cores, M4F and an M3
17 # * AM625: https://www.ti.com/lit/pdf/spruiv7a
18 # Has 4 ARMV8 Cores and 1 R5 Core and an M4F
19 # * AM62a7: https://www.ti.com/lit/pdf/spruj16a
20 # Has 4 ARMV8 Cores and 2 R5 Cores
21 # * AM62P: https://www.ti.com/lit/pdf/spruj83
22 # Has 4 ARMV8 Cores and 2 R5 Cores
23 #
24
25 source [find target/swj-dp.tcl]
26
27 if { [info exists SOC] } {
28 set _soc $SOC
29 } else {
30 set _soc am654
31 }
32
33 # set V8_SMP_DEBUG to non 0 value in board if you'd like to use SMP debug
34 if { [info exists V8_SMP_DEBUG] } {
35 set _v8_smp_debug $V8_SMP_DEBUG
36 } else {
37 set _v8_smp_debug 0
38 }
39
40 # Common Definitions
41
42 # System Controller is the very first processor - all current SoCs have it.
43 set CM3_CTIBASE {0x3C016000}
44
45 # sysctrl power-ap unlock offsets
46 set _sysctrl_ap_unlock_offsets {0xf0 0x44}
47 set _sysctrl_ap_num 7
48
49 # All the ARMV8s are the next processors.
50 # CL0,CORE0 CL0,CORE1 CL1,CORE0 CL1,CORE1
51 set ARMV8_DBGBASE {0x90410000 0x90510000 0x90810000 0x90910000}
52 set ARMV8_CTIBASE {0x90420000 0x90520000 0x90820000 0x90920000}
53
54 # And we add up the R5s
55 # (0)MCU 0 (1)MCU 1 (2)MAIN_0_0 (3)MAIN_0_1 (4)MAIN_1_0 (5)MAIN_1_1
56 set R5_DBGBASE {0x9d010000 0x9d012000 0x9d410000 0x9d412000 0x9d510000 0x9d512000}
57 set R5_CTIBASE {0x9d018000 0x9d019000 0x9d418000 0x9d419000 0x9d518000 0x9d519000}
58 set R5_NAMES {mcu_r5.0 mcu_r5.1 main0_r5.0 main0_r5.1 main1_r5.0 main1_r5.1}
59 set _r5_ap_num 1
60
61 # Finally an General Purpose(GP) MCU
62 set CM4_CTIBASE {0x20001000}
63
64 # General Purpose MCU (M4) may be present on some very few SoCs
65 set _gp_mcu_cores 0
66 # General Purpose MCU power-ap unlock offsets
67 set _gp_mcu_ap_unlock_offsets {0xf0 0x60}
68
69 # Generic mem-ap port number
70 set _mem_ap_num 2
71
72 # Set configuration overrides for each SOC
73 switch $_soc {
74 am654 {
75 set _K3_DAP_TAPID 0x0bb5a02f
76
77 # AM654 has 2 clusters of 2 A53 cores each.
78 set _armv8_cpu_name a53
79 set _armv8_cores 4
80
81 # AM654 has 1 cluster of 2 R5s cores.
82 set _r5_cores 2
83 set R5_NAMES {mcu_r5.0 mcu_r5.1}
84
85 # Sysctrl power-ap unlock offsets
86 set _sysctrl_ap_unlock_offsets {0xf0 0x50}
87 }
88 am642 {
89 set _K3_DAP_TAPID 0x0bb3802f
90
91 # AM642 has 1 clusters of 2 A53 cores each.
92 set _armv8_cpu_name a53
93 set _armv8_cores 2
94 set ARMV8_DBGBASE {0x90010000 0x90110000}
95 set ARMV8_CTIBASE {0x90020000 0x90120000}
96
97 # AM642 has 2 cluster of 2 R5s cores.
98 set _r5_cores 4
99 set R5_NAMES {main0_r5.0 main0_r5.1 main1_r5.0 main1_r5.1}
100 set R5_DBGBASE {0x9d410000 0x9d412000 0x9d510000 0x9d512000}
101 set R5_CTIBASE {0x9d418000 0x9d419000 0x9d518000 0x9d519000}
102
103 # M4 processor
104 set _gp_mcu_cores 1
105 }
106 am625 {
107 set _K3_DAP_TAPID 0x0bb7e02f
108
109 # AM625 has 1 clusters of 4 A53 cores.
110 set _armv8_cpu_name a53
111 set _armv8_cores 4
112 set ARMV8_DBGBASE {0x90010000 0x90110000 0x90210000 0x90310000}
113 set ARMV8_CTIBASE {0x90020000 0x90120000 0x90220000 0x90320000}
114
115 # AM625 has 1 cluster of 1 R5s core.
116 set _r5_cores 1
117 set R5_NAMES {main0_r5.0}
118 set R5_DBGBASE {0x9d410000}
119 set R5_CTIBASE {0x9d418000}
120
121 # sysctrl CTI base
122 set CM3_CTIBASE {0x20001000}
123 # Sysctrl power-ap unlock offsets
124 set _sysctrl_ap_unlock_offsets {0xf0 0x78}
125
126 # M4 processor
127 set _gp_mcu_cores 1
128 set _gp_mcu_ap_unlock_offsets {0xf0 0x7c}
129
130 # Setup DMEM access descriptions
131 # DAPBUS (Debugger) description
132 set _dmem_base_address 0x740002000
133 set _dmem_ap_address_offset 0x100
134 set _dmem_max_aps 10
135 # Emulated AP description
136 set _dmem_emu_base_address 0x760000000
137 set _dmem_emu_base_address_map_to 0x1d500000
138 set _dmem_emu_ap_list 1
139 }
140 am62p -
141 am62a7 {
142 set _K3_DAP_TAPID 0x0bb8d02f
143
144 # AM62a7/AM62P has 1 cluster of 4 A53 cores.
145 set _armv8_cpu_name a53
146 set _armv8_cores 4
147 set ARMV8_DBGBASE {0x90010000 0x90110000 0x90210000 0x90310000}
148 set ARMV8_CTIBASE {0x90020000 0x90120000 0x90220000 0x90320000}
149
150 # AM62a7/AM62P has 2 cluster of 1 R5 core.
151 set _r5_cores 2
152 set R5_NAMES {main0_r5.0 mcu0_r5.0}
153 set R5_DBGBASE {0x9d410000 0x9d810000}
154 set R5_CTIBASE {0x9d418000 0x9d818000}
155
156 # sysctrl CTI base
157 set CM3_CTIBASE {0x20001000}
158 # Sysctrl power-ap unlock offsets
159 set _sysctrl_ap_unlock_offsets {0xf0 0x78}
160
161 # Overrides for am62p
162 if { "$_soc" == "am62p" } {
163 set _K3_DAP_TAPID 0x0bb9d02f
164 set R5_NAMES {wkup0_r5.0 mcu0_r5.0}
165 }
166 }
167 j721e {
168 set _K3_DAP_TAPID 0x0bb6402f
169 # J721E has 1 cluster of 2 A72 cores.
170 set _armv8_cpu_name a72
171 set _armv8_cores 2
172
173 # J721E has 3 clusters of 2 R5 cores each.
174 set _r5_cores 6
175
176 # Setup DMEM access descriptions
177 # DAPBUS (Debugger) description
178 set _dmem_base_address 0x4c40002000
179 set _dmem_ap_address_offset 0x100
180 set _dmem_max_aps 8
181 # Emulated AP description
182 set _dmem_emu_base_address 0x4c60000000
183 set _dmem_emu_base_address_map_to 0x1d600000
184 set _dmem_emu_ap_list 1
185 }
186 j7200 {
187 set _K3_DAP_TAPID 0x0bb6d02f
188
189 # J7200 has 1 cluster of 2 A72 cores.
190 set _armv8_cpu_name a72
191 set _armv8_cores 2
192
193 # J7200 has 2 clusters of 2 R5 cores each.
194 set _r5_cores 4
195 set R5_DBGBASE {0x9d010000 0x9d012000 0x9d110000 0x9d112000}
196 set R5_CTIBASE {0x9d018000 0x9d019000 0x9d118000 0x9d119000}
197
198 # M3 CTI base
199 set CM3_CTIBASE {0x20001000}
200 }
201 j721s2 {
202 set _K3_DAP_TAPID 0x0bb7502f
203
204 # J721s2 has 1 cluster of 2 A72 cores.
205 set _armv8_cpu_name a72
206 set _armv8_cores 2
207
208 # J721s2 has 3 clusters of 2 R5 cores each.
209 set _r5_cores 6
210
211 # sysctrl CTI base
212 set CM3_CTIBASE {0x20001000}
213 # Sysctrl power-ap unlock offsets
214 set _sysctrl_ap_unlock_offsets {0xf0 0x78}
215
216 # M4 processor
217 set _gp_mcu_cores 1
218 set _gp_mcu_ap_unlock_offsets {0xf0 0x7c}
219 }
220 j784s4 {
221 set _K3_DAP_TAPID 0x0bb8002f
222
223 # j784s4 has 2 cluster of 4 A72 cores each.
224 set _armv8_cpu_name a72
225 set _armv8_cores 8
226 set ARMV8_DBGBASE {0x90410000 0x90510000 0x90610000 0x90710000
227 0x90810000 0x90910000 0x90a10000 0x90b10000}
228 set ARMV8_CTIBASE {0x90420000 0x90520000 0x90620000 0x90720000
229 0x90820000 0x90920000 0x90a20000 0x90b20000}
230
231 # J721s2 has 4 clusters of 2 R5 cores each.
232 set _r5_cores 8
233 set R5_DBGBASE {0x9d010000 0x9d012000
234 0x9d410000 0x9d412000
235 0x9d510000 0x9d512000
236 0x9d610000 0x9d612000}
237 set R5_CTIBASE {0x9d018000 0x9d019000
238 0x9d418000 0x9d419000
239 0x9d518000 0x9d519000
240 0x9d618000 0x9d619000}
241 set R5_NAMES {mcu_r5.0 mcu_r5.1
242 main0_r5.0 main0_r5.1
243 main1_r5.0 main1_r5.1
244 main2_r5.0 main2_r5.1}
245
246 # sysctrl CTI base
247 set CM3_CTIBASE {0x20001000}
248 # Sysctrl power-ap unlock offsets
249 set _sysctrl_ap_unlock_offsets {0xf0 0x78}
250 }
251 default {
252 echo "'$_soc' is invalid!"
253 }
254 }
255
256 proc _get_rtos_type_for_cpu { target_name } {
257 if { [info exists ::RTOS($target_name)] } {
258 return $::RTOS($target_name)
259 }
260 return none
261 }
262
263 set _CHIPNAME $_soc
264
265 swj_newdap $_CHIPNAME cpu -irlen 4 -expected-id $_K3_DAP_TAPID -ignore-version
266
267 dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu
268
269 set _TARGETNAME $_CHIPNAME.cpu
270
271 set _CTINAME $_CHIPNAME.cti
272
273 # sysctrl is always present
274 cti create $_CTINAME.sysctrl -dap $_CHIPNAME.dap \
275 -ap-num $_sysctrl_ap_num -baseaddr [lindex $CM3_CTIBASE 0]
276
277 target create $_TARGETNAME.sysctrl cortex_m -dap $_CHIPNAME.dap \
278 -ap-num $_sysctrl_ap_num -defer-examine \
279 -rtos [_get_rtos_type_for_cpu $_TARGETNAME.sysctrl]
280
281 $_TARGETNAME.sysctrl configure -event reset-assert { }
282
283 proc sysctrl_up {} {
284 # To access sysctrl, we need to enable the JTAG access for the same.
285 # Ensure Power-AP unlocked
286 $::_CHIPNAME.dap apreg 3 [lindex $::_sysctrl_ap_unlock_offsets 0] 0x00190000
287 $::_CHIPNAME.dap apreg 3 [lindex $::_sysctrl_ap_unlock_offsets 1] 0x00102098
288
289 $::_TARGETNAME.sysctrl arp_examine
290 }
291
292 $_TARGETNAME.sysctrl configure -event gdb-attach {
293 sysctrl_up
294 # gdb-attach default rule
295 halt 1000
296 }
297
298 proc _cpu_no_smp_up {} {
299 set _current_target [target current]
300 set _current_type [$_current_target cget -type]
301
302 $_current_target arp_examine
303 $_current_target $_current_type dbginit
304 }
305
306 proc _armv8_smp_up {} {
307 for { set _core 0 } { $_core < $::_armv8_cores } { incr _core } {
308 $::_TARGETNAME.$::_armv8_cpu_name.$_core arp_examine
309 $::_TARGETNAME.$::_armv8_cpu_name.$_core aarch64 dbginit
310 $::_TARGETNAME.$::_armv8_cpu_name.$_core aarch64 smp on
311 }
312 # Set Default target as core 0
313 targets $::_TARGETNAME.$::_armv8_cpu_name.0
314 }
315
316 set _v8_smp_targets ""
317
318 for { set _core 0 } { $_core < $_armv8_cores } { incr _core } {
319
320 cti create $_CTINAME.$_armv8_cpu_name.$_core -dap $_CHIPNAME.dap -ap-num 1 \
321 -baseaddr [lindex $ARMV8_CTIBASE $_core]
322
323 target create $_TARGETNAME.$_armv8_cpu_name.$_core aarch64 -dap $_CHIPNAME.dap -coreid $_core \
324 -dbgbase [lindex $ARMV8_DBGBASE $_core] -cti $_CTINAME.$_armv8_cpu_name.$_core -defer-examine \
325 -rtos [_get_rtos_type_for_cpu $_TARGETNAME.$_armv8_cpu_name.$_core]
326
327 set _v8_smp_targets "$_v8_smp_targets $_TARGETNAME.$_armv8_cpu_name.$_core"
328
329 if { $_v8_smp_debug == 0 } {
330 $_TARGETNAME.$_armv8_cpu_name.$_core configure -event gdb-attach {
331 _cpu_no_smp_up
332 # gdb-attach default rule
333 halt 1000
334 }
335 } else {
336 $_TARGETNAME.$_armv8_cpu_name.$_core configure -event gdb-attach {
337 _armv8_smp_up
338 # gdb-attach default rule
339 halt 1000
340 }
341 }
342 }
343
344 # Setup ARMV8 proc commands based on CPU to prevent people confusing SoCs
345 set _armv8_up_cmd "$_armv8_cpu_name"_up
346 # Available if V8_SMP_DEBUG is set to non-zero value
347 set _armv8_smp_cmd "$_armv8_cpu_name"_smp
348
349 if { $_v8_smp_debug == 0 } {
350 proc $_armv8_up_cmd { args } {
351 foreach _core $args {
352 targets $_core
353 _cpu_no_smp_up
354 }
355 }
356 } else {
357 proc $_armv8_smp_cmd { args } {
358 _armv8_smp_up
359 }
360 # Declare SMP
361 target smp {*}$_v8_smp_targets
362 }
363
364 for { set _core 0 } { $_core < $_r5_cores } { incr _core } {
365 set _r5_name [lindex $R5_NAMES $_core]
366 cti create $_CTINAME.$_r5_name -dap $_CHIPNAME.dap -ap-num $_r5_ap_num \
367 -baseaddr [lindex $R5_CTIBASE $_core]
368
369 # inactive core examination will fail - wait till startup of additional core
370 target create $_TARGETNAME.$_r5_name cortex_r4 -dap $_CHIPNAME.dap \
371 -dbgbase [lindex $R5_DBGBASE $_core] -ap-num $_r5_ap_num -defer-examine \
372 -rtos [_get_rtos_type_for_cpu $_TARGETNAME.$_r5_name]
373
374 $_TARGETNAME.$_r5_name configure -event gdb-attach {
375 _cpu_no_smp_up
376 # gdb-attach default rule
377 halt 1000
378 }
379 }
380
381 proc r5_up { args } {
382 foreach _core $args {
383 targets $_core
384 _cpu_no_smp_up
385 }
386 }
387
388 if { $_gp_mcu_cores != 0 } {
389 cti create $_CTINAME.gp_mcu -dap $_CHIPNAME.dap -ap-num 8 -baseaddr [lindex $CM4_CTIBASE 0]
390 target create $_TARGETNAME.gp_mcu cortex_m -dap $_CHIPNAME.dap -ap-num 8 -defer-examine \
391 -rtos [_get_rtos_type_for_cpu $_TARGETNAME.gp_mcu]
392 $_TARGETNAME.gp_mcu configure -event reset-assert { }
393
394 proc gp_mcu_up {} {
395 # To access GP MCU, we need to enable the JTAG access for the same.
396 # Ensure Power-AP unlocked
397 $::_CHIPNAME.dap apreg 3 [lindex $::_gp_mcu_ap_unlock_offsets 0] 0x00190000
398 $::_CHIPNAME.dap apreg 3 [lindex $::_gp_mcu_ap_unlock_offsets 1] 0x00102098
399
400 $::_TARGETNAME.gp_mcu arp_examine
401 }
402
403 $_TARGETNAME.gp_mcu configure -event gdb-attach {
404 gp_mcu_up
405 # gdb-attach default rule
406 halt 1000
407 }
408 }
409
410 # In case of DMEM access, configure the dmem adapter with offsets from above.
411 if { 0 == [string compare [adapter name] dmem ] } {
412 if { [info exists _dmem_base_address] } {
413 # DAPBUS (Debugger) description
414 dmem base_address $_dmem_base_address
415 dmem ap_address_offset $_dmem_ap_address_offset
416 dmem max_aps $_dmem_max_aps
417
418 # The following are the details of APs to be emulated for direct address access.
419 # Debug Config (Debugger) description
420 dmem emu_base_address_range $_dmem_emu_base_address $_dmem_emu_base_address_map_to
421 dmem emu_ap_list $_dmem_emu_ap_list
422 # We are going local bus, so speed is really dummy here.
423 adapter speed 2500
424 } else {
425 puts "ERROR: ${SOC} data is missing to support dmem access!"
426 }
427 } else {
428 # AXI AP access port for SoC address map
429 target create $_CHIPNAME.axi_ap mem_ap -dap $_CHIPNAME.dap -ap-num $_mem_ap_num
430 }

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)