f2e4ec35342d490e8f8765256d666cb85328d1ed
[openocd.git] / src / jtag / startup.tcl
1 # Defines basic Tcl procs for OpenOCD JTAG module
2
3 # Executed during "init". Can be overridden
4 # by board/target/... scripts
5 proc jtag_init {} {
6 if {[catch {jtag arp_init} err]!=0} {
7 # try resetting additionally
8 init_reset startup
9 }
10 }
11
12 # This reset logic may be overridden by board/target/... scripts as needed
13 # to provide a reset that, if possible, is close to a power-up reset.
14 #
15 # Exit requirements include: (a) JTAG must be working, (b) the scan
16 # chain was validated with "jtag arp_init" (or equivalent), (c) nothing
17 # stays in reset. No TAP-specific scans were performed. It's OK if
18 # some targets haven't been reset yet; they may need TAP-specific scans.
19 #
20 # The "mode" values include: halt, init, run (from "reset" command);
21 # startup (at OpenOCD server startup, when JTAG may not yet work); and
22 # potentially more (for reset types like cold, warm, etc)
23 proc init_reset { mode } {
24 if {[using_jtag]} {
25 jtag arp_init-reset
26 }
27 }
28
29 #########
30
31 # TODO: power_restore and power_dropout are currently neither
32 # documented nor supported.
33
34 proc power_restore {} {
35 echo "Sensed power restore, running reset init and halting GDB."
36 reset init
37
38 # Halt GDB so user can deal with a detected power restore.
39 #
40 # After GDB is halted, then output is no longer forwarded
41 # to the GDB console.
42 set targets [target names]
43 foreach t $targets {
44 # New event script.
45 $t invoke-event arp_halt_gdb
46 }
47 }
48
49 add_help_text power_restore "Overridable procedure run when power restore is detected. Runs 'reset init' by default."
50
51 proc power_dropout {} {
52 echo "Sensed power dropout."
53 }
54
55 #########
56
57 # TODO: srst_deasserted and srst_asserted are currently neither
58 # documented nor supported.
59
60 proc srst_deasserted {} {
61 echo "Sensed nSRST deasserted, running reset init and halting GDB."
62 reset init
63
64 # Halt GDB so user can deal with a detected reset.
65 #
66 # After GDB is halted, then output is no longer forwarded
67 # to the GDB console.
68 set targets [target names]
69 foreach t $targets {
70 # New event script.
71 $t invoke-event arp_halt_gdb
72 }
73 }
74
75 add_help_text srst_deasserted "Overridable procedure run when srst deassert is detected. Runs 'reset init' by default."
76
77 proc srst_asserted {} {
78 echo "Sensed nSRST asserted."
79 }
80
81 # measure actual JTAG clock
82 proc measure_clk {} {
83 set start_time [ms];
84 set iterations 10000000;
85 runtest $iterations;
86 set speed [expr "$iterations.0 / ([ms] - $start_time)"]
87 echo "Running at more than $speed kHz";
88 }
89
90 add_help_text measure_clk "Runs a test to measure the JTAG clk. Useful with RCLK / RTCK."
91
92 proc default_to_jtag { f args } {
93 set current_transport [transport select]
94 if {[using_jtag]} {
95 eval $f $args
96 } {
97 error "session transport is \"$current_transport\" but your config requires JTAG"
98 }
99 }
100
101 proc jtag args {
102 eval default_to_jtag jtag $args
103 }
104
105 proc jtag_rclk args {
106 eval default_to_jtag jtag_rclk $args
107 }
108
109 proc jtag_ntrst_delay args {
110 eval default_to_jtag jtag_ntrst_delay $args
111 }
112
113 proc jtag_ntrst_assert_width args {
114 eval default_to_jtag jtag_ntrst_assert_width $args
115 }
116
117 # BEGIN MIGRATION AIDS ... these adapter operations originally had
118 # JTAG-specific names despite the fact that the operations were not
119 # specific to JTAG, or otherwise had troublesome/misleading names.
120 #
121 # FIXME phase these aids out after some releases
122 #
123 lappend _telnet_autocomplete_skip jtag_reset
124 proc jtag_reset args {
125 echo "DEPRECATED! use 'adapter \[de\]assert' not 'jtag_reset'"
126 switch $args {
127 "0 0"
128 {eval adapter deassert trst deassert srst}
129 "0 1"
130 {eval adapter deassert trst assert srst}
131 "1 0"
132 {eval adapter assert trst deassert srst}
133 "1 1"
134 {eval adapter assert trst assert srst}
135 default
136 {return -code 1 -level 1 "jtag_reset: syntax error"}
137 }
138 }
139
140 lappend _telnet_autocomplete_skip adapter_khz
141 proc adapter_khz args {
142 echo "DEPRECATED! use 'adapter speed' not 'adapter_khz'"
143 eval adapter speed $args
144 }
145
146 lappend _telnet_autocomplete_skip adapter_name
147 proc adapter_name args {
148 echo "DEPRECATED! use 'adapter name' not 'adapter_name'"
149 eval adapter name $args
150 }
151
152 lappend _telnet_autocomplete_skip adapter_nsrst_delay
153 proc adapter_nsrst_delay args {
154 echo "DEPRECATED! use 'adapter srst delay' not 'adapter_nsrst_delay'"
155 eval adapter srst delay $args
156 }
157
158 lappend _telnet_autocomplete_skip adapter_nsrst_assert_width
159 proc adapter_nsrst_assert_width args {
160 echo "DEPRECATED! use 'adapter srst pulse_width' not 'adapter_nsrst_assert_width'"
161 eval adapter srst pulse_width $args
162 }
163
164 lappend _telnet_autocomplete_skip interface
165 proc interface args {
166 echo "DEPRECATED! use 'adapter driver' not 'interface'"
167 eval adapter driver $args
168 }
169
170 lappend _telnet_autocomplete_skip interface_transports
171 proc interface_transports args {
172 echo "DEPRECATED! use 'adapter transports' not 'interface_transports'"
173 eval adapter transports $args
174 }
175
176 lappend _telnet_autocomplete_skip interface_list
177 proc interface_list args {
178 echo "DEPRECATED! use 'adapter list' not 'interface_list'"
179 eval adapter list $args
180 }
181
182 lappend _telnet_autocomplete_skip ftdi_location
183 proc ftdi_location args {
184 echo "DEPRECATED! use 'adapter usb location' not 'ftdi_location'"
185 eval adapter usb location $args
186 }
187
188 lappend _telnet_autocomplete_skip xds110_serial
189 proc xds110_serial args {
190 echo "DEPRECATED! use 'xds110 serial' not 'xds110_serial'"
191 eval xds110 serial $args
192 }
193
194 lappend _telnet_autocomplete_skip xds110_supply_voltage
195 proc xds110_supply_voltage args {
196 echo "DEPRECATED! use 'xds110 supply' not 'xds110_supply_voltage'"
197 eval xds110 supply $args
198 }
199
200 proc hla {cmd args} {
201 tailcall "hla $cmd" {*}$args
202 }
203
204 lappend _telnet_autocomplete_skip "hla newtap"
205 proc "hla newtap" {args} {
206 echo "DEPRECATED! use 'swj_newdap' not 'hla newtap'"
207 eval swj_newdap $args
208 }
209
210 lappend _telnet_autocomplete_skip ftdi_device_desc
211 proc ftdi_device_desc args {
212 echo "DEPRECATED! use 'ftdi device_desc' not 'ftdi_device_desc'"
213 eval ftdi device_desc $args
214 }
215
216 lappend _telnet_autocomplete_skip ftdi_serial
217 proc ftdi_serial args {
218 echo "DEPRECATED! use 'ftdi serial' not 'ftdi_serial'"
219 eval ftdi serial $args
220 }
221
222 lappend _telnet_autocomplete_skip ftdi_channel
223 proc ftdi_channel args {
224 echo "DEPRECATED! use 'ftdi channel' not 'ftdi_channel'"
225 eval ftdi channel $args
226 }
227
228 lappend _telnet_autocomplete_skip ftdi_layout_init
229 proc ftdi_layout_init args {
230 echo "DEPRECATED! use 'ftdi layout_init' not 'ftdi_layout_init'"
231 eval ftdi layout_init $args
232 }
233
234 lappend _telnet_autocomplete_skip ftdi_layout_signal
235 proc ftdi_layout_signal args {
236 echo "DEPRECATED! use 'ftdi layout_signal' not 'ftdi_layout_signal'"
237 eval ftdi layout_signal $args
238 }
239
240 lappend _telnet_autocomplete_skip ftdi_set_signal
241 proc ftdi_set_signal args {
242 echo "DEPRECATED! use 'ftdi set_signal' not 'ftdi_set_signal'"
243 eval ftdi set_signal $args
244 }
245
246 lappend _telnet_autocomplete_skip ftdi_get_signal
247 proc ftdi_get_signal args {
248 echo "DEPRECATED! use 'ftdi get_signal' not 'ftdi_get_signal'"
249 eval ftdi get_signal $args
250 }
251
252 lappend _telnet_autocomplete_skip ftdi_vid_pid
253 proc ftdi_vid_pid args {
254 echo "DEPRECATED! use 'ftdi vid_pid' not 'ftdi_vid_pid'"
255 eval ftdi vid_pid $args
256 }
257
258 lappend _telnet_autocomplete_skip ftdi_tdo_sample_edge
259 proc ftdi_tdo_sample_edge args {
260 echo "DEPRECATED! use 'ftdi tdo_sample_edge' not 'ftdi_tdo_sample_edge'"
261 eval ftdi tdo_sample_edge $args
262 }
263
264 lappend _telnet_autocomplete_skip openjtag_device_desc
265 proc openjtag_device_desc args {
266 echo "DEPRECATED! use 'openjtag device_desc' not 'openjtag_device_desc'"
267 eval openjtag device_desc $args
268 }
269
270 lappend _telnet_autocomplete_skip openjtag_variant
271 proc openjtag_variant args {
272 echo "DEPRECATED! use 'openjtag variant' not 'openjtag_variant'"
273 eval openjtag variant $args
274 }
275
276 lappend _telnet_autocomplete_skip parport_port
277 proc parport_port args {
278 echo "DEPRECATED! use 'parport port' not 'parport_port'"
279 eval parport port $args
280 }
281
282 lappend _telnet_autocomplete_skip parport_cable
283 proc parport_cable args {
284 echo "DEPRECATED! use 'parport cable' not 'parport_cable'"
285 eval parport cable $args
286 }
287
288 lappend _telnet_autocomplete_skip parport_write_on_exit
289 proc parport_write_on_exit args {
290 echo "DEPRECATED! use 'parport write_on_exit' not 'parport_write_on_exit'"
291 eval parport write_on_exit $args
292 }
293
294 lappend _telnet_autocomplete_skip parport_toggling_time
295 proc parport_toggling_time args {
296 echo "DEPRECATED! use 'parport toggling_time' not 'parport_toggling_time'"
297 eval parport toggling_time $args
298 }
299
300 # END MIGRATION AIDS

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)