telnet/auto-complete: hide deprecated and internal commands
[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 echo "Running at more than [expr $iterations.0 / ([ms]-$start_time)] kHz";
87 }
88
89 add_help_text measure_clk "Runs a test to measure the JTAG clk. Useful with RCLK / RTCK."
90
91 proc default_to_jtag { f args } {
92 set current_transport [transport select]
93 if {[using_jtag]} {
94 eval $f $args
95 } {
96 error "session transport is \"$current_transport\" but your config requires JTAG"
97 }
98 }
99
100 proc jtag args {
101 eval default_to_jtag jtag $args
102 }
103
104 proc jtag_rclk args {
105 eval default_to_jtag jtag_rclk $args
106 }
107
108 proc jtag_ntrst_delay args {
109 eval default_to_jtag jtag_ntrst_delay $args
110 }
111
112 proc jtag_ntrst_assert_width args {
113 eval default_to_jtag jtag_ntrst_assert_width $args
114 }
115
116 # BEGIN MIGRATION AIDS ... these adapter operations originally had
117 # JTAG-specific names despite the fact that the operations were not
118 # specific to JTAG, or otherwise had troublesome/misleading names.
119 #
120 # FIXME phase these aids out after some releases
121 #
122 lappend _telnet_autocomplete_skip jtag_reset
123 proc jtag_reset args {
124 echo "DEPRECATED! use 'adapter \[de\]assert' not 'jtag_reset'"
125 switch $args {
126 "0 0"
127 {eval adapter deassert trst deassert srst}
128 "0 1"
129 {eval adapter deassert trst assert srst}
130 "1 0"
131 {eval adapter assert trst deassert srst}
132 "1 1"
133 {eval adapter assert trst assert srst}
134 default
135 {return -code 1 -level 1 "jtag_reset: syntax error"}
136 }
137 }
138
139 lappend _telnet_autocomplete_skip adapter_khz
140 proc adapter_khz args {
141 echo "DEPRECATED! use 'adapter speed' not 'adapter_khz'"
142 eval adapter speed $args
143 }
144
145 lappend _telnet_autocomplete_skip adapter_name
146 proc adapter_name args {
147 echo "DEPRECATED! use 'adapter name' not 'adapter_name'"
148 eval adapter name $args
149 }
150
151 lappend _telnet_autocomplete_skip adapter_nsrst_delay
152 proc adapter_nsrst_delay args {
153 echo "DEPRECATED! use 'adapter srst delay' not 'adapter_nsrst_delay'"
154 eval adapter srst delay $args
155 }
156
157 lappend _telnet_autocomplete_skip adapter_nsrst_assert_width
158 proc adapter_nsrst_assert_width args {
159 echo "DEPRECATED! use 'adapter srst pulse_width' not 'adapter_nsrst_assert_width'"
160 eval adapter srst pulse_width $args
161 }
162
163 lappend _telnet_autocomplete_skip interface
164 proc interface args {
165 echo "DEPRECATED! use 'adapter driver' not 'interface'"
166 eval adapter driver $args
167 }
168
169 lappend _telnet_autocomplete_skip interface_transports
170 proc interface_transports args {
171 echo "DEPRECATED! use 'adapter transports' not 'interface_transports'"
172 eval adapter transports $args
173 }
174
175 lappend _telnet_autocomplete_skip interface_list
176 proc interface_list args {
177 echo "DEPRECATED! use 'adapter list' not 'interface_list'"
178 eval adapter list $args
179 }
180
181 lappend _telnet_autocomplete_skip ftdi_location
182 proc ftdi_location args {
183 echo "DEPRECATED! use 'adapter usb location' not 'ftdi_location'"
184 eval adapter usb location $args
185 }
186
187 lappend _telnet_autocomplete_skip xds110_serial
188 proc xds110_serial args {
189 echo "DEPRECATED! use 'xds110 serial' not 'xds110_serial'"
190 eval xds110 serial $args
191 }
192
193 lappend _telnet_autocomplete_skip xds110_supply_voltage
194 proc xds110_supply_voltage args {
195 echo "DEPRECATED! use 'xds110 supply' not 'xds110_supply_voltage'"
196 eval xds110 supply $args
197 }
198
199 proc hla {cmd args} {
200 tailcall "hla $cmd" {*}$args
201 }
202
203 lappend _telnet_autocomplete_skip "hla newtap"
204 proc "hla newtap" {args} {
205 echo "DEPRECATED! use 'swj_newdap' not 'hla newtap'"
206 eval swj_newdap $args
207 }
208
209 # 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)