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

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)