stlink: support of ST-LINK TCP server using stlink-dap and hla

Quote: The ST-LINK TCP server is an application to share the debug
interface of a single ST-LINK board among several host applications,
typically a debugging tool and a monitoring tool.

Note: ST-Link TCP server does not support the SWIM transport.

ST-LINK TCP server allows several applications to connect to the same
ST-Link through sockets (TCP).

To use ST-LINK TCP server:
 - using stlink-dap : use 'st-link backend tcp [port]'
 - using hla : use 'hla_stlink_backend tcp [port]'

the default port value is 7184

Change-Id: I9b79f65267f04b1e978709934892160e65bd2d6d
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5633
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
Tarek BOCHKATI
2021-01-12 23:58:53 +01:00
committed by Antonio Borneo
parent 75d512bb97
commit 4c0c6ebf02
4 changed files with 546 additions and 19 deletions
+33 -1
View File
@@ -35,7 +35,7 @@
#include <target/target.h>
static struct hl_interface_s hl_if = { {0, 0, { 0 }, { 0 }, HL_TRANSPORT_UNKNOWN, false, -1}, 0, 0 };
static struct hl_interface_s hl_if = { {0, 0, { 0 }, { 0 }, HL_TRANSPORT_UNKNOWN, false, -1, false, 7184}, 0, 0 };
int hl_interface_open(enum hl_transports tr)
{
@@ -292,6 +292,31 @@ COMMAND_HANDLER(hl_interface_handle_vid_pid_command)
return ERROR_OK;
}
COMMAND_HANDLER(hl_interface_handle_stlink_backend_command)
{
/* default values */
bool use_stlink_tcp = false;
uint16_t stlink_tcp_port = 7184;
if (CMD_ARGC == 0 || CMD_ARGC > 2)
return ERROR_COMMAND_SYNTAX_ERROR;
else if (strcmp(CMD_ARGV[0], "usb") == 0) {
if (CMD_ARGC > 1)
return ERROR_COMMAND_SYNTAX_ERROR;
/* else use_stlink_tcp = false (already the case ) */
} else if (strcmp(CMD_ARGV[0], "tcp") == 0) {
use_stlink_tcp = true;
if (CMD_ARGC == 2)
COMMAND_PARSE_NUMBER(u16, CMD_ARGV[1], stlink_tcp_port);
} else
return ERROR_COMMAND_SYNTAX_ERROR;
hl_if.param.use_stlink_tcp = use_stlink_tcp;
hl_if.param.stlink_tcp_port = stlink_tcp_port;
return ERROR_OK;
}
COMMAND_HANDLER(interface_handle_hla_command)
{
if (CMD_ARGC != 1)
@@ -336,6 +361,13 @@ static const struct command_registration hl_interface_command_handlers[] = {
.help = "the vendor and product ID of the adapter",
.usage = "(vid pid)* ",
},
{
.name = "hla_stlink_backend",
.handler = &hl_interface_handle_stlink_backend_command,
.mode = COMMAND_CONFIG,
.help = "select which ST-Link backend to use",
.usage = "usb | tcp [port]",
},
{
.name = "hla_command",
.handler = &interface_handle_hla_command,
+4
View File
@@ -46,6 +46,10 @@ struct hl_interface_param_s {
bool connect_under_reset;
/** Initial interface clock clock speed */
int initial_interface_speed;
/** */
bool use_stlink_tcp;
/** */
uint16_t stlink_tcp_port;
};
struct hl_interface_s {