1 /** @page scripting Scripting Overview
3 @section scriptingisnt What scripting will not do
5 The scripting support is intended for developers of OpenOCD.
6 It is not the intention that normal OpenOCD users will
7 use tcl scripting extensively, write lots of clever scripts,
8 or contribute back to OpenOCD.
10 Target scripts can contain new procedures that end users may
11 tinker to their needs without really understanding tcl.
13 Since end users are not expected to mess with the scripting
14 language, the choice of language is not terribly important
15 to those same end users.
17 Jim Tcl was chosen as it was easy to integrate, works
18 great in an embedded environment and Øyvind Harboe
19 had experience with it.
21 @section scriptinguses Uses of scripting
23 Default implementation of procedures in tcl/procedures.tcl.
25 - Polymorphic commands for target scripts.
26 - there will be added some commands in Tcl that the target
28 - produce \<productionfile\> \<serialnumber\>. Default implementation
29 is to ignore serial number and write a raw binary file
30 to beginning of first flash. Target script can dictate
31 file format and structure of serialnumber. Tcl allows
32 an argument to consist of e.g. a list so the structure of
33 the serial number is not limited to a single string.
34 - reset handling. Precise control of how srst, trst &
36 - replace some parts of the current command line handler.
37 This is only to simplify the implementation of OpenOCD
38 and will have no externally visible consequences.
39 Tcl has an advantage in that it's syntax is backwards
40 compatible with the current OpenOCD syntax.
41 - external scripting. Low level tcl functions will be defined
42 that return machine readable output. These low level tcl
43 functions constitute the tcl api. flash_banks is such
44 a low level tcl proc. "flash banks" is an example of
45 a command that has human readable output. The human
46 readable output is expected to change inbetween versions
47 of OpenOCD. The output from flash_banks may not be
48 in the preferred form for the client. The client then
49 has two choices a) parse the output from flash_banks
50 or b) write a small piece of tcl to output the
51 flash_banks output to a more suitable form. The latter may
55 @section scriptingexternal External scripting
57 The embedded Jim Tcl interpreter in OpenOCD is very limited
58 compared to any full scale PC hosted scripting language.
60 The goal is to keep the internal Jim Tcl interpreter as
61 small as possible and allow any advanced scripting,
62 especially scripting that interacts with the host,
63 run on the host and talk to OpenOCD via the TCP/IP
66 Another problem with Jim Tcl is that there is no debugger
69 With a bit of trickery it should be possible to run Jim
70 Tcl scripts under a Tcl interpreter on a PC. The advantage
71 would be that the Jim Tcl scripts could be debugged using
72 a standard PC Tcl debugger.
74 The rough idea is to write an unknown proc that sends
75 unknown commands to OpenOCD.
77 Basically a PC version of startup.tcl. Patches most
78 gratefully accepted! :-)