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