You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
3.0 KiB

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