a4629bac462dd808f210c266e46f5439789f9e6b
[openocd.git] / doc / manual / scripting.txt
1 /** @page scripting OpenOCD Scripting Overview
2
3 @section scriptingisnt What scripting will not do
4
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.
9
10 Target scripts can contain new procedures that end users may
11 tinker to their needs without really understanding tcl.
12
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.
16
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.
20
21 @section scriptinguses Uses of scripting
22
23 Default implementation of procedures in tcl/procedures.tcl.
24
25 - Polymorphic commands for target scripts.
26 - there will be added some commands in Tcl that the target
27 scripts can replace.
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 &
35 tms is handled.
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
52 be simpler.
53
54
55 @section scriptingexternal External scripting
56
57 The embedded Jim Tcl interpreter in OpenOCD is very limited
58 compared to any full scale PC hosted scripting language.
59
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
64 scripting connection.
65
66 Another problem with Jim Tcl is that there is no debugger
67 for it.
68
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.
73
74 The rough idea is to write an unknown proc that sends
75 unknown commands to OpenOCD.
76
77 Basically a PC version of startup.tcl. Patches most
78 gratefully accepted! :-)
79
80 */

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)