summaryrefslogtreecommitdiff
path: root/src/startup.tcl
diff options
context:
space:
mode:
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-07-16 20:20:15 +0000
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-07-16 20:20:15 +0000
commit3287b8661dcd300c6c662f173528cca423e19ce4 (patch)
treef594babec7ef91964f4fb36d25f191e6a9a23f63 /src/startup.tcl
parentffe9257a1766ece36a75a4b33d9fa6959182e970 (diff)
downloadopenocd+libswd-3287b8661dcd300c6c662f173528cca423e19ce4.tar.gz
openocd+libswd-3287b8661dcd300c6c662f173528cca423e19ce4.tar.bz2
openocd+libswd-3287b8661dcd300c6c662f173528cca423e19ce4.tar.xz
openocd+libswd-3287b8661dcd300c6c662f173528cca423e19ce4.zip
Fixes to \ and / handling for OpenOCD
git-svn-id: svn://svn.berlios.de/openocd/trunk@815 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/startup.tcl')
-rw-r--r--src/startup.tcl25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/startup.tcl b/src/startup.tcl
index 5fe7c8fe..abdf58ff 100644
--- a/src/startup.tcl
+++ b/src/startup.tcl
@@ -134,6 +134,29 @@ proc target_script {target_num eventname scriptname} {
}
-#add_help_text target_script "xxx"
+# Try flipping / and \ to find file if the filename does not
+# match the precise spelling
+proc find {filename} {
+ if {[catch {openocd_find $filename} t]==0} {
+ return $t
+ }
+ if {[catch {openocd_find [string map {\ /} $filename} t]==0} {
+ return $t
+ }
+ if {[catch {openocd_find [string map {/ \\} $filename} t]==0} {
+ return $t
+ }
+ # make sure error message matches original input string
+ return [openocd_find $filename]
+}
+add_help_text find "<file> - print full path to file according to OpenOCD search rules"
+
+# Run script
+proc script {filename} {
+ source [find $filename]
+}
+
+add_help_text script "<filename> - filename of OpenOCD script (tcl) to run"
+
add_help_text target_script "<target#> <event=reset/pre_reset/post_halt/pre_resume/gdb_program_config> <script_file>"