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

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)