From ef1cfb23947bd32798077c6abb5c25a049460ae9 Mon Sep 17 00:00:00 2001 From: oharboe Date: Mon, 1 Sep 2008 07:20:21 +0000 Subject: Duane Ellis: "target as an [tcl] object" feature. git-svn-id: svn://svn.berlios.de/openocd/trunk@975 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- src/helper/startup.tcl | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) (limited to 'src/helper/startup.tcl') 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 " " +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" -- cgit v1.2.3