2 # Defines basic Tcl procs that must be there for
5 # Embedded into OpenOCD executable
9 # FIX!!! need to figure out how to feed back relevant output
10 # from e.g. "flash banks" command...
11 proc board_produce {filename serialnumber} {
13 openocd "flash write_image erase $filename [flash] bin"]]
14 openocd "verify_image $filename [flash] bin"]]
15 echo "Successfully ran production procedure"
19 echo "Production test not implemented"
22 # Show flash in human readable form
23 # This is an example of a human readable form of a low level fn
24 proc flash_banks_pretty {} {
27 foreach {a} [flash_banks] {
29 set result "$result\n"
31 set result [format "$result#%d: %s at 0x%08x, size 0x%08x, buswidth %d, chipwidth %d" $i [lindex $a 0] [lindex $a 1] [lindex $a 2] [lindex $a 3] [lindex $a 4]]
37 # We need to explicitly redirect this to the OpenOCD command
38 # as Tcl defines the exit proc
43 # We have currently converted only "flash banks" to tcl.
45 if {[string compare [lindex $args 0] banks]==0} {
46 return [flash_banks_pretty]
48 openocd_throw "flash $args"
51 # If a fn is unknown to Tcl, we try to execute it as an OpenOCD command
53 if {[string length $args]>0} {
55 # We need to add back quotes for arguments w/space
56 # for args without space, we can add quotes anyway
62 # openocd_throw outputs while running and also sets the
63 # primary return value to the output of the command
65 # The primary return value have been set by "openocd" above,
66 # so we need to clear it, lest we print out the output from