summaryrefslogtreecommitdiff
path: root/src/helper/startup.tcl
diff options
context:
space:
mode:
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-09-01 07:20:21 +0000
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-09-01 07:20:21 +0000
commitef1cfb23947bd32798077c6abb5c25a049460ae9 (patch)
tree678815a1db1e3d0ab37eb6ad8919b288cfb9a420 /src/helper/startup.tcl
parent3c8ef2c41baea675526af28f01008fcb550f8748 (diff)
downloadopenocd+libswd-ef1cfb23947bd32798077c6abb5c25a049460ae9.tar.gz
openocd+libswd-ef1cfb23947bd32798077c6abb5c25a049460ae9.tar.bz2
openocd+libswd-ef1cfb23947bd32798077c6abb5c25a049460ae9.tar.xz
openocd+libswd-ef1cfb23947bd32798077c6abb5c25a049460ae9.zip
Duane Ellis: "target as an [tcl] object" feature.
git-svn-id: svn://svn.berlios.de/openocd/trunk@975 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/helper/startup.tcl')
-rw-r--r--src/helper/startup.tcl38
1 files changed, 30 insertions, 8 deletions
diff --git a/src/helper/startup.tcl b/src/helper/startup.tcl
index 1b5c06e2..63956a9e 100644
--- a/src/helper/startup.tcl
+++ b/src/helper/startup.tcl
@@ -109,18 +109,40 @@ proc unknown {args} {
return -code error "Unknown command: $args"
}
+proc new_target_name { } {
+ return [target number [expr [target count] - 1 ]]
+}
+
proc target_script {target_num eventname scriptname} {
- if {[string compare $eventname reset]==0} {
- set eventname post_reset
- }
- # This is the script we invoke
- proc "target_[set target_num]_[set eventname]" {} "script $scriptname"
-
+ set tname [target number $target_num]
+
+ if { 0 == [string compare $eventname "reset"] } {
+ $tname configure -event old-post_reset "script $scriptname"
+ return
+ }
+
+ if { 0 == [string compare $eventname "post_reset"] } {
+ $tname configure -event old-post_reset "script $scriptname"
+ return
+ }
+
+ if { 0 == [string compare $eventname "pre_reset"] } {
+ $tname configure -event old-pre_reset "script $scriptname"
+ return
+ }
+
+ if { 0 == [string compare $eventname "gdb_program_config"] } {
+ $tname configure -event old-gdb_program_config "script $scriptname"
+ return
+ }
+
+ return -code error "Unknown target (old) event: $eventname (try $tname configure -event NAME)"
+
}
-add_help_text target_script "<target#> <event=reset/pre_reset/post_halt/pre_resume/gdb_program_config> <script_file>"
+add_help_text target_script "DEPRECATED please see the new TARGETNAME configure -event interface"
# Try flipping / and \ to find file if the filename does not
@@ -170,4 +192,4 @@ proc jtag_rclk {fallback_speed_khz} {
}
}
-add_help_text jtag_rclk "fallback_speed_khz - set JTAG speed to RCLK or use fallback speed" \ No newline at end of file
+add_help_text jtag_rclk "fallback_speed_khz - set JTAG speed to RCLK or use fallback speed"