semihosting: User defined operation, Tcl command exec on host

Enabling a portion (0x100 - 0x107) of the user defined semihosting
operation number range (0x100 - 0x1FF) to be processed with the help of
the existing target event mechanism, to implement a general-purpose Tcl
interface for the target available on the host, via semihosting
interface.

Example usage:
- The user configures a Tcl command as a callback for one of the newly
	defined events (semihosting-user-cmd-0x10X) in the configuration
	file.
- The target can make a semihosting call with <opnum>, passing optional
	parameters for the call.

If there is no callback registered to the user defined operation number,
nothing happens.

Example usage: Configure RTT automatically with the exact, linked
control block location from target.

Signed-off-by: Zoltán Dudás <zedudi@gmail.com>
Change-Id: I10e1784b1fecd4e630d78df81cb44bf1aa2fc247
Reviewed-on: https://review.openocd.org/c/openocd/+/6748
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
Zoltán Dudás
2021-11-24 17:13:50 +01:00
committed by Antonio Borneo
parent dbbac5f11d
commit 5ab74bde06
7 changed files with 162 additions and 4 deletions

View File

@@ -5185,6 +5185,22 @@ when reset disables PLLs needed to use a fast clock.
@* After single-step has completed
@item @b{trace-config}
@* After target hardware trace configuration was changed
@item @b{semihosting-user-cmd-0x100}
@* The target made a semihosting call with user-defined operation number 0x100
@item @b{semihosting-user-cmd-0x101}
@* The target made a semihosting call with user-defined operation number 0x101
@item @b{semihosting-user-cmd-0x102}
@* The target made a semihosting call with user-defined operation number 0x102
@item @b{semihosting-user-cmd-0x103}
@* The target made a semihosting call with user-defined operation number 0x103
@item @b{semihosting-user-cmd-0x104}
@* The target made a semihosting call with user-defined operation number 0x104
@item @b{semihosting-user-cmd-0x105}
@* The target made a semihosting call with user-defined operation number 0x105
@item @b{semihosting-user-cmd-0x106}
@* The target made a semihosting call with user-defined operation number 0x106
@item @b{semihosting-user-cmd-0x107}
@* The target made a semihosting call with user-defined operation number 0x107
@end itemize
@quotation Note
@@ -9241,6 +9257,17 @@ To make the SEMIHOSTING_SYS_EXIT call return normally, enable
this option (default: disabled).
@end deffn
@deffn {Command} {arm semihosting_read_user_param}
@cindex ARM semihosting
Read parameter of the semihosting call from the target. Usable in
semihosting-user-cmd-0x10* event handlers, returning a string.
When the target makes semihosting call with operation number from range 0x100-
0x107, an optional string parameter can be passed to the server. This parameter
is valid during the run of the event handlers and is accessible with this
command.
@end deffn
@section ARMv4 and ARMv5 Architecture
@cindex ARMv4
@cindex ARMv5