2 puts "Usage: test_tcl.tcl <ipaddress>"
8 # Simple tcl client to connect to openocd
10 set fo [socket $argv 6666]
12 # If a fn is unknown to Tcl, send it off to OpenOCD
23 #Print help text for a command. Word wrap
24 #help text that is too wide inside column.
28 foreach a [lsort $ocd_helptext] {
29 if {[string length $cmd]==0||[string first $cmd $a]!=-1||[string first $cmd [lindex $a 1]]!=-1} {
31 set cmdname [lindex $a 0]
35 if {$n > [string length $h]} {break}
37 set next_a [expr $n+$w]
38 if {[string length $h]>$n+$w} {
39 set xxxx [string range $h $n [expr $n+$w]]
40 for {set lastpos [expr [string length $xxxx]-1]} {$lastpos>=0&&[string compare [string range $xxxx $lastpos $lastpos] " "]!=0} {set lastpos [expr $lastpos-1]} {
44 set next_a [expr $lastpos+$n+1]
49 puts [format "%-25s %s" $cmdname [string range $h $n [expr $next_a-1]] ]
57 puts "Running flash_banks"
59 puts "Running help on PC using data from OpenOCD"
61 set ocd_helptext [get_help_text]