|
From: openocd-gerrit <ope...@us...> - 2026-05-08 17:09:07
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via cd8cf385eab0e7388bd043f37484d8b1adffc2e2 (commit)
via 7d937ed3635d859021bb4c24a98aea1e2b279668 (commit)
from ead2fa8c2e11ff90463e911a8ced04a68ba01d3b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit cd8cf385eab0e7388bd043f37484d8b1adffc2e2
Author: Marc Schink <de...@za...>
Date: Tue Apr 28 08:55:32 2026 +0200
adapter/hla: Delegate USB VID/PID parsing to adapter core
Use the USB VID/PIDs provided by the adapter core instead of parsing
them in the driver code.
Keep the legacy 'hla_vid_pid' command for backwards compatibility, but
mark it as deprecated.
Change-Id: Ie3dc8333f5fb863ff68537b803a0b6e96cf35b09
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9597
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/doc/openocd.texi b/doc/openocd.texi
index 5a46fe258..06bda892a 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -3330,10 +3330,6 @@ Currently Not Supported.
Specifies the adapter layout to use.
@end deffn
-@deffn {Config Command} {hla vid_pid} [vid pid]+
-Pairs of vendor IDs and product IDs of the device.
-@end deffn
-
@deffn {Config Command} {hla stlink_backend} (usb | tcp [port])
@emph{ST-Link only:} Choose between 'exclusive' USB communication (the default backend) or
'shared' mode using ST-Link TCP server (the default port is 7184).
diff --git a/src/jtag/drivers/nulink_usb.c b/src/jtag/drivers/nulink_usb.c
index 66cf25a6d..df140ba58 100644
--- a/src/jtag/drivers/nulink_usb.c
+++ b/src/jtag/drivers/nulink_usb.c
@@ -1030,7 +1030,7 @@ static int nulink_usb_open(struct hl_interface_param *param, void **fd)
if (param->transport != HL_TRANSPORT_SWD)
return TARGET_UNKNOWN;
- if (!param->vid[0] && !param->pid[0]) {
+ if (!adapter_usb_get_vids()[0] && !adapter_usb_get_pids()[0]) {
LOG_ERROR("Missing vid/pid");
return ERROR_FAIL;
}
@@ -1068,8 +1068,9 @@ static int nulink_usb_open(struct hl_interface_param *param, void **fd)
while (cur_dev) {
bool found = false;
- for (unsigned int i = 0; param->vid[i] || param->pid[i]; i++) {
- if (param->vid[i] == cur_dev->vendor_id && param->pid[i] == cur_dev->product_id) {
+ for (unsigned int i = 0; adapter_usb_get_vids()[i] != 0; i++) {
+ if (cur_dev->vendor_id == adapter_usb_get_vids()[i] &&
+ cur_dev->product_id == adapter_usb_get_pids()[i]) {
found = true;
break;
}
diff --git a/src/jtag/drivers/stlink_usb.c b/src/jtag/drivers/stlink_usb.c
index bac9c26cb..c64e149cb 100644
--- a/src/jtag/drivers/stlink_usb.c
+++ b/src/jtag/drivers/stlink_usb.c
@@ -3642,8 +3642,9 @@ static int stlink_tcp_open(void *handle, struct hl_interface_param *param)
stlink_used = h->tcp_backend_priv.recv_buf[44];
/* check the vid:pid */
- for (int i = 0; param->vid[i]; i++) {
- if (param->vid[i] == h->vid && param->pid[i] == h->pid) {
+ for (unsigned int i = 0; adapter_usb_get_vids()[i]; i++) {
+ if (h->vid == adapter_usb_get_vids()[i] &&
+ h->pid == adapter_usb_get_pids()[i]) {
stlink_id_matched = true;
break;
}
diff --git a/src/jtag/drivers/ti_icdi_usb.c b/src/jtag/drivers/ti_icdi_usb.c
index 5bac659c4..cd740b296 100644
--- a/src/jtag/drivers/ti_icdi_usb.c
+++ b/src/jtag/drivers/ti_icdi_usb.c
@@ -665,13 +665,14 @@ static int icdi_usb_open(struct hl_interface_param *param, void **fd)
return ERROR_FAIL;
}
- for (uint8_t i = 0; param->vid[i] && param->pid[i]; ++i)
- LOG_DEBUG("transport: %d vid: 0x%04x pid: 0x%04x serial: %s", param->transport,
- param->vid[i], param->pid[i], adapter_get_required_serial() ? adapter_get_required_serial() : "");
+ for (unsigned int i = 0; adapter_usb_get_vids()[i]; ++i)
+ LOG_DEBUG("transport: %d vid: 0x%04x pid: 0x%04x serial: %s",
+ param->transport, adapter_usb_get_vids()[i], adapter_usb_get_pids()[i],
+ adapter_get_required_serial() ? adapter_get_required_serial() : "");
/* TI (Stellaris) ICDI provides its serial number in the USB descriptor;
no need to provide a callback here. */
- jtag_libusb_open(param->vid, param->pid, NULL, &h->usb_dev, NULL);
+ jtag_libusb_open(adapter_usb_get_vids(), adapter_usb_get_pids(), NULL, &h->usb_dev, NULL);
if (!h->usb_dev) {
LOG_ERROR("open failed");
diff --git a/src/jtag/hla/hla_interface.c b/src/jtag/hla/hla_interface.c
index a9d196cce..9fa1df92c 100644
--- a/src/jtag/hla/hla_interface.c
+++ b/src/jtag/hla/hla_interface.c
@@ -26,8 +26,6 @@
static struct hl_interface hl_if = {
.param = {
.device_desc = NULL,
- .vid = { 0 },
- .pid = { 0 },
.transport = HL_TRANSPORT_UNKNOWN,
.connect_under_reset = false,
.use_stlink_tcp = false,
@@ -248,33 +246,6 @@ COMMAND_HANDLER(hl_interface_handle_layout_command)
return ERROR_FAIL;
}
-COMMAND_HANDLER(hl_interface_handle_vid_pid_command)
-{
- if (CMD_ARGC > HLA_MAX_USB_IDS * 2) {
- LOG_WARNING("ignoring extra IDs in hla_vid_pid "
- "(maximum is %d pairs)", HLA_MAX_USB_IDS);
- CMD_ARGC = HLA_MAX_USB_IDS * 2;
- }
- if (CMD_ARGC < 2 || (CMD_ARGC & 1)) {
- LOG_WARNING("incomplete hla_vid_pid configuration directive");
- return ERROR_COMMAND_SYNTAX_ERROR;
- }
-
- unsigned int i;
- for (i = 0; i < CMD_ARGC; i += 2) {
- COMMAND_PARSE_NUMBER(u16, CMD_ARGV[i], hl_if.param.vid[i / 2]);
- COMMAND_PARSE_NUMBER(u16, CMD_ARGV[i + 1], hl_if.param.pid[i / 2]);
- }
-
- /*
- * Explicitly terminate, in case there are multiple instances of
- * hla_vid_pid.
- */
- hl_if.param.vid[i / 2] = hl_if.param.pid[i / 2] = 0;
-
- return ERROR_OK;
-}
-
COMMAND_HANDLER(hl_interface_handle_stlink_backend_command)
{
/* default values */
@@ -330,13 +301,6 @@ static const struct command_registration hl_interface_subcommand_handlers[] = {
.help = "set the layout of the adapter",
.usage = "layout_name",
},
- {
- .name = "vid_pid",
- .handler = &hl_interface_handle_vid_pid_command,
- .mode = COMMAND_CONFIG,
- .help = "the vendor and product ID of the adapter",
- .usage = "(vid pid)*",
- },
{
.name = "stlink_backend",
.handler = &hl_interface_handle_stlink_backend_command,
diff --git a/src/jtag/hla/hla_interface.h b/src/jtag/hla/hla_interface.h
index c0ee05498..8701c033a 100644
--- a/src/jtag/hla/hla_interface.h
+++ b/src/jtag/hla/hla_interface.h
@@ -21,10 +21,6 @@ enum e_hl_transports;
struct hl_interface_param {
/** */
const char *device_desc;
- /** List of recognised VIDs */
- uint16_t vid[HLA_MAX_USB_IDS + 1];
- /** List of recognised PIDs */
- uint16_t pid[HLA_MAX_USB_IDS + 1];
/** */
enum hl_transports transport;
/** */
diff --git a/src/jtag/startup.tcl b/src/jtag/startup.tcl
index 53482d60a..730f4d262 100644
--- a/src/jtag/startup.tcl
+++ b/src/jtag/startup.tcl
@@ -1186,8 +1186,8 @@ proc "hla_device_desc" {desc} {
lappend _telnet_autocomplete_skip "hla_vid_pid"
proc "hla_vid_pid" {args} {
- echo "DEPRECATED! use 'hla vid_pid', not 'hla_vid_pid'"
- eval hla vid_pid $args
+ echo "DEPRECATED! use 'adapter usb vid_pid', not 'hla_vid_pid'"
+ eval adapter usb vid_pid $args
}
lappend _telnet_autocomplete_skip "hla_command"
diff --git a/tcl/interface/nulink.cfg b/tcl/interface/nulink.cfg
index be68347e7..86b0a421a 100644
--- a/tcl/interface/nulink.cfg
+++ b/tcl/interface/nulink.cfg
@@ -7,7 +7,7 @@
adapter driver hla
hla layout nulink
hla device_desc "Nu-Link"
-hla vid_pid 0x0416 0x511b 0x0416 0x511c 0x0416 0x511d 0x0416 0x5200 0x0416 0x5201
+adapter usb vid_pid 0x0416 0x511b 0x0416 0x511c 0x0416 0x511d 0x0416 0x5200 0x0416 0x5201
# Only swd is supported
transport select swd
diff --git a/tcl/interface/stlink-hla.cfg b/tcl/interface/stlink-hla.cfg
index 5c4adb897..adbfda8e2 100644
--- a/tcl/interface/stlink-hla.cfg
+++ b/tcl/interface/stlink-hla.cfg
@@ -11,7 +11,9 @@ echo "Consider updating your ST-Link firmware to a version >= V2J24 (2015)"
adapter driver hla
hla layout stlink
hla device_desc "ST-LINK"
-hla vid_pid 0x0483 0x3744 0x0483 0x3748 0x0483 0x374b 0x0483 0x374d 0x0483 0x374e 0x0483 0x374f 0x0483 0x3752 0x0483 0x3753 0x0483 0x3754 0x0483 0x3755 0x0483 0x3757
+adapter usb vid_pid 0x0483 0x3744 0x0483 0x3748 0x0483 0x374b 0x0483 0x374d \
+ 0x0483 0x374e 0x0483 0x374f 0x0483 0x3752 0x0483 0x3753 \
+ 0x0483 0x3754 0x0483 0x3755 0x0483 0x3757
# Optionally specify the serial number of ST-LINK/V2 usb device. ST-LINK/V2
# devices seem to have serial numbers with unreadable characters. ST-LINK/V2
diff --git a/tcl/interface/ti-icdi.cfg b/tcl/interface/ti-icdi.cfg
index c13d27e8b..fdd879a7e 100644
--- a/tcl/interface/ti-icdi.cfg
+++ b/tcl/interface/ti-icdi.cfg
@@ -11,7 +11,7 @@
adapter driver hla
hla layout ti-icdi
-hla vid_pid 0x1cbe 0x00fd
+adapter usb vid_pid 0x1cbe 0x00fd
# Optionally specify the serial number of TI-ICDI devices, for when using
# multiple devices. Serial numbers can be obtained using lsusb -v
commit 7d937ed3635d859021bb4c24a98aea1e2b279668
Author: Marc Schink <de...@za...>
Date: Thu Apr 23 21:43:55 2026 +0200
adapter/esp-usb-jtag: Delegate USB VID/PID parsing to adapter core
Use the USB VID/PIDs provided by the adapter core instead of parsing
them in the driver code.
Keep the legacy 'espusbjtag vid_pid' command for backwards compatibility,
but mark it as deprecated.
Change-Id: Ib02795607ab44d4d4da04068a16eb508892c42ad
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9596
Reviewed-by: Antonio Borneo <bor...@gm...>
Tested-by: jenkins
diff --git a/doc/openocd.texi b/doc/openocd.texi
index 18eb6da92..5a46fe258 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -3779,13 +3779,6 @@ espusbjtag setio 0 1 0 1 0
@end example
@end deffn
-@deffn {Config Command} {espusbjtag vid_pid} vid_pid
-Set vendor ID and product ID for the ESP usb jtag driver
-@example
-espusbjtag vid_pid 0x303a 0x1001
-@end example
-@end deffn
-
@deffn {Config Command} {espusbjtag caps_descriptor} caps_descriptor
Set the jtag descriptor to read capabilities of ESP usb jtag driver
@example
diff --git a/src/jtag/drivers/esp_usb_jtag.c b/src/jtag/drivers/esp_usb_jtag.c
index a13303511..20794e9ef 100644
--- a/src/jtag/drivers/esp_usb_jtag.c
+++ b/src/jtag/drivers/esp_usb_jtag.c
@@ -218,8 +218,6 @@ struct esp_usb_jtag {
static struct esp_usb_jtag esp_usb_jtag_priv;
static struct esp_usb_jtag *priv = &esp_usb_jtag_priv;
-static int esp_usb_vid;
-static int esp_usb_pid;
static int esp_usb_jtag_caps;
static int esp_usb_target_chip_id;
@@ -476,9 +474,6 @@ static int esp_usb_jtag_init(void)
{
memset(priv, 0, sizeof(struct esp_usb_jtag));
- const uint16_t vids[] = { esp_usb_vid, 0 }; /* must be null terminated */
- const uint16_t pids[] = { esp_usb_pid, 0 }; /* must be null terminated */
-
bitq_interface = &priv->bitq_interface;
bitq_interface->out = esp_usb_jtag_out;
bitq_interface->flush = esp_usb_jtag_flush;
@@ -487,7 +482,8 @@ static int esp_usb_jtag_init(void)
bitq_interface->in_rdy = esp_usb_jtag_in_rdy;
bitq_interface->in = esp_usb_jtag_in;
- int r = jtag_libusb_open(vids, pids, NULL, &priv->usb_device, NULL);
+ int r = jtag_libusb_open(adapter_usb_get_vids(), adapter_usb_get_pids(),
+ NULL, &priv->usb_device, NULL);
if (r != ERROR_OK) {
LOG_ERROR("esp_usb_jtag: could not find or open device!");
goto out;
@@ -693,18 +689,6 @@ COMMAND_HANDLER(esp_usb_jtag_setio_cmd)
return ERROR_OK;
}
-COMMAND_HANDLER(esp_usb_jtag_vid_pid)
-{
- if (CMD_ARGC != 2)
- return ERROR_COMMAND_SYNTAX_ERROR;
-
- COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], esp_usb_vid);
- COMMAND_PARSE_NUMBER(int, CMD_ARGV[1], esp_usb_pid);
- LOG_INFO("esp_usb_jtag: VID set to 0x%x and PID to 0x%x", esp_usb_vid, esp_usb_pid);
-
- return ERROR_OK;
-}
-
COMMAND_HANDLER(esp_usb_jtag_caps_descriptor)
{
if (CMD_ARGC != 1)
@@ -742,13 +726,6 @@ static const struct command_registration esp_usb_jtag_subcommands[] = {
.help = "Manually set the status of the output lines",
.usage = "tdi tms tck trst srst"
},
- {
- .name = "vid_pid",
- .handler = &esp_usb_jtag_vid_pid,
- .mode = COMMAND_CONFIG,
- .help = "set vendor ID and product ID for ESP usb jtag driver",
- .usage = "vid pid",
- },
{
.name = "caps_descriptor",
.handler = &esp_usb_jtag_caps_descriptor,
diff --git a/src/jtag/startup.tcl b/src/jtag/startup.tcl
index 5b44eb447..53482d60a 100644
--- a/src/jtag/startup.tcl
+++ b/src/jtag/startup.tcl
@@ -241,6 +241,13 @@ proc interface_list args {
eval adapter list $args
}
+lappend _telnet_autocomplete_skip "espusbjtag vid_pid"
+proc "espusbjtag vid_pid" args {
+ echo "DEPRECATED! use 'adapter usb vid_pid' not 'espusbjtag vid_pid'"
+ eval adapter usb vid_pid $args
+}
+
+
lappend _telnet_autocomplete_skip ftdi_location
proc ftdi_location args {
echo "DEPRECATED! use 'adapter usb location' not 'ftdi_location'"
diff --git a/tcl/interface/esp_usb_bridge.cfg b/tcl/interface/esp_usb_bridge.cfg
index 9342239e7..9354855ba 100644
--- a/tcl/interface/esp_usb_bridge.cfg
+++ b/tcl/interface/esp_usb_bridge.cfg
@@ -5,5 +5,5 @@
adapter driver esp_usb_jtag
-espusbjtag vid_pid 0x303a 0x1002
+adapter usb vid_pid 0x303a 0x1002
espusbjtag caps_descriptor 0x030A # string descriptor index:10
diff --git a/tcl/interface/esp_usb_jtag.cfg b/tcl/interface/esp_usb_jtag.cfg
index 583a92d6a..eff1224a8 100644
--- a/tcl/interface/esp_usb_jtag.cfg
+++ b/tcl/interface/esp_usb_jtag.cfg
@@ -5,7 +5,7 @@
adapter driver esp_usb_jtag
-espusbjtag vid_pid 0x303a 0x1001
+adapter usb vid_pid 0x303a 0x1001
espusbjtag caps_descriptor 0x2000
transport select jtag
-----------------------------------------------------------------------
Summary of changes:
doc/openocd.texi | 11 -----------
src/jtag/drivers/esp_usb_jtag.c | 27 ++-------------------------
src/jtag/drivers/nulink_usb.c | 7 ++++---
src/jtag/drivers/stlink_usb.c | 5 +++--
src/jtag/drivers/ti_icdi_usb.c | 9 +++++----
src/jtag/hla/hla_interface.c | 36 ------------------------------------
src/jtag/hla/hla_interface.h | 4 ----
src/jtag/startup.tcl | 11 +++++++++--
tcl/interface/esp_usb_bridge.cfg | 2 +-
tcl/interface/esp_usb_jtag.cfg | 2 +-
tcl/interface/nulink.cfg | 2 +-
tcl/interface/stlink-hla.cfg | 4 +++-
tcl/interface/ti-icdi.cfg | 2 +-
13 files changed, 30 insertions(+), 92 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|