1 # Defines basic Tcl procs that must exist for OpenOCD scripts to work.
3 # Embedded into OpenOCD executable
7 # We need to explicitly redirect this to the OpenOCD command
8 # as Tcl defines the exit proc
13 # Try flipping / and \ to find file if the filename does not
14 # match the precise spelling
15 proc find {filename} {
16 if {[catch {ocd_find $filename} t]==0} {
19 if {[catch {ocd_find [string map {\ /} $filename} t]==0} {
22 if {[catch {ocd_find [string map {/ \\} $filename} t]==0} {
25 # make sure error message matches original input string
26 return -code error "Can't find $filename"
28 add_usage_text find "<file>"
29 add_help_text find "print full path to file according to OpenOCD search rules"
32 proc script {filename} {
33 source [find $filename]
35 add_help_text script "filename of OpenOCD script (tcl) to run"
36 add_usage_text script "<file>"
40 # catch any exceptions, capture output and return output
41 proc capture_catch {a} {