1 # Defines basic Tcl procs for OpenOCD target module
3 proc new_target_name
{ } {
4 return [target number
[expr [target count
] - 1 ]]
7 global in_process_reset
10 # Catch reset recursion
11 proc ocd_process_reset
{ MODE
} {
12 global in_process_reset
13 if {$in_process_reset} {
14 set in_process_reset
0
15 return -code error "'reset' can not be invoked recursively"
18 set in_process_reset
1
19 set success [expr [catch {ocd_process_reset_inner
$MODE} result
]==0]
20 set in_process_reset
0
25 return -code error $result
29 proc ocd_process_reset_inner
{ MODE
} {
30 set targets
[target names
]
32 # If this target must be halted...
34 if { 0 == [string compare
$MODE halt
] } {
37 if { 0 == [string compare
$MODE init
] } {
40 if { 0 == [string compare
$MODE run
] } {
44 return -code error "Invalid mode: $MODE, must be one of: halt, init, or run";
47 # Target event handlers *might* change which TAPs are enabled
48 # or disabled, so we fire all of them. But don't issue any
49 # target "arp_*" commands, which may issue JTAG transactions,
50 # unless we know the underlying TAP is active.
52 # NOTE: ARP == "Advanced Reset Process" ... "advanced" is
53 # relative to a previous restrictive scheme
57 $t invoke-event reset-start
60 # Use TRST or TMS/TCK operations to reset all the tap controllers.
61 # TAP reset events get reported; they might enable some taps.
64 # Examine all targets on enabled taps.
66 if {![using_jtag
] ||
[jtag tapisenabled
[$t cget
-chain-position
]]} {
67 $t invoke-event examine-start
68 set err
[catch "$t arp_examine allow-defer"]
70 $t invoke-event examine-fail
72 $t invoke-event examine-end
77 # Assert SRST, and report the pre/post events.
78 # Note: no target sees SRST before "pre" or after "post".
80 $t invoke-event reset-assert-pre
83 # C code needs to know if we expect to 'halt'
84 if {![using_jtag
] ||
[jtag tapisenabled
[$t cget
-chain-position
]]} {
85 $t arp_reset assert
$halt
89 $t invoke-event reset-assert-post
92 # Now de-assert SRST, and report the pre/post events.
93 # Note: no target sees !SRST before "pre" or after "post".
95 $t invoke-event reset-deassert-pre
98 # Again, de-assert code needs to know if we 'halt'
99 if {![using_jtag
] ||
[jtag tapisenabled
[$t cget
-chain-position
]]} {
100 $t arp_reset deassert
$halt
104 $t invoke-event reset-deassert-post
107 # Pass 1 - Now wait for any halt (requested as part of reset
108 # assert/deassert) to happen. Ideally it takes effect without
109 # first executing any instructions.
112 if {[using_jtag
] && ![jtag tapisenabled
[$t cget
-chain-position
]]} {
116 # don't wait for targets where examination is deferred
117 # they can not be halted anyway at this point
118 if { ![$t was_examined
] && [$t examine_deferred
] } {
122 # Wait upto 1 second for target to halt. Why 1sec? Cause
123 # the JTAG tap reset signal might be hooked to a slow
124 # resistor/capacitor circuit - and it might take a while
127 # Catch, but ignore any errors.
128 catch { $t arp_waitstate halted
1000 }
133 if { 0 != [string compare
$s "halted" ] } {
134 return -code error [format "TARGET: %s - Not halted" $t]
139 #Pass 2 - if needed "init"
140 if { 0 == [string compare init
$MODE] } {
142 if {[using_jtag
] && ![jtag tapisenabled
[$t cget
-chain-position
]]} {
146 # don't wait for targets where examination is deferred
147 # they can not be halted anyway at this point
148 if { ![$t was_examined
] && [$t examine_deferred
] } {
152 set err
[catch "$t arp_waitstate halted 5000"]
155 $t invoke-event reset-init
161 $t invoke-event reset-end
166 set _TRANSPORT
[ transport select
]
167 expr { [ string first
"jtag" $_TRANSPORT ] != -1 }
171 set _TRANSPORT
[ transport select
]
172 expr { [ string first
"swd" $_TRANSPORT ] != -1 }
176 set _TRANSPORT
[ transport select
]
177 expr { [ string first
"hla" $_TRANSPORT ] != -1 }
182 # Temporary migration aid. May be removed starting in January 2011.
183 proc armv4_5 params
{
184 echo
"DEPRECATED! use 'arm $params' not 'armv4_5 $params'"
188 # Target/chain configuration scripts can either execute commands directly
189 # or define a procedure which is executed once all configuration
190 # scripts have completed.
192 # By default(classic) the config scripts will set up the target configuration
193 proc init_targets
{} {
196 proc set_default_target_event
{t e s
} {
197 if {[$t cget
-event $e] == ""} {
198 $t configure
-event $e $s
202 proc init_target_events
{} {
203 set targets
[target names
]
206 set_default_target_event
$t gdb-flash-erase-start
"reset init"
207 set_default_target_event
$t gdb-flash-write-end
"reset halt"
208 set_default_target_event
$t gdb-attach
"halt"
212 # Additionally board config scripts can define a procedure init_board that will be executed after init and init_targets
216 # deprecated target name cmds
217 proc cortex_m3 args
{
218 echo
"DEPRECATED! use 'cortex_m' not 'cortex_m3'"
222 proc cortex_a8 args
{
223 echo
"DEPRECATED! use 'cortex_a' not 'cortex_a8'"
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)