openocd/src/server
Antonio Borneo cc75aa37c5 openocd: add post-init and pre-shutdown helpers
It is a common requirement to automatically execute some command
after "init".
This can be achieved, either in scripts or through OpenOCD command
line, by explicitly calling "init" followed by the commands.
But this approach fails if the request for post-init commands is
spread across configuration files; only one of the files can split
pre-init and post-init status by calling "init".
The common workaround is to "rename" the command "init" and
replace it with a TCL proc that calls the original "init" and the
post-init commands. E.g. in Zephyr script [1].

To simplify and formalize the post-init execution, use a TCL list
that contains the list of commands to be executed. Every script
can contribute adding new commands, e.g. using "lappend".

In the same way, formalize the pre-shutdown execution with a TCL
list of user commands to be executed before OpenOCD exit.

Document them and add trivial examples.

Drop from documentation the suggestion to rename "shutdown".

Change-Id: I9464fb40ccede3e7760d425873adca363b49a64f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Link: [1] https://github.com/zephyrproject-rtos/zephyr/blob/zephyr-v2.7.1/boards/arm/nucleo_h743zi/support/openocd.cfg#L15
Reviewed-on: https://review.openocd.org/c/openocd/+/6851
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2022-05-14 08:58:36 +00:00
..
Makefile.am server: remove remaining crust from dropped eCos code 2022-02-14 15:13:34 +00:00
gdb_server.c server/gdb: fix gdb remote monitor cmd on multi-target 2022-05-07 11:03:03 +00:00
gdb_server.h server: free strduped port numbers 2018-03-15 17:08:53 +00:00
ipdbg.c server: change prototype of add_service() 2022-03-19 09:05:27 +00:00
ipdbg.h Add IPDBG JtagHost functionality to OpenOCD 2021-05-08 09:51:04 +01:00
rtt_server.c openocd: include config.h in every file .c 2022-03-26 13:32:57 +00:00
rtt_server.h Add initial RTT support 2020-12-02 23:15:52 +00:00
server.c openocd: add post-init and pre-shutdown helpers 2022-05-14 08:58:36 +00:00
server.h keep-alive: drop link with log framework 2022-03-19 09:10:39 +00:00
startup.tcl telnet/auto-complete: hide deprecated and internal commands 2021-05-08 09:48:15 +01:00
tcl_server.c server: change prototype of add_service() 2022-03-19 09:05:27 +00:00
tcl_server.h server: free strduped port numbers 2018-03-15 17:08:53 +00:00
telnet_server.c server: change prototype of add_service() 2022-03-19 09:05:27 +00:00
telnet_server.h server: free strduped port numbers 2018-03-15 17:08:53 +00:00