tcl/target/ti_k3: Set _CHIPNAME in one place
[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 _K3_DAP_TAPID 0x0bb5a02f
67
68 # AM654 has 2 clusters of 2 A53 cores each.
69 set _armv8_cpu_name a53
70 set _armv8_cores 4
71
72 # AM654 has 1 cluster of 2 R5s cores.
73 set _r5_cores 2
74 set R5_NAMES {mcu_r5.0 mcu_r5.1}
75
76 # Sysctrl power-ap unlock offsets
77 set _sysctrl_ap_unlock_offsets {0xf0 0x50}
78 }
79 am642 {
80 set _K3_DAP_TAPID 0x0bb3802f
81
82 # AM642 has 1 clusters of 2 A53 cores each.
83 set _armv8_cpu_name a53
84 set _armv8_cores 2
85 set ARMV8_DBGBASE {0x90010000 0x90110000}
86 set ARMV8_CTIBASE {0x90020000 0x90120000}
87
88 # AM642 has 2 cluster of 2 R5s cores.
89 set _r5_cores 4
90 set R5_NAMES {main0_r5.0 main0_r5.1 main1_r5.0 main1_r5.1}
91 set R5_DBGBASE {0x9d410000 0x9d412000 0x9d510000 0x9d512000}
92 set R5_CTIBASE {0x9d418000 0x9d419000 0x9d518000 0x9d519000}
93
94 # M4 processor
95 set _gp_mcu_cores 1
96 }
97 am625 {
98 set _K3_DAP_TAPID 0x0bb7e02f
99
100 # AM625 has 1 clusters of 4 A53 cores.
101 set _armv8_cpu_name a53
102 set _armv8_cores 4
103 set ARMV8_DBGBASE {0x90010000 0x90110000 0x90210000 0x90310000}
104 set ARMV8_CTIBASE {0x90020000 0x90120000 0x90220000 0x90320000}
105
106 # AM625 has 1 cluster of 1 R5s core.
107 set _r5_cores 1
108 set R5_NAMES {main0_r5.0}
109 set R5_DBGBASE {0x9d410000}
110 set R5_CTIBASE {0x9d418000}
111
112 # sysctrl CTI base
113 set CM3_CTIBASE {0x20001000}
114 # Sysctrl power-ap unlock offsets
115 set _sysctrl_ap_unlock_offsets {0xf0 0x78}
116
117 # M4 processor
118 set _gp_mcu_cores 1
119 set _gp_mcu_ap_unlock_offsets {0xf0 0x7c}
120
121 # Setup DMEM access descriptions
122 # DAPBUS (Debugger) description
123 set _dmem_base_address 0x740002000
124 set _dmem_ap_address_offset 0x100
125 set _dmem_max_aps 10
126 # Emulated AP description
127 set _dmem_emu_base_address 0x760000000
128 set _dmem_emu_base_address_map_to 0x1d500000
129 set _dmem_emu_ap_list 1
130 }
131 am62a7 {
132 set _K3_DAP_TAPID 0x0bb8d02f
133
134 # AM62a7 has 1 clusters of 4 A53 cores.
135 set _armv8_cpu_name a53
136 set _armv8_cores 4
137 set ARMV8_DBGBASE {0x90010000 0x90110000 0x90210000 0x90310000}
138 set ARMV8_CTIBASE {0x90020000 0x90120000 0x90220000 0x90320000}
139
140 # AM62a7 has 2 cluster of 1 R5s core.
141 set _r5_cores 2
142 set R5_NAMES {main0_r5.0 mcu0_r5.0}
143 set R5_DBGBASE {0x9d410000 0x9d810000}
144 set R5_CTIBASE {0x9d418000 0x9d818000}
145
146 # sysctrl CTI base
147 set CM3_CTIBASE {0x20001000}
148 # Sysctrl power-ap unlock offsets
149 set _sysctrl_ap_unlock_offsets {0xf0 0x78}
150 }
151 j721e {
152 set _K3_DAP_TAPID 0x0bb6402f
153 # J721E has 1 cluster of 2 A72 cores.
154 set _armv8_cpu_name a72
155 set _armv8_cores 2
156
157 # J721E has 3 clusters of 2 R5 cores each.
158 set _r5_cores 6
159
160 # Setup DMEM access descriptions
161 # DAPBUS (Debugger) description
162 set _dmem_base_address 0x4c40002000
163 set _dmem_ap_address_offset 0x100
164 set _dmem_max_aps 8
165 # Emulated AP description
166 set _dmem_emu_base_address 0x4c60000000
167 set _dmem_emu_base_address_map_to 0x1d600000
168 set _dmem_emu_ap_list 1
169 }
170 j7200 {
171 set _K3_DAP_TAPID 0x0bb6d02f
172
173 # J7200 has 1 cluster of 2 A72 cores.
174 set _armv8_cpu_name a72
175 set _armv8_cores 2
176
177 # J7200 has 2 clusters of 2 R5 cores each.
178 set _r5_cores 4
179 set R5_DBGBASE {0x9d010000 0x9d012000 0x9d110000 0x9d112000}
180 set R5_CTIBASE {0x9d018000 0x9d019000 0x9d118000 0x9d119000}
181
182 # M3 CTI base
183 set CM3_CTIBASE {0x20001000}
184 }
185 j721s2 {
186 set _K3_DAP_TAPID 0x0bb7502f
187
188 # J721s2 has 1 cluster of 2 A72 cores.
189 set _armv8_cpu_name a72
190 set _armv8_cores 2
191
192 # J721s2 has 3 clusters of 2 R5 cores each.
193 set _r5_cores 6
194
195 # sysctrl CTI base
196 set CM3_CTIBASE {0x20001000}
197 # Sysctrl power-ap unlock offsets
198 set _sysctrl_ap_unlock_offsets {0xf0 0x78}
199
200 # M4 processor
201 set _gp_mcu_cores 1
202 set _gp_mcu_ap_unlock_offsets {0xf0 0x7c}
203 }
204 default {
205 echo "'$_soc' is invalid!"
206 }
207 }
208
209 set _CHIPNAME $_soc
210
211 swj_newdap $_CHIPNAME cpu -irlen 4 -expected-id $_K3_DAP_TAPID -ignore-version
212
213 dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu
214
215 set _TARGETNAME $_CHIPNAME.cpu
216
217 set _CTINAME $_CHIPNAME.cti
218
219 # sysctrl is always present
220 cti create $_CTINAME.sysctrl -dap $_CHIPNAME.dap -ap-num 7 -baseaddr [lindex $CM3_CTIBASE 0]
221 target create $_TARGETNAME.sysctrl cortex_m -dap $_CHIPNAME.dap -ap-num 7 -defer-examine
222 $_TARGETNAME.sysctrl configure -event reset-assert { }
223
224 proc sysctrl_up {} {
225 # To access sysctrl, we need to enable the JTAG access for the same.
226 # Ensure Power-AP unlocked
227 $::_CHIPNAME.dap apreg 3 [lindex $::_sysctrl_ap_unlock_offsets 0] 0x00190000
228 $::_CHIPNAME.dap apreg 3 [lindex $::_sysctrl_ap_unlock_offsets 1] 0x00102098
229
230 $::_TARGETNAME.sysctrl arp_examine
231 }
232
233 $_TARGETNAME.sysctrl configure -event gdb-attach {
234 sysctrl_up
235 # gdb-attach default rule
236 halt 1000
237 }
238
239 proc _cpu_no_smp_up {} {
240 set _current_target [target current]
241 set _current_type [$_current_target cget -type]
242
243 $_current_target arp_examine
244 $_current_target $_current_type dbginit
245 }
246
247 proc _armv8_smp_up {} {
248 for { set _core 0 } { $_core < $::_armv8_cores } { incr _core } {
249 $::_TARGETNAME.$::_armv8_cpu_name.$_core arp_examine
250 $::_TARGETNAME.$::_armv8_cpu_name.$_core aarch64 dbginit
251 $::_TARGETNAME.$::_armv8_cpu_name.$_core aarch64 smp on
252 }
253 # Set Default target as core 0
254 targets $::_TARGETNAME.$::_armv8_cpu_name.0
255 }
256
257 set _v8_smp_targets ""
258
259 for { set _core 0 } { $_core < $_armv8_cores } { incr _core } {
260
261 cti create $_CTINAME.$_armv8_cpu_name.$_core -dap $_CHIPNAME.dap -ap-num 1 \
262 -baseaddr [lindex $ARMV8_CTIBASE $_core]
263
264 target create $_TARGETNAME.$_armv8_cpu_name.$_core aarch64 -dap $_CHIPNAME.dap \
265 -dbgbase [lindex $ARMV8_DBGBASE $_core] -cti $_CTINAME.$_armv8_cpu_name.$_core -defer-examine
266
267 set _v8_smp_targets "$_v8_smp_targets $_TARGETNAME.$_armv8_cpu_name.$_core"
268
269 if { $_v8_smp_debug == 0 } {
270 $_TARGETNAME.$_armv8_cpu_name.$_core configure -event gdb-attach {
271 _cpu_no_smp_up
272 # gdb-attach default rule
273 halt 1000
274 }
275 } else {
276 $_TARGETNAME.$_armv8_cpu_name.$_core configure -event gdb-attach {
277 _armv8_smp_up
278 # gdb-attach default rule
279 halt 1000
280 }
281 }
282 }
283
284 # Setup ARMV8 proc commands based on CPU to prevent people confusing SoCs
285 set _armv8_up_cmd "$_armv8_cpu_name"_up
286 # Available if V8_SMP_DEBUG is set to non-zero value
287 set _armv8_smp_cmd "$_armv8_cpu_name"_smp
288
289 if { $_v8_smp_debug == 0 } {
290 proc $_armv8_up_cmd { args } {
291 foreach _core $args {
292 targets $_core
293 _cpu_no_smp_up
294 }
295 }
296 } else {
297 proc $_armv8_smp_cmd { args } {
298 _armv8_smp_up
299 }
300 # Declare SMP
301 target smp $:::_v8_smp_targets
302 }
303
304 for { set _core 0 } { $_core < $_r5_cores } { incr _core } {
305 set _r5_name [lindex $R5_NAMES $_core]
306 cti create $_CTINAME.$_r5_name -dap $_CHIPNAME.dap -ap-num 1 \
307 -baseaddr [lindex $R5_CTIBASE $_core]
308
309 # inactive core examination will fail - wait till startup of additional core
310 target create $_TARGETNAME.$_r5_name cortex_r4 -dap $_CHIPNAME.dap \
311 -dbgbase [lindex $R5_DBGBASE $_core] -ap-num 1 -defer-examine
312
313 $_TARGETNAME.$_r5_name configure -event gdb-attach {
314 _cpu_no_smp_up
315 # gdb-attach default rule
316 halt 1000
317 }
318 }
319
320 proc r5_up { args } {
321 foreach _core $args {
322 targets $_core
323 _cpu_no_smp_up
324 }
325 }
326
327 if { $_gp_mcu_cores != 0 } {
328 cti create $_CTINAME.gp_mcu -dap $_CHIPNAME.dap -ap-num 8 -baseaddr [lindex $CM4_CTIBASE 0]
329 target create $_TARGETNAME.gp_mcu cortex_m -dap $_CHIPNAME.dap -ap-num 8 -defer-examine
330 $_TARGETNAME.gp_mcu configure -event reset-assert { }
331
332 proc gp_mcu_up {} {
333 # To access GP MCU, we need to enable the JTAG access for the same.
334 # Ensure Power-AP unlocked
335 $::_CHIPNAME.dap apreg 3 [lindex $::_gp_mcu_ap_unlock_offsets 0] 0x00190000
336 $::_CHIPNAME.dap apreg 3 [lindex $::_gp_mcu_ap_unlock_offsets 1] 0x00102098
337
338 $::_TARGETNAME.gp_mcu arp_examine
339 }
340
341 $_TARGETNAME.gp_mcu configure -event gdb-attach {
342 gp_mcu_up
343 # gdb-attach default rule
344 halt 1000
345 }
346 }
347
348 # In case of DMEM access, configure the dmem adapter with offsets from above.
349 if { 0 == [string compare [adapter name] dmem ] } {
350 if { [info exists _dmem_base_address] } {
351 # DAPBUS (Debugger) description
352 dmem base_address $_dmem_base_address
353 dmem ap_address_offset $_dmem_ap_address_offset
354 dmem max_aps $_dmem_max_aps
355
356 # The following are the details of APs to be emulated for direct address access.
357 # Debug Config (Debugger) description
358 dmem emu_base_address_range $_dmem_emu_base_address $_dmem_emu_base_address_map_to
359 dmem emu_ap_list $_dmem_emu_ap_list
360 # We are going local bus, so speed is really dummy here.
361 adapter speed 2500
362 } else {
363 puts "ERROR: ${SOC} data is missing to support dmem access!"
364 }
365 }

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)