You can subscribe to this list here.
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(75) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2009 |
Jan
(70) |
Feb
(20) |
Mar
(52) |
Apr
(149) |
May
(387) |
Jun
(466) |
Jul
(133) |
Aug
(87) |
Sep
(122) |
Oct
(140) |
Nov
(185) |
Dec
(105) |
| 2010 |
Jan
(85) |
Feb
(45) |
Mar
(75) |
Apr
(17) |
May
(41) |
Jun
(52) |
Jul
(33) |
Aug
(29) |
Sep
(36) |
Oct
(15) |
Nov
(26) |
Dec
(34) |
| 2011 |
Jan
(26) |
Feb
(25) |
Mar
(26) |
Apr
(29) |
May
(20) |
Jun
(27) |
Jul
(15) |
Aug
(32) |
Sep
(13) |
Oct
(64) |
Nov
(60) |
Dec
(10) |
| 2012 |
Jan
(64) |
Feb
(63) |
Mar
(39) |
Apr
(43) |
May
(54) |
Jun
(11) |
Jul
(30) |
Aug
(45) |
Sep
(11) |
Oct
(70) |
Nov
(24) |
Dec
(23) |
| 2013 |
Jan
(17) |
Feb
(8) |
Mar
(35) |
Apr
(40) |
May
(20) |
Jun
(24) |
Jul
(36) |
Aug
(25) |
Sep
(42) |
Oct
(40) |
Nov
(9) |
Dec
(21) |
| 2014 |
Jan
(29) |
Feb
(24) |
Mar
(60) |
Apr
(22) |
May
(22) |
Jun
(46) |
Jul
(11) |
Aug
(23) |
Sep
(26) |
Oct
(10) |
Nov
(14) |
Dec
(2) |
| 2015 |
Jan
(28) |
Feb
(47) |
Mar
(33) |
Apr
(58) |
May
(5) |
Jun
(1) |
Jul
|
Aug
(8) |
Sep
(12) |
Oct
(25) |
Nov
(58) |
Dec
(21) |
| 2016 |
Jan
(12) |
Feb
(40) |
Mar
(2) |
Apr
(1) |
May
(67) |
Jun
(2) |
Jul
(5) |
Aug
(36) |
Sep
|
Oct
(24) |
Nov
(17) |
Dec
(50) |
| 2017 |
Jan
(14) |
Feb
(16) |
Mar
(2) |
Apr
(35) |
May
(14) |
Jun
(16) |
Jul
(3) |
Aug
(3) |
Sep
|
Oct
(19) |
Nov
|
Dec
(16) |
| 2018 |
Jan
(55) |
Feb
(11) |
Mar
(34) |
Apr
(14) |
May
(4) |
Jun
(20) |
Jul
(39) |
Aug
(16) |
Sep
(17) |
Oct
(16) |
Nov
(20) |
Dec
(30) |
| 2019 |
Jan
(29) |
Feb
(24) |
Mar
(37) |
Apr
(26) |
May
(19) |
Jun
(21) |
Jul
(2) |
Aug
(3) |
Sep
(9) |
Oct
(12) |
Nov
(12) |
Dec
(12) |
| 2020 |
Jan
(47) |
Feb
(36) |
Mar
(54) |
Apr
(44) |
May
(37) |
Jun
(19) |
Jul
(32) |
Aug
(13) |
Sep
(16) |
Oct
(24) |
Nov
(32) |
Dec
(11) |
| 2021 |
Jan
(14) |
Feb
(5) |
Mar
(40) |
Apr
(32) |
May
(42) |
Jun
(31) |
Jul
(29) |
Aug
(47) |
Sep
(38) |
Oct
(17) |
Nov
(74) |
Dec
(33) |
| 2022 |
Jan
(11) |
Feb
(15) |
Mar
(40) |
Apr
(21) |
May
(39) |
Jun
(44) |
Jul
(19) |
Aug
(46) |
Sep
(79) |
Oct
(35) |
Nov
(21) |
Dec
(15) |
| 2023 |
Jan
(56) |
Feb
(13) |
Mar
(43) |
Apr
(28) |
May
(60) |
Jun
(15) |
Jul
(29) |
Aug
(28) |
Sep
(32) |
Oct
(21) |
Nov
(42) |
Dec
(39) |
| 2024 |
Jan
(35) |
Feb
(17) |
Mar
(28) |
Apr
(7) |
May
(14) |
Jun
(35) |
Jul
(30) |
Aug
(35) |
Sep
(30) |
Oct
(28) |
Nov
(38) |
Dec
(18) |
| 2025 |
Jan
(21) |
Feb
(28) |
Mar
(36) |
Apr
(35) |
May
(34) |
Jun
(58) |
Jul
(9) |
Aug
(54) |
Sep
(47) |
Oct
(15) |
Nov
(68) |
Dec
(18) |
| 2026 |
Jan
(30) |
Feb
(31) |
Mar
(9) |
Apr
(44) |
May
(51) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: openocd-gerrit <ope...@us...> - 2026-05-30 18:17:54
|
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 e6752ecbcf72efe4e213e8418e381ff2e0ffdf54 (commit)
from fe239d9ffe8745effcd58e825e7169dd902c5c22 (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 e6752ecbcf72efe4e213e8418e381ff2e0ffdf54
Author: Antonio Borneo <bor...@gm...>
Date: Wed May 20 09:57:24 2026 +0200
jep106: update to revision JEP106BO May 2026
Update to latest available document.
Change-Id: I55b39b3a70a4bdfc11afaf9133493090c31999ff
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9666
Tested-by: jenkins
diff --git a/src/helper/jep106.inc b/src/helper/jep106.inc
index f3407aa96..a066f0a2e 100644
--- a/src/helper/jep106.inc
+++ b/src/helper/jep106.inc
@@ -8,7 +8,7 @@
* identification code list, please visit the JEDEC website at www.jedec.org .
*/
-/* This file is aligned to revision JEP106BN January 2026. */
+/* This file is aligned to revision JEP106BO May 2026. */
[0][0x01 - 1] = "AMD",
[0][0x02 - 1] = "AMI",
@@ -1915,7 +1915,7 @@
[15][0x0d - 1] = "AUTOTALKS",
[15][0x0e - 1] = "Shenzhen Ranshuo Technology Co Limited",
[15][0x0f - 1] = "ScaleFlux",
-[15][0x10 - 1] = "XC Memory",
+[15][0x10 - 1] = "XCMemory Co Ltd",
[15][0x11 - 1] = "Guangzhou Beimu Technology Co Ltd",
[15][0x12 - 1] = "Rays Semiconductor Nanjing Co Ltd",
[15][0x13 - 1] = "Milli-Centi Intelligence Technology Jiangsu",
@@ -2094,7 +2094,7 @@
[16][0x42 - 1] = "Shenzhen Heyloo Electronic Technology Co",
[16][0x43 - 1] = "Shenzhen Shanghaowang Electronic Technology",
[16][0x44 - 1] = "Shanghai Qimingxin Semiconductor Technology",
-[16][0x45 - 1] = "Henan Great Wall Computer System Co Ltd",
+[16][0x45 - 1] = "Great Wall Global Information Technology",
[16][0x46 - 1] = "Beijing Memsilicon Technology Co Ltd",
[16][0x47 - 1] = "Openchip & Software Technologies S L",
[16][0x48 - 1] = "FlashLeap Tech (Shenzhen) Co Ltd",
@@ -2148,4 +2148,68 @@
[16][0x78 - 1] = "Shenzhen Xingjiachen Electronics Co Ltd",
[16][0x79 - 1] = "Shenzhen Xingjiachen Electronics Co Ltd",
[16][0x7a - 1] = "Shenyang Lianxin Chuangxiang Technology",
+[16][0x7b - 1] = "Plusetech Technology (Shenzhen) Co Ltd",
+[16][0x7c - 1] = "ChongQing YuJia Smart Storage Digital",
+[16][0x7d - 1] = "CTST Co Ltd",
+[16][0x7e - 1] = "SSK Corporation",
+[17][0x01 - 1] = "Shenzhen Xinruiyun Storage Technology",
+[17][0x02 - 1] = "JSC Megapolis-Telecom Region",
+[17][0x03 - 1] = "Minpo Corporation",
+[17][0x04 - 1] = "Shenzhen Yingzhong Technology Co Ltd",
+[17][0x05 - 1] = "Moment Semiconductor Inc",
+[17][0x06 - 1] = "Yiweihong (Shenzhen) Electronic Technology Co",
+[17][0x07 - 1] = "Shenzhen Dawei Microelectronics Technology Co",
+[17][0x08 - 1] = "Shenzhen Zhuoran Electronics Co Ltd",
+[17][0x09 - 1] = "Mengxw Electron Ltd",
+[17][0x0a - 1] = "Origin Storage Ltd",
+[17][0x0b - 1] = "Shanghai RuiPan Electronic Information Tech",
+[17][0x0c - 1] = "Fortell Research Inc",
+[17][0x0d - 1] = "Jiyi Semiconductor Co Ltd",
+[17][0x0e - 1] = "Shenzhen Silicon Hermit Technology Ltd",
+[17][0x0f - 1] = "HuiRong Electronic System Engineering Co LTD",
+[17][0x10 - 1] = "ALBSEMI (Hangzhou) Co Ltd",
+[17][0x11 - 1] = "ULX",
+[17][0x12 - 1] = "Sichuan Huazhixincun Technology Co Ltd",
+[17][0x13 - 1] = "Shenzhen Yunyue Semiconductor Co Ltd.",
+[17][0x14 - 1] = "Fortune Sky Enterprise Limited",
+[17][0x15 - 1] = "Shenzhen Tianchuang Weiye Technology",
+[17][0x16 - 1] = "Shanghai Simchip Technology Group",
+[17][0x17 - 1] = "SVOD Project SRO",
+[17][0x18 - 1] = "Shenzhen Xunnaying Technology Co Ltd",
+[17][0x19 - 1] = "Zhejiang Xinhan Intelligent Manufacturing",
+[17][0x1a - 1] = "Shenzhen Tranvita Technology Co Ltd",
+[17][0x1b - 1] = "Zhongke Zhichun (Zhuhai) Technology Co",
+[17][0x1c - 1] = "Shenzhen Yunmemory AI Technology Co",
+[17][0x1d - 1] = "Shenzhen KEHB Electronics Co Ltd",
+[17][0x1e - 1] = "Shenzhen EVOC Storage Technology Co",
+[17][0x1f - 1] = "Beijing ZhanChuang ZhenHua Technology Co",
+[17][0x20 - 1] = "Sichuan Huakun Zhenyu Intelligent Technology",
+[17][0x21 - 1] = "Hunan Hongen Electronics Co Ltd",
+[17][0x22 - 1] = "Shenzhen Youjing Microelectronics Technology",
+[17][0x23 - 1] = "Shenzhen Coosure Electronics Co Ltd",
+[17][0x24 - 1] = "Seavo Future Technology (Shenzhen) Co Ltd",
+[17][0x25 - 1] = "ShenZhen Goodtimes Technology Co Ltd",
+[17][0x26 - 1] = "Shanxi Bluestone Guangzhi Technology Co Ltd",
+[17][0x27 - 1] = "Shenzhen Lianrunfeng Electronic Technology Co",
+[17][0x28 - 1] = "Shenzhen Seapiy Technology Co Ltd",
+[17][0x29 - 1] = "Aivres Systems Inc",
+[17][0x2a - 1] = "Liveseek",
+[17][0x2b - 1] = "Shenzhen KingSpec Electronics Technology",
+[17][0x2c - 1] = "Shenzhen Qiben Electronics Co Ltd",
+[17][0x2d - 1] = "Guangdong Shunwei Microelectronics Tech",
+[17][0x2e - 1] = "Efficient Computer",
+[17][0x2f - 1] = "Shenzhen Powerleader Storage Technology",
+[17][0x30 - 1] = "Shenzhen Chuangzhan Semiconductor Co Ltd",
+[17][0x31 - 1] = "Shenzhen Xbnow Technology Co Ltd",
+[17][0x32 - 1] = "YCHIPWAY Semiconductor Technology",
+[17][0x33 - 1] = "Shenzhen Yansen Industrial Storage Co Ltd",
+[17][0x34 - 1] = "ARIA Sensing Srl",
+[17][0x35 - 1] = "EverModule Technology Co Ltd",
+[17][0x36 - 1] = "The AIO",
+[17][0x37 - 1] = "North Magna Limited",
+[17][0x38 - 1] = "Unisemi Power Inc",
+[17][0x39 - 1] = "Shenzhen RongPei Technology Co Ltd",
+[17][0x3a - 1] = "HKIC International Electronics Limited",
+[17][0x3b - 1] = "Shenzhen DTX Space Technology Co Ltd",
+[17][0x3c - 1] = "Ranxin Technology",
/* EOF */
-----------------------------------------------------------------------
Summary of changes:
src/helper/jep106.inc | 70 ++++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 67 insertions(+), 3 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-05-30 18:17:44
|
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 fe239d9ffe8745effcd58e825e7169dd902c5c22 (commit)
from 9013ad2e5ebbb2e64f3af1c75cc33164f93c4a08 (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 fe239d9ffe8745effcd58e825e7169dd902c5c22
Author: Antonio Borneo <bor...@gm...>
Date: Mon May 18 10:56:07 2026 +0200
target: profile: avoid division by zero
Issue detected by scan-build.
The function target_profiling() can return with num_of_samples==0
and this will trigger a division by zero.
Check the value of num_of_samples before continuing.
While there, simplify the return path and the return value.
Fixes: dcf628298534 ("target: filter and sort pc samples before storing")
Change-Id: I74faa7de5c7fac6f8c862e338d2de5492a0dd14a
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9659
Tested-by: jenkins
Reviewed-by: Richard Allen <rs...@gm...>
diff --git a/src/target/target.c b/src/target/target.c
index 4d8741238..d68e9afb1 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -4331,6 +4331,12 @@ COMMAND_HANDLER(handle_profile_command)
return retval;
}
+ if (!num_of_samples) {
+ command_print(CMD, "Wrote no samples");
+ free(samples);
+ return ERROR_OK;
+ }
+
if (with_range) {
uint32_t num_filtered_samples = 0;
for (uint32_t in = 0; in < num_of_samples; ++in) {
@@ -4342,19 +4348,21 @@ COMMAND_HANDLER(handle_profile_command)
if (duration_ms < 1)
duration_ms = 0;
num_of_samples = num_filtered_samples;
+
+ if (!num_of_samples) {
+ command_print(CMD, "Wrote no samples in the requested range");
+ free(samples);
+ return ERROR_OK;
+ }
}
- if (num_of_samples) {
- qsort(samples, num_of_samples, sizeof(samples[0]), compare_pc32);
+ qsort(samples, num_of_samples, sizeof(samples[0]), compare_pc32);
- write_gmon(samples, num_of_samples, CMD_ARGV[1], target, duration_ms);
- command_print(CMD, "Wrote %s", CMD_ARGV[1]);
- } else {
- command_print(CMD, "Wrote no samples");
- }
+ write_gmon(samples, num_of_samples, CMD_ARGV[1], target, duration_ms);
+ command_print(CMD, "Wrote %s", CMD_ARGV[1]);
free(samples);
- return retval;
+ return ERROR_OK;
}
COMMAND_HANDLER(handle_target_read_memory)
-----------------------------------------------------------------------
Summary of changes:
src/target/target.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-05-30 18:16:44
|
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 9013ad2e5ebbb2e64f3af1c75cc33164f93c4a08 (commit)
from 5bc49ef84c4beb0e83989a7ced551987b743c2b5 (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 9013ad2e5ebbb2e64f3af1c75cc33164f93c4a08
Author: Marc Schink <de...@za...>
Date: Wed May 13 02:29:16 2026 +0200
adapter/jtag-dpi: Use getaddrinfo() to support hostnames and IPv6
Connection establishment currently supports only IPv4 addresses via
inet_addr(). Replace inet_addr() with getaddrinfo() to allow using
hostnames and to add IPv6 support.
Change-Id: Iafcb9e7f120e2c002989ec8587a8cee5c410fed4
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9656
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/doc/openocd.texi b/doc/openocd.texi
index fbe8cc282..fc6fad101 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -3695,7 +3695,7 @@ Specifies the TCP/IP port number of the SystemVerilog DPI server interface.
@end deffn
@deffn {Config Command} {jtag_dpi set_address} address
-Specifies the TCP/IP address of the SystemVerilog DPI server interface.
+Specifies the hostname or IP address of the SystemVerilog DPI server interface.
@end deffn
@end deffn
diff --git a/src/jtag/drivers/jtag_dpi.c b/src/jtag/drivers/jtag_dpi.c
index 35dd24507..d5a42b1fb 100644
--- a/src/jtag/drivers/jtag_dpi.c
+++ b/src/jtag/drivers/jtag_dpi.c
@@ -16,6 +16,9 @@
#endif
#include <jtag/interface.h>
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
@@ -31,7 +34,6 @@ static uint16_t server_port = SERVER_PORT;
static char *server_address;
static int sockfd;
-static struct sockaddr_in serv_addr;
static uint8_t *last_ir_buf;
static int last_ir_num_bits;
@@ -264,18 +266,6 @@ static int jtag_dpi_execute_queue(struct jtag_command *cmd_queue)
static int jtag_dpi_init(void)
{
- sockfd = socket(AF_INET, SOCK_STREAM, 0);
- if (sockfd < 0) {
- LOG_ERROR("socket: %s, function %s, file %s, line %d",
- strerror(errno), __func__, __FILE__, __LINE__);
- return ERROR_FAIL;
- }
-
- memset(&serv_addr, 0, sizeof(serv_addr));
-
- serv_addr.sin_family = AF_INET;
- serv_addr.sin_port = htons(server_port);
-
if (!server_address) {
server_address = strdup(SERVER_ADDRESS);
if (!server_address) {
@@ -285,26 +275,65 @@ static int jtag_dpi_init(void)
}
}
- serv_addr.sin_addr.s_addr = inet_addr(server_address);
+ const struct addrinfo hints = {
+ .ai_family = AF_UNSPEC,
+ .ai_socktype = SOCK_STREAM
+ };
+
+ char port_str[5 + 1];
+ snprintf(port_str, sizeof(port_str), "%" PRIu16, server_port);
- if (serv_addr.sin_addr.s_addr == INADDR_NONE) {
- LOG_ERROR("inet_addr error occurred");
+ struct addrinfo *result;
+ int ret = getaddrinfo(server_address, port_str, &hints, &result);
+
+ if (ret != 0) {
+ LOG_ERROR("getaddrinfo: %s", gai_strerror(ret));
return ERROR_FAIL;
}
- if (connect(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) {
+ struct addrinfo *rp;
+ for (rp = result; rp ; rp = rp->ai_next) {
+ sockfd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);
+ if (sockfd == -1)
+ continue;
+
+ if (connect(sockfd, rp->ai_addr, rp->ai_addrlen) != -1)
+ break;
+
close(sockfd);
- LOG_ERROR("Can't connect to %s : %" PRIu16, server_address, server_port);
+ }
+
+ if (!rp) {
+ LOG_ERROR("Can't connect to %s : %" PRIu16, server_address,
+ server_port);
+ freeaddrinfo(result);
return ERROR_FAIL;
}
- if (serv_addr.sin_addr.s_addr == htonl(INADDR_LOOPBACK)) {
+
+ bool is_loopback = false;
+ if (rp->ai_family == AF_INET) {
+ struct sockaddr_in sa;
+ memcpy(&sa, rp->ai_addr, sizeof(sa));
+ is_loopback = (sa.sin_addr.s_addr == htonl(INADDR_LOOPBACK));
+ } else if (rp->ai_family == AF_INET6) {
+ struct sockaddr_in6 sa;
+ memcpy(&sa, rp->ai_addr, sizeof(sa));
+ is_loopback = IN6_IS_ADDR_LOOPBACK(&sa.sin6_addr);
+ }
+
+ if (is_loopback) {
+ LOG_DEBUG("Enabling TCP_NODELAY to enhance the speed of local connections");
+
/* This increases performance dramatically for local
* connections, which is the most likely arrangement
* for a DPI connection. */
int flag = 1;
- setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, sizeof(int));
+ setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (char *)&flag,
+ sizeof(int));
}
+ freeaddrinfo(result);
+
LOG_INFO("Connection to %s : %" PRIu16 " succeed", server_address, server_port);
return ERROR_OK;
@@ -372,7 +401,7 @@ static const struct command_registration jtag_dpi_subcommand_handlers[] = {
.name = "set_address",
.handler = &jtag_dpi_set_address,
.mode = COMMAND_CONFIG,
- .help = "set the address of the DPI server",
+ .help = "set the hostname or IP address of the DPI server",
.usage = "[address]",
},
COMMAND_REGISTRATION_DONE
-----------------------------------------------------------------------
Summary of changes:
doc/openocd.texi | 2 +-
src/jtag/drivers/jtag_dpi.c | 71 +++++++++++++++++++++++++++++++--------------
2 files changed, 51 insertions(+), 22 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-05-30 18:16:17
|
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 5bc49ef84c4beb0e83989a7ced551987b743c2b5 (commit)
from c83a7e8914965a111f9fed0616ea4770b0ee7c41 (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 5bc49ef84c4beb0e83989a7ced551987b743c2b5
Author: Marc Schink <de...@za...>
Date: Wed May 13 03:15:49 2026 +0200
adapter/jtag-vpi: Use getaddrinfo() to support hostnames and IPv6
Connection establishment currently supports only IPv4 addresses via
inet_addr(). Replace inet_addr() with getaddrinfo() to allow using
hostnames and to add IPv6 support.
Change-Id: Ieca79b71c24df1cbb82e5fc27d19cf2566efb7f5
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9655
Reviewed-by: Antonio Borneo <bor...@gm...>
Tested-by: jenkins
diff --git a/doc/openocd.texi b/doc/openocd.texi
index bea9ceb6e..fbe8cc282 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -3703,7 +3703,7 @@ Specifies the TCP/IP address of the SystemVerilog DPI server interface.
A JTAG driver acting as a client for the JTAG VPI server interface.
@deffn {Config Command} {jtag_vpi set_address} address
-Specifies the TCP/IP address of the JTAG VPI server.
+Specifies the hostname or IP address of the JTAG VPI server.
@end deffn
@deffn {Config Command} {jtag_vpi set_port} port
diff --git a/src/jtag/drivers/jtag_vpi.c b/src/jtag/drivers/jtag_vpi.c
index fac27b306..18656b797 100644
--- a/src/jtag/drivers/jtag_vpi.c
+++ b/src/jtag/drivers/jtag_vpi.c
@@ -14,6 +14,9 @@
#endif
#include <jtag/interface.h>
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
@@ -39,14 +42,13 @@
#define CMD_STOP_SIMU 4
/* jtag_vpi server port and address to connect to */
-static int server_port = DEFAULT_SERVER_PORT;
+static uint16_t server_port = DEFAULT_SERVER_PORT;
static char *server_address;
/* Send CMD_STOP_SIMU to server when OpenOCD exits? */
static bool stop_sim_on_exit;
static int sockfd;
-static struct sockaddr_in serv_addr;
/* One jtag_vpi "packet" as sent over a TCP channel. */
struct vpi_cmd {
@@ -524,43 +526,70 @@ static int jtag_vpi_execute_queue(struct jtag_command *cmd_queue)
static int jtag_vpi_init(void)
{
- int flag = 1;
+ if (!server_address)
+ server_address = strdup(DEFAULT_SERVER_ADDRESS);
+
+ const struct addrinfo hints = {
+ .ai_family = AF_UNSPEC,
+ .ai_socktype = SOCK_STREAM
+ };
+
+ char port_str[5 + 1];
+ snprintf(port_str, sizeof(port_str), "%" PRIu16, server_port);
- sockfd = socket(AF_INET, SOCK_STREAM, 0);
- if (sockfd < 0) {
- LOG_ERROR("jtag_vpi: Could not create client socket");
+ struct addrinfo *result;
+ int ret = getaddrinfo(server_address, port_str, &hints, &result);
+
+ if (ret != 0) {
+ LOG_ERROR("getaddrinfo: %s", gai_strerror(ret));
return ERROR_FAIL;
}
- memset(&serv_addr, 0, sizeof(serv_addr));
-
- serv_addr.sin_family = AF_INET;
- serv_addr.sin_port = htons(server_port);
+ struct addrinfo *rp;
+ for (rp = result; rp ; rp = rp->ai_next) {
+ sockfd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);
+ if (sockfd == -1)
+ continue;
- if (!server_address)
- server_address = strdup(DEFAULT_SERVER_ADDRESS);
+ if (connect(sockfd, rp->ai_addr, rp->ai_addrlen) != -1)
+ break;
- serv_addr.sin_addr.s_addr = inet_addr(server_address);
+ close(sockfd);
+ }
- if (serv_addr.sin_addr.s_addr == INADDR_NONE) {
- LOG_ERROR("jtag_vpi: inet_addr error occurred");
+ if (!rp) {
+ LOG_ERROR("jtag_vpi: Can't connect to %s : %" PRIu16,
+ server_address, server_port);
+ freeaddrinfo(result);
return ERROR_FAIL;
}
- if (connect(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) {
- close(sockfd);
- LOG_ERROR("jtag_vpi: Can't connect to %s : %u", server_address, server_port);
- return ERROR_COMMAND_CLOSE_CONNECTION;
+ bool is_loopback = false;
+ if (rp->ai_family == AF_INET) {
+ struct sockaddr_in sa;
+ memcpy(&sa, rp->ai_addr, sizeof(sa));
+ is_loopback = (sa.sin_addr.s_addr == htonl(INADDR_LOOPBACK));
+ } else if (rp->ai_family == AF_INET6) {
+ struct sockaddr_in6 sa;
+ memcpy(&sa, rp->ai_addr, sizeof(sa));
+ is_loopback = IN6_IS_ADDR_LOOPBACK(&sa.sin6_addr);
}
- if (serv_addr.sin_addr.s_addr == htonl(INADDR_LOOPBACK)) {
+ if (is_loopback) {
/* This increases performance dramatically for local
- * connections, which is the most likely arrangement
- * for a VPI connection. */
- setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, sizeof(int));
+ * connections, which is the most likely arrangement
+ * for a VPI connection. */
+ LOG_DEBUG("Enabling TCP_NODELAY to enhance the speed of local connections");
+
+ int flag = 1;
+ setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (char *)&flag,
+ sizeof(int));
}
- LOG_INFO("jtag_vpi: Connection to %s : %u successful", server_address, server_port);
+ freeaddrinfo(result);
+
+ LOG_INFO("jtag_vpi: Connection to %s : %" PRIu16 " successful",
+ server_address, server_port);
return ERROR_OK;
}
@@ -594,8 +623,8 @@ COMMAND_HANDLER(jtag_vpi_set_port)
if (CMD_ARGC == 0)
return ERROR_COMMAND_SYNTAX_ERROR;
- COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], server_port);
- LOG_INFO("jtag_vpi: server port set to %u", server_port);
+ COMMAND_PARSE_NUMBER(u16, CMD_ARGV[0], server_port);
+ LOG_INFO("jtag_vpi: server port set to %" PRIu16, server_port);
return ERROR_OK;
}
@@ -634,7 +663,7 @@ static const struct command_registration jtag_vpi_subcommand_handlers[] = {
.name = "set_address",
.handler = &jtag_vpi_set_address,
.mode = COMMAND_CONFIG,
- .help = "set the IP address of the jtag_vpi server (default: 127.0.0.1)",
+ .help = "set the hostname or IP address of the jtag_vpi server (default: 127.0.0.1)",
.usage = "ipv4_addr",
},
{
-----------------------------------------------------------------------
Summary of changes:
doc/openocd.texi | 2 +-
src/jtag/drivers/jtag_vpi.c | 83 ++++++++++++++++++++++++++++++---------------
2 files changed, 57 insertions(+), 28 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-05-30 18:15:38
|
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 c83a7e8914965a111f9fed0616ea4770b0ee7c41 (commit)
from 469bc084efb2694c5ce47bee4199b5294fe54728 (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 c83a7e8914965a111f9fed0616ea4770b0ee7c41
Author: Marc Schink <de...@za...>
Date: Wed May 13 02:59:50 2026 +0200
docs: Add missing JTAG VPI commands
Add the missing documentation for the commands of the JTAG VPI adapter
driver.
Change-Id: Ied5c742b0ed4b64d8bf19131ba1c80d7fd034606
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9654
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/doc/openocd.texi b/doc/openocd.texi
index 6538ff936..bea9ceb6e 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -3699,6 +3699,23 @@ Specifies the TCP/IP address of the SystemVerilog DPI server interface.
@end deffn
@end deffn
+@deffn {Interface Driver} {jtag_vpi}
+A JTAG driver acting as a client for the JTAG VPI server interface.
+
+@deffn {Config Command} {jtag_vpi set_address} address
+Specifies the TCP/IP address of the JTAG VPI server.
+@end deffn
+
+@deffn {Config Command} {jtag_vpi set_port} port
+Specifies the TCP/IP port number of the JTAG VPI server.
+@end deffn
+
+@deffn {Config Command} {jtag_vpi stop_sim_on_exit} (@option{on}|@option{off})
+Specifies whether simulation stop command shall be sent before OpenOCD exits.
+The default is @option{off}.
+@end deffn
+@end deffn
+
@deffn {Interface Driver} {buspirate}
-----------------------------------------------------------------------
Summary of changes:
doc/openocd.texi | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-05-30 18:14:48
|
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 469bc084efb2694c5ce47bee4199b5294fe54728 (commit)
from fcfbbe98b2280ddd78da5cca207a8674adf11e85 (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 469bc084efb2694c5ce47bee4199b5294fe54728
Author: Antonio Borneo <bor...@gm...>
Date: Fri May 15 12:21:11 2026 +0200
target: riscv: drop use of type time_t
This is the only code in OpenOCD that directly uses time_t.
This type assumes different size and sign depending on the host OS
and should not be used directly.
Replace it by using the OpenOCD helper timeval_ms().
Change-Id: I667f5361d8da5fdda96fef295e706136066ea1f8
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9658
Tested-by: jenkins
Reviewed-by: Tomas Vanek <va...@fb...>
Reviewed-by: zapb <de...@za...>
Reviewed-by: Evgeniy Naydanov <eu...@gm...>
diff --git a/src/target/riscv/riscv-011.c b/src/target/riscv/riscv-011.c
index 8fd3792bf..717a9cb57 100644
--- a/src/target/riscv/riscv-011.c
+++ b/src/target/riscv/riscv-011.c
@@ -7,7 +7,6 @@
#include <assert.h>
#include <stdlib.h>
-#include <time.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -724,7 +723,7 @@ static int read_bits(struct target *target, bits_t *result)
static int wait_for_debugint_clear(struct target *target, bool ignore_first)
{
- time_t start = time(NULL);
+ int64_t then = timeval_ms() + 1000 * riscv_get_command_timeout_sec();
if (ignore_first) {
/* Throw away the results of the first read, since they'll contain the
* result of the read that happened just before debugint was set.
@@ -742,7 +741,7 @@ static int wait_for_debugint_clear(struct target *target, bool ignore_first)
if (!bits.interrupt)
return ERROR_OK;
- if (time(NULL) - start > riscv_get_command_timeout_sec()) {
+ if (timeval_ms() > then) {
LOG_ERROR("Timed out waiting for debug int to clear."
"Increase timeout with riscv set_command_timeout_sec.");
return ERROR_FAIL;
@@ -1022,14 +1021,14 @@ static void dram_write_jump(struct target *target, unsigned int index,
static int wait_for_state(struct target *target, enum target_state state)
{
- time_t start = time(NULL);
+ int64_t then = timeval_ms() + 1000 * riscv_get_command_timeout_sec();
while (1) {
int result = riscv011_poll(target);
if (result != ERROR_OK)
return result;
if (target->state == state)
return ERROR_OK;
- if (time(NULL) - start > riscv_get_command_timeout_sec()) {
+ if (timeval_ms() > then) {
LOG_ERROR("Timed out waiting for state %d. "
"Increase timeout with riscv set_command_timeout_sec.", state);
return ERROR_FAIL;
@@ -1189,14 +1188,14 @@ static int full_step(struct target *target, bool announce)
int result = execute_resume(target, true);
if (result != ERROR_OK)
return result;
- time_t start = time(NULL);
+ int64_t then = timeval_ms() + 1000 * riscv_get_command_timeout_sec();
while (1) {
result = poll_target(target, announce);
if (result != ERROR_OK)
return result;
if (target->state != TARGET_DEBUG_RUNNING)
break;
- if (time(NULL) - start > riscv_get_command_timeout_sec()) {
+ if (timeval_ms() > then) {
LOG_ERROR("Timed out waiting for step to complete."
"Increase timeout with riscv set_command_timeout_sec");
return ERROR_FAIL;
@@ -2369,12 +2368,12 @@ static COMMAND_HELPER(riscv011_print_info, struct target *target)
static int wait_for_authbusy(struct target *target)
{
- time_t start = time(NULL);
+ int64_t then = timeval_ms() + 1000 * riscv_get_command_timeout_sec();
while (1) {
uint32_t dminfo = dbus_read(target, DMINFO);
if (!get_field(dminfo, DMINFO_AUTHBUSY))
break;
- if (time(NULL) - start > riscv_get_command_timeout_sec()) {
+ if (timeval_ms() > then) {
LOG_ERROR("Timed out after %ds waiting for authbusy to go low (dminfo=0x%x). "
"Increase the timeout with riscv set_command_timeout_sec.",
riscv_get_command_timeout_sec(),
diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c
index 1b47d5e77..318a66ffe 100644
--- a/src/target/riscv/riscv-013.c
+++ b/src/target/riscv/riscv-013.c
@@ -8,7 +8,6 @@
#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
-#include <time.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -622,7 +621,7 @@ static int wait_for_idle(struct target *target, uint32_t *abstractcs)
return ERROR_FAIL;
}
- time_t start = time(NULL);
+ int64_t then = timeval_ms() + 1000 * riscv_get_command_timeout_sec();
do {
if (dm_read(target, abstractcs, DM_ABSTRACTCS) != ERROR_OK) {
/* We couldn't read abstractcs. For safety, overwrite the output value to
@@ -637,7 +636,7 @@ static int wait_for_idle(struct target *target, uint32_t *abstractcs)
dm->abstract_cmd_maybe_busy = false;
return ERROR_OK;
}
- } while ((time(NULL) - start) < riscv_get_command_timeout_sec());
+ } while (timeval_ms() < then);
LOG_TARGET_ERROR(target,
"Timed out after %ds waiting for busy to go low (abstractcs=0x%" PRIx32 "). "
@@ -1658,7 +1657,7 @@ static int register_read_direct(struct target *target, riscv_reg_t *value,
static int wait_for_authbusy(struct target *target, uint32_t *dmstatus)
{
- time_t start = time(NULL);
+ int64_t then = timeval_ms() + 1000 * riscv_get_command_timeout_sec();
while (1) {
uint32_t value;
if (dmstatus_read(target, &value, false) != ERROR_OK)
@@ -1667,7 +1666,7 @@ static int wait_for_authbusy(struct target *target, uint32_t *dmstatus)
*dmstatus = value;
if (!get_field(value, DM_DMSTATUS_AUTHBUSY))
break;
- if (time(NULL) - start > riscv_get_command_timeout_sec()) {
+ if (timeval_ms() > then) {
LOG_TARGET_ERROR(target, "Timed out after %ds waiting for authbusy to go low (dmstatus=0x%x). "
"Increase the timeout with riscv set_command_timeout_sec.",
riscv_get_command_timeout_sec(),
@@ -1857,14 +1856,14 @@ static int reset_dm(struct target *target)
if (result != ERROR_OK)
return result;
- const time_t start = time(NULL);
+ int64_t then = timeval_ms() + 1000 * riscv_get_command_timeout_sec();
LOG_TARGET_DEBUG(target, "Waiting for the DM to acknowledge reset.");
do {
result = dm_read(target, &dmcontrol, DM_DMCONTROL);
if (result != ERROR_OK)
return result;
- if (time(NULL) - start > riscv_get_command_timeout_sec()) {
+ if (timeval_ms() > then) {
LOG_TARGET_ERROR(target, "DM didn't acknowledge reset in %d s. "
"Increase the timeout with 'riscv set_command_timeout_sec'.",
riscv_get_command_timeout_sec());
@@ -1879,14 +1878,14 @@ static int reset_dm(struct target *target)
if (result != ERROR_OK)
return result;
- const time_t start = time(NULL);
+ int64_t then = timeval_ms() + 1000 * riscv_get_command_timeout_sec();
LOG_TARGET_DEBUG(target, "Waiting for the DM to come out of reset.");
do {
result = dm_read(target, &dmcontrol, DM_DMCONTROL);
if (result != ERROR_OK)
return result;
- if (time(NULL) - start > riscv_get_command_timeout_sec()) {
+ if (timeval_ms() > then) {
LOG_TARGET_ERROR(target, "Debug Module did not become active in %d s. "
"Increase the timeout with 'riscv set_command_timeout_sec'.",
riscv_get_command_timeout_sec());
@@ -2540,7 +2539,7 @@ static int batch_run_timeout(struct target *target, struct riscv_batch *batch)
riscv_batch_add_nop(batch);
size_t finished_scans = 0;
- const time_t start = time(NULL);
+ int64_t then = timeval_ms() + 1000 * riscv_get_command_timeout_sec();
const unsigned int old_base_delay = riscv_scan_get_delay(&info->learned_delays,
RISCV_DELAY_BASE);
int result;
@@ -2563,7 +2562,7 @@ static int batch_run_timeout(struct target *target, struct riscv_batch *batch)
result = increase_dmi_busy_delay(target);
if (result != ERROR_OK)
return result;
- } while (time(NULL) - start < riscv_get_command_timeout_sec());
+ } while (timeval_ms() < then);
assert(result == ERROR_OK);
assert(riscv_batch_was_batch_busy(batch));
@@ -2983,14 +2982,14 @@ static int deassert_reset(struct target *target)
uint32_t dmstatus;
const unsigned int orig_base_delay = riscv_scan_get_delay(&info->learned_delays,
RISCV_DELAY_BASE);
- time_t start = time(NULL);
+ int64_t then = timeval_ms() + 1000 * riscv_get_command_timeout_sec();
LOG_TARGET_DEBUG(target, "Waiting for hart to come out of reset.");
do {
result = dmstatus_read(target, &dmstatus, true);
if (result != ERROR_OK)
return result;
- if (time(NULL) - start > riscv_get_command_timeout_sec()) {
+ if (timeval_ms() > then) {
LOG_TARGET_ERROR(target, "Hart didn't leave reset in %ds; "
"dmstatus=0x%x (allunavail=%s, allhavereset=%s); "
"Increase the timeout with riscv set_command_timeout_sec.",
@@ -3176,13 +3175,13 @@ static target_addr_t sb_read_address(struct target *target)
static int read_sbcs_nonbusy(struct target *target, uint32_t *sbcs)
{
- time_t start = time(NULL);
+ int64_t then = timeval_ms() + 1000 * riscv_get_command_timeout_sec();
while (1) {
if (dm_read(target, sbcs, DM_SBCS) != ERROR_OK)
return ERROR_FAIL;
if (!get_field(*sbcs, DM_SBCS_SBBUSY))
return ERROR_OK;
- if (time(NULL) - start > riscv_get_command_timeout_sec()) {
+ if (timeval_ms() > then) {
LOG_TARGET_ERROR(target, "Timed out after %ds waiting for sbbusy to go low (sbcs=0x%x). "
"Increase the timeout with riscv set_command_timeout_sec.",
riscv_get_command_timeout_sec(), *sbcs);
-----------------------------------------------------------------------
Summary of changes:
src/target/riscv/riscv-011.c | 17 ++++++++---------
src/target/riscv/riscv-013.c | 29 ++++++++++++++---------------
2 files changed, 22 insertions(+), 24 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-05-30 18:14:13
|
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 fcfbbe98b2280ddd78da5cca207a8674adf11e85 (commit)
from 56d91e42e30585358a03e9f31c0a9f4253fb3f3c (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 fcfbbe98b2280ddd78da5cca207a8674adf11e85
Author: Marc Schink <de...@za...>
Date: Sun May 10 12:20:14 2026 +0000
rtt: Fix reading inactive channels
The current implementation reads the names of inactive channels, which
can result in invalid data reads, memory access violations, and broken
output, for example:
> rtt channellist
[riscv.cpu] Failed to read memory (addr=0x0)
{
{
name Terminal
size 0x400
flags 0x0
}
Skip reading the names of inactive channels to avoid invalid memory
reads and broken output.
Change-Id: Iccc029c9ea1787eb361e4fba8119398abf5dafe1
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9652
Reviewed-by: Antonio Borneo <bor...@gm...>
Reviewed-by: Chris Head <ch...@za...>
Tested-by: jenkins
diff --git a/src/target/rtt.c b/src/target/rtt.c
index 5b7fdda40..0dd82f5c7 100644
--- a/src/target/rtt.c
+++ b/src/target/rtt.c
@@ -339,15 +339,18 @@ int target_rtt_read_channel_info(struct target *target,
return ret;
}
+ info->size = channel.size;
+ info->flags = channel.flags;
+
+ if (!channel_is_active(&channel))
+ return ERROR_OK;
+
ret = read_channel_name(target, channel.name_addr, info->name,
info->name_length);
if (ret != ERROR_OK)
return ret;
- info->size = channel.size;
- info->flags = channel.flags;
-
return ERROR_OK;
}
-----------------------------------------------------------------------
Summary of changes:
src/target/rtt.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-05-30 18:13:50
|
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 56d91e42e30585358a03e9f31c0a9f4253fb3f3c (commit)
from f92f577cc0dcc14c63ff31fd7bd5144b3120443b (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 56d91e42e30585358a03e9f31c0a9f4253fb3f3c
Author: hhoang308 <huy...@gm...>
Date: Fri Apr 10 14:25:43 2026 +0700
target/rtt: support 64-bit targets by using dynamic offsets
The current RTT implementation hardcodes the channel structure size to
24 bytes and uses fixed offsets for control block members. This conforms
to the ILP32 (32-bit) layout but fails on LP64 (64-bit) targets such as
RISC-V 64-bit or AArch64.
On 64-bit targets:
- Pointers are 8 bytes, increasing the channel struct size to 32 bytes.
- Member offsets are shifted due to alignment.
- Critically, the 'read_pos' offset moves from 0x10 (32-bit) to 0x18
(64-bit).
The existing code writes to offset 0x10 to update the read position. On
a 64-bit target, offset 0x10 corresponds to 'SizeOfBuffer'. This
overwrites the buffer size with the read position value, causing memory
corruption and immediate firmware crashes (boot loops).
This patch introduces a dynamic parameter structure that selects the
correct offsets and sizes at runtime based on 'target->address_bits'.
It has been verified on a RISC-V 64-bit target running Zephyr RTOS.
Change-Id: If839cb531042f4e6f135743462be932ac881ab4c
Signed-off-by: hhoang308 <huy...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9396
Reviewed-by: Antonio Borneo <bor...@gm...>
Reviewed-by: zapb <de...@za...>
Tested-by: jenkins
diff --git a/src/rtt/rtt.h b/src/rtt/rtt.h
index d84fdb40b..b716dfff9 100644
--- a/src/rtt/rtt.h
+++ b/src/rtt/rtt.h
@@ -21,8 +21,11 @@
/* Control block size in bytes. */
#define RTT_CB_SIZE (RTT_CB_MAX_ID_LENGTH + 2 * sizeof(uint32_t))
-/* Channel structure size in bytes. */
-#define RTT_CHANNEL_SIZE 24
+/* Channel structure size in bytes (32-bit architecture). */
+#define RTT_CHANNEL_SIZE_32 24
+
+/* Channel structure size in bytes (64-bit architecture). */
+#define RTT_CHANNEL_SIZE_64 32
/* Minimal channel buffer size in bytes. */
#define RTT_CHANNEL_BUFFER_MIN_SIZE 2
@@ -44,9 +47,9 @@ struct rtt_channel {
/** Channel structure address on the target. */
target_addr_t address;
/** Channel name address on the target. */
- uint32_t name_addr;
+ target_addr_t name_addr;
/** Buffer address on the target. */
- uint32_t buffer_addr;
+ target_addr_t buffer_addr;
/** Channel buffer size in bytes. */
uint32_t size;
/** Write position within the buffer in bytes. */
diff --git a/src/target/rtt.c b/src/target/rtt.c
index a8ab24a60..5b7fdda40 100644
--- a/src/target/rtt.c
+++ b/src/target/rtt.c
@@ -18,32 +18,74 @@
#include "target.h"
+// Offsets for RTT control block parameters.
+struct rtt_control_params {
+ unsigned int channel_size;
+ unsigned int buffer_addr_offset;
+ unsigned int size_offset;
+ unsigned int write_pos_offset;
+ unsigned int read_pos_offset;
+ unsigned int flags_offset;
+};
+
+// Offsets for 32-bit architecture.
+static const struct rtt_control_params rtt_params_32 = {
+ .channel_size = RTT_CHANNEL_SIZE_32,
+ .buffer_addr_offset = 4,
+ .size_offset = 8,
+ .write_pos_offset = 12,
+ .read_pos_offset = 16,
+ .flags_offset = 20
+};
+
+// Offsets for 64-bit architecture.
+static const struct rtt_control_params rtt_params_64 = {
+ .channel_size = RTT_CHANNEL_SIZE_64,
+ .buffer_addr_offset = 8,
+ .size_offset = 16,
+ .write_pos_offset = 20,
+ .read_pos_offset = 24,
+ .flags_offset = 28
+};
+
+static const struct rtt_control_params *get_rtt_params(struct target *target)
+{
+ if (target_address_bits(target) == 64)
+ return &rtt_params_64;
+ return &rtt_params_32;
+}
+
static int read_rtt_channel(struct target *target,
const struct rtt_control *ctrl, unsigned int channel_index,
enum rtt_channel_type type, struct rtt_channel *channel)
{
int ret;
- uint8_t buf[RTT_CHANNEL_SIZE];
+ uint8_t buf[RTT_CHANNEL_SIZE_64];
target_addr_t address;
+ const struct rtt_control_params *params = get_rtt_params(target);
- address = ctrl->address + RTT_CB_SIZE + (channel_index * RTT_CHANNEL_SIZE);
+ address = ctrl->address + RTT_CB_SIZE + (channel_index * params->channel_size);
if (type == RTT_CHANNEL_TYPE_DOWN)
- address += ctrl->num_up_channels * RTT_CHANNEL_SIZE;
+ address += ctrl->num_up_channels * params->channel_size;
- ret = target_read_buffer(target, address, RTT_CHANNEL_SIZE, buf);
+ ret = target_read_buffer(target, address, params->channel_size, buf);
if (ret != ERROR_OK)
return ret;
channel->address = address;
- channel->name_addr = target_buffer_get_u32(target, buf + 0);
- channel->buffer_addr = target_buffer_get_u32(target, buf + 4);
- channel->size = target_buffer_get_u32(target, buf + 8);
- channel->write_pos = target_buffer_get_u32(target, buf + 12);
- channel->read_pos = target_buffer_get_u32(target, buf + 16);
- channel->flags = target_buffer_get_u32(target, buf + 20);
-
+ if (target_address_bits(target) == 64) {
+ channel->name_addr = target_buffer_get_u64(target, buf + 0);
+ channel->buffer_addr = target_buffer_get_u64(target, buf + params->buffer_addr_offset);
+ } else {
+ channel->name_addr = target_buffer_get_u32(target, buf + 0);
+ channel->buffer_addr = target_buffer_get_u32(target, buf + params->buffer_addr_offset);
+ }
+ channel->size = target_buffer_get_u32(target, buf + params->size_offset);
+ channel->write_pos = target_buffer_get_u32(target, buf + params->write_pos_offset);
+ channel->read_pos = target_buffer_get_u32(target, buf + params->read_pos_offset);
+ channel->flags = target_buffer_get_u32(target, buf + params->flags_offset);
return ERROR_OK;
}
@@ -157,7 +199,8 @@ static int write_to_channel(struct target *target,
return ret;
}
- ret = target_write_u32(target, channel->address + 12,
+ const struct rtt_control_params *params = get_rtt_params(target);
+ ret = target_write_u32(target, channel->address + params->write_pos_offset,
(channel->write_pos + len) % channel->size);
if (ret != ERROR_OK)
@@ -349,7 +392,8 @@ static int read_from_channel(struct target *target,
}
if (len > 0) {
- ret = target_write_u32(target, channel->address + 16,
+ const struct rtt_control_params *params = get_rtt_params(target);
+ ret = target_write_u32(target, channel->address + params->read_pos_offset,
(channel->read_pos + len) % channel->size);
if (ret != ERROR_OK)
-----------------------------------------------------------------------
Summary of changes:
src/rtt/rtt.h | 11 +++++----
src/target/rtt.c | 70 +++++++++++++++++++++++++++++++++++++++++++++-----------
2 files changed, 64 insertions(+), 17 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-05-27 18:07:11
|
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 f92f577cc0dcc14c63ff31fd7bd5144b3120443b (commit)
from dc803e74be21678b8e867cb01609ed59a446ec09 (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 f92f577cc0dcc14c63ff31fd7bd5144b3120443b
Author: Tomas Vanek <va...@fb...>
Date: Thu May 21 07:32:48 2026 +0200
jtag/core: fix blocked polling in unknown state of jtag_xrst
Patch [1] neglected three state character of jtag_trst variable,
similarly the original code did for jtag_srst.
Block polling only if SRST / TRST state is known and set.
Fixes: [1] commit eeacc589af60 ("jtag/core: fix is_jtag_poll_safe() logic")
Change-Id: I058491d5f0523af1690141787ec74bd21ad0832e
Signed-off-by: Tomas Vanek <va...@fb...>
Reported-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9669
Tested-by: jenkins
Reviewed-by: zapb <de...@za...>
diff --git a/src/jtag/core.c b/src/jtag/core.c
index 9c438a01b..08228c024 100644
--- a/src/jtag/core.c
+++ b/src/jtag/core.c
@@ -151,11 +151,11 @@ bool is_jtag_poll_safe(void)
return false;
/* On JTAG transport it is also implicitly disabled while TRST is active */
- if (transport_is_jtag() && jtag_trst)
+ if (transport_is_jtag() && jtag_trst == 1)
return false;
/* On any transport while SRST is gating the JTAG clock or other debug HW */
- return jtag_srst == 0 || (jtag_reset_config & RESET_SRST_NO_GATING);
+ return jtag_srst != 1 || (jtag_reset_config & RESET_SRST_NO_GATING);
}
bool jtag_poll_get_enabled(void)
-----------------------------------------------------------------------
Summary of changes:
src/jtag/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-05-22 03:21:25
|
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 dc803e74be21678b8e867cb01609ed59a446ec09 (commit)
from 103cde964855ab5693e15f3b0cefbdb10027ba0d (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 dc803e74be21678b8e867cb01609ed59a446ec09
Author: Mark O'Donovan <sh...@po...>
Date: Tue Feb 10 09:41:12 2026 +0000
tcl/target: Fix max32625 support
Interfaces used: jlink, olimex-arm-usb-tiny-h, cmsis-dap
On openocd master the 'reset halt' command gives the following:
"Error: timed out while waiting for target halted"
This commit causes 'reset halt' to work with the jlink and olimex
adapters. The error is no longer logged and the board halts.
With cmsis-dap the error is no longer logged. However the board
fails to remain halted unless the command is issued in telnet.
Change-Id: Ieb7f783394fae0d4f7051f107e4b6eb39c49599f
Signed-off-by: Mark O'Donovan <sh...@po...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9458
Tested-by: jenkins
Reviewed-by: Tomas Vanek <va...@fb...>
diff --git a/tcl/target/max32625.cfg b/tcl/target/max32625.cfg
index 4529e542a..0f97010c8 100644
--- a/tcl/target/max32625.cfg
+++ b/tcl/target/max32625.cfg
@@ -1,9 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Maxim Integrated MAX32625 - Arm Cortex-M4F @ 96MHz
-# Set the reset pin configuration
-reset_config srst_only
-adapter srst delay 200
+# Note: reset_config srst_only causes reset halt to time out
# Set flash parameters
set FLASH_BASE 0x0
-----------------------------------------------------------------------
Summary of changes:
tcl/target/max32625.cfg | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-05-17 21:00:05
|
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 103cde964855ab5693e15f3b0cefbdb10027ba0d (commit)
from 8e87e2e026425f0f5bc5d2f7d541896fe5927c0b (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 103cde964855ab5693e15f3b0cefbdb10027ba0d
Author: Marc Schink <de...@za...>
Date: Tue May 12 10:39:21 2026 +0200
adapter/remote-bitbang: Drop unused #define
The #define became unused after commit 00ba179dbc18 ("remote_bitbang:
Convert to use getaddrinfo()") and was never removed, so drop it.
Change-Id: I5e90370c4dd0c60d7df72e2eac8717665c2b2cc4
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9653
Reviewed-by: Antonio Borneo <bor...@gm...>
Tested-by: jenkins
diff --git a/src/jtag/drivers/remote_bitbang.c b/src/jtag/drivers/remote_bitbang.c
index 71ec572b3..f3a107312 100644
--- a/src/jtag/drivers/remote_bitbang.c
+++ b/src/jtag/drivers/remote_bitbang.c
@@ -21,9 +21,6 @@
#include <jtag/interface.h>
#include "bitbang.h"
-/* arbitrary limit on host name length: */
-#define REMOTE_BITBANG_HOST_MAX 255
-
static char *remote_bitbang_host;
static char *remote_bitbang_port;
-----------------------------------------------------------------------
Summary of changes:
src/jtag/drivers/remote_bitbang.c | 3 ---
1 file changed, 3 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-05-17 20:58:57
|
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 8e87e2e026425f0f5bc5d2f7d541896fe5927c0b (commit)
from bad284fb653a78ad0daad5d1907f6e3d7eff4f06 (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 8e87e2e026425f0f5bc5d2f7d541896fe5927c0b
Author: Richard Allen <rs...@gm...>
Date: Mon Feb 3 21:21:15 2025 -0600
target: multiple profiling histograms
Encode profiling data in multiple histograms.
This provides much smaller encoding for target
systems with sparse address maps.
Change-Id: I38276dd1be011ce5781b0264b7cbb09a3aa1a2b5
Signed-off-by: Richard Allen <rs...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8739
Reviewed-by: Antonio Borneo <bor...@gm...>
Tested-by: jenkins
diff --git a/src/target/target.c b/src/target/target.c
index aa09cad08..4d8741238 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -4155,41 +4155,31 @@ static void write_string(FILE *f, char *s)
typedef unsigned char UNIT[2]; /* unit of profiling */
-/* Dump a gmon.out histogram file. */
-static void write_gmon(const uint32_t *samples, uint32_t sample_num, const char *filename,
- struct target *target, uint32_t duration_ms)
+static void write_gmon_hist(FILE *f, const uint32_t *samples, uint32_t sample_num,
+ float sample_rate, struct target *target)
{
- FILE *f = fopen(filename, "wb");
- if (!f)
- return;
- write_string(f, "gmon");
- write_long(f, 0x00000001, target); /* Version */
- write_long(f, 0, target); /* padding */
- write_long(f, 0, target); /* padding */
- write_long(f, 0, target); /* padding */
-
- uint8_t zero = 0; /* GMON_TAG_TIME_HIST */
- write_data(f, &zero, 1);
-
- /* figure out bucket size */
uint32_t min = samples[0];
+ uint32_t max = samples[sample_num - 1];
+
/* max should be (largest sample + 1)
* Refer to binutils/gprof/hist.c (find_histogram_for_pc) */
- uint32_t max = samples[sample_num - 1] + 1;
+ max++;
+
+ /* The ratio ((double)((max - min) / 2) / num_buckets) must match across
+ * all histograms in this file. To avoid trunction in the /2, we must have
+ * an even length address space for compatibility with binutils <=2.44.
+ * Refer to binutils/gprof/hist.c (calculation of n_hist_scale)*/
+ if ((max - min) % 2)
+ max++;
uint32_t address_space = max - min;
- /* FIXME: What is the reasonable number of buckets?
- * The profiling result will be more accurate if there are enough buckets. */
- static const uint32_t max_buckets = 128 * 1024; /* maximum buckets. */
- uint32_t num_buckets = address_space / sizeof(UNIT);
- if (num_buckets > max_buckets)
- num_buckets = max_buckets;
+ uint8_t zero = 0; /* GMON_TAG_TIME_HIST */
+ write_data(f, &zero, 1);
/* append binary memory gmon.out &profile_hist_hdr ((char*)&profile_hist_hdr + sizeof(struct gmon_hist_hdr)) */
write_long(f, min, target); /* low_pc */
write_long(f, max, target); /* high_pc */
- write_long(f, num_buckets, target); /* # of buckets */
- float sample_rate = sample_num / (duration_ms / 1000.0);
+ write_long(f, address_space / sizeof(UNIT), target); /* # of buckets */
write_long(f, sample_rate, target);
write_string(f, "seconds");
for (size_t i = strlen("seconds"); i < 15; i++)
@@ -4198,12 +4188,13 @@ static void write_gmon(const uint32_t *samples, uint32_t sample_num, const char
/*append binary memory gmon.out profile_hist_data (profile_hist_data + profile_hist_hdr.hist_size) */
bool saturated_once = false;
- for (uint32_t i = 0, bidx = 0; bidx < num_buckets; ++bidx) {
- long long bmax = min + (long long)address_space * (bidx + 1) / num_buckets;
+ for (uint32_t i = 0, bidx = 0; bidx < address_space; bidx += sizeof(UNIT)) {
uint32_t val = i;
- while (i < sample_num && samples[i] < bmax)
+ uint32_t bmax = min + bidx;
+ while (i < sample_num && samples[i] <= bmax)
++i;
val = i - val;
+
if (val > UINT16_MAX) {
val = UINT16_MAX;
if (!saturated_once)
@@ -4215,6 +4206,37 @@ static void write_gmon(const uint32_t *samples, uint32_t sample_num, const char
h_u16_to_le(data, val);
write_data(f, data, 2);
}
+}
+
+/* Dump a gmon.out histogram file. */
+static void write_gmon(const uint32_t *samples, uint32_t sample_num, const char *filename,
+ struct target *target, uint32_t duration_ms)
+{
+ float sample_rate = sample_num / (duration_ms / 1000.0);
+ FILE *f = fopen(filename, "wb");
+ if (!f)
+ return;
+ write_string(f, "gmon");
+ write_long(f, 0x00000001, target); /* Version */
+ write_long(f, 0, target); /* padding */
+ write_long(f, 0, target); /* padding */
+ write_long(f, 0, target); /* padding */
+
+ while (sample_num) {
+ /* if address gap exceeds this, make another histogram */
+ const uint32_t MAX_GAP = 32;
+
+ /* figure out bucket size */
+ uint32_t max = samples[0];
+ uint32_t this_pass = 1;
+ while (this_pass < sample_num && samples[this_pass] - max < MAX_GAP)
+ max = samples[this_pass++];
+
+ write_gmon_hist(f, samples, this_pass, sample_rate, target);
+
+ samples += this_pass;
+ sample_num -= this_pass;
+ }
fclose(f);
}
-----------------------------------------------------------------------
Summary of changes:
src/target/target.c | 78 ++++++++++++++++++++++++++++++++++-------------------
1 file changed, 50 insertions(+), 28 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-05-17 20:58:38
|
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 bad284fb653a78ad0daad5d1907f6e3d7eff4f06 (commit)
from dcf6282985345be5ff79a4528321db5f0bcb2849 (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 bad284fb653a78ad0daad5d1907f6e3d7eff4f06
Author: Richard Allen <rs...@gm...>
Date: Fri Nov 29 12:27:48 2024 -0600
target: malloc-free profiling histogram
Leverage presorted samples to generate gmon histogram
without buffering entire histogram in memory.
Change-Id: I38276dd1be011ce5781b0264b7cbb09a3aa1a2a2
Signed-off-by: Richard Allen <rs...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8605
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/target/target.c b/src/target/target.c
index a6cdbd445..aa09cad08 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -4159,7 +4159,6 @@ typedef unsigned char UNIT[2]; /* unit of profiling */
static void write_gmon(const uint32_t *samples, uint32_t sample_num, const char *filename,
struct target *target, uint32_t duration_ms)
{
- uint32_t i;
FILE *f = fopen(filename, "wb");
if (!f)
return;
@@ -4185,24 +4184,6 @@ static void write_gmon(const uint32_t *samples, uint32_t sample_num, const char
uint32_t num_buckets = address_space / sizeof(UNIT);
if (num_buckets > max_buckets)
num_buckets = max_buckets;
- int *buckets = malloc(sizeof(int) * num_buckets);
- if (!buckets) {
- fclose(f);
- return;
- }
- memset(buckets, 0, sizeof(int) * num_buckets);
- for (i = 0; i < sample_num; i++) {
- uint32_t address = samples[i];
-
- if ((address < min) || (max <= address))
- continue;
-
- long long a = address - min;
- long long b = num_buckets;
- long long c = address_space;
- int index_t = (a * b) / c; /* danger!!!! int32 overflows */
- buckets[index_t]++;
- }
/* append binary memory gmon.out &profile_hist_hdr ((char*)&profile_hist_hdr + sizeof(struct gmon_hist_hdr)) */
write_long(f, min, target); /* low_pc */
@@ -4211,27 +4192,29 @@ static void write_gmon(const uint32_t *samples, uint32_t sample_num, const char
float sample_rate = sample_num / (duration_ms / 1000.0);
write_long(f, sample_rate, target);
write_string(f, "seconds");
- for (i = 0; i < (15-strlen("seconds")); i++)
+ for (size_t i = strlen("seconds"); i < 15; i++)
write_data(f, &zero, 1);
write_string(f, "s");
/*append binary memory gmon.out profile_hist_data (profile_hist_data + profile_hist_hdr.hist_size) */
-
- char *data = malloc(2 * num_buckets);
- if (data) {
- for (i = 0; i < num_buckets; i++) {
- int val;
- val = buckets[i];
- if (val > 65535)
- val = 65535;
- data[i * 2] = val&0xff;
- data[i * 2 + 1] = (val >> 8) & 0xff;
+ bool saturated_once = false;
+ for (uint32_t i = 0, bidx = 0; bidx < num_buckets; ++bidx) {
+ long long bmax = min + (long long)address_space * (bidx + 1) / num_buckets;
+ uint32_t val = i;
+ while (i < sample_num && samples[i] < bmax)
+ ++i;
+ val = i - val;
+ if (val > UINT16_MAX) {
+ val = UINT16_MAX;
+ if (!saturated_once)
+ LOG_WARNING("profiler bucket saturated, will read as 65535");
+ saturated_once = true;
}
- free(buckets);
- write_data(f, data, num_buckets * 2);
- free(data);
- } else
- free(buckets);
+
+ uint8_t data[2];
+ h_u16_to_le(data, val);
+ write_data(f, data, 2);
+ }
fclose(f);
}
-----------------------------------------------------------------------
Summary of changes:
src/target/target.c | 53 ++++++++++++++++++-----------------------------------
1 file changed, 18 insertions(+), 35 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-05-17 20:58:11
|
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 dcf6282985345be5ff79a4528321db5f0bcb2849 (commit)
from c177844f4ae148846c1086c898ad1ace51f4dcd6 (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 dcf6282985345be5ff79a4528321db5f0bcb2849
Author: Richard Allen <rs...@gm...>
Date: Fri Nov 29 12:27:45 2024 -0600
target: filter and sort pc samples before storing
Add a comparator and pre-sort the program-counter
samples before saving histogram.
These changes make future improvements easier to implement.
Change-Id: I38276dd1be011ce5781b0264b7cda08c32a1a2a2
Signed-off-by: Richard Allen <rs...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8604
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/target/target.c b/src/target/target.c
index 105a38881..a6cdbd445 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -30,6 +30,7 @@
#include "config.h"
#endif
+#include <stdlib.h>
#include <helper/align.h>
#include <helper/list.h>
#include <helper/nvp.h>
@@ -4155,8 +4156,8 @@ static void write_string(FILE *f, char *s)
typedef unsigned char UNIT[2]; /* unit of profiling */
/* Dump a gmon.out histogram file. */
-static void write_gmon(const uint32_t *samples, uint32_t sample_num, const char *filename, bool with_range,
- uint32_t start_address, uint32_t end_address, struct target *target, uint32_t duration_ms)
+static void write_gmon(const uint32_t *samples, uint32_t sample_num, const char *filename,
+ struct target *target, uint32_t duration_ms)
{
uint32_t i;
FILE *f = fopen(filename, "wb");
@@ -4172,35 +4173,10 @@ static void write_gmon(const uint32_t *samples, uint32_t sample_num, const char
write_data(f, &zero, 1);
/* figure out bucket size */
- uint32_t min;
- uint32_t max;
- if (with_range) {
- min = start_address;
- max = end_address;
- } else {
- min = samples[0];
- max = samples[0];
- for (i = 0; i < sample_num; i++) {
- if (min > samples[i])
- min = samples[i];
- if (max < samples[i])
- max = samples[i];
- }
-
- /* max should be (largest sample + 1)
- * Refer to binutils/gprof/hist.c (find_histogram_for_pc) */
- if (max < UINT32_MAX)
- max++;
-
- /* gprof requires (max - min) >= 2 */
- while ((max - min) < 2) {
- if (max < UINT32_MAX)
- max++;
- else
- min--;
- }
- }
-
+ uint32_t min = samples[0];
+ /* max should be (largest sample + 1)
+ * Refer to binutils/gprof/hist.c (find_histogram_for_pc) */
+ uint32_t max = samples[sample_num - 1] + 1;
uint32_t address_space = max - min;
/* FIXME: What is the reasonable number of buckets?
@@ -4260,6 +4236,14 @@ static void write_gmon(const uint32_t *samples, uint32_t sample_num, const char
fclose(f);
}
+// comparison function for qsort(). Returns -1, 0 or +1
+static int compare_pc32(const void *p1, const void *p2)
+{
+ uint32_t lhs = *(const uint32_t *)p1;
+ uint32_t rhs = *(const uint32_t *)p2;
+ return (lhs > rhs) - (lhs < rhs);
+}
+
/* profiling samples the CPU PC as quickly as OpenOCD is able,
* which will be used as a random sampling of PC */
COMMAND_HANDLER(handle_profile_command)
@@ -4308,7 +4292,7 @@ COMMAND_HANDLER(handle_profile_command)
free(samples);
return retval;
}
- uint32_t duration_ms = timeval_ms() - timestart_ms;
+ uint64_t duration_ms = timeval_ms() - timestart_ms;
assert(num_of_samples <= MAX_PROFILE_SAMPLE_NUM);
@@ -4342,9 +4326,27 @@ COMMAND_HANDLER(handle_profile_command)
return retval;
}
- write_gmon(samples, num_of_samples, CMD_ARGV[1],
- with_range, start_address, end_address, target, duration_ms);
- command_print(CMD, "Wrote %s", CMD_ARGV[1]);
+ if (with_range) {
+ uint32_t num_filtered_samples = 0;
+ for (uint32_t in = 0; in < num_of_samples; ++in) {
+ uint32_t sample = samples[in];
+ if (sample >= start_address && sample < end_address)
+ samples[num_filtered_samples++] = sample;
+ }
+ duration_ms = (duration_ms * num_filtered_samples + num_of_samples / 2) / num_of_samples;
+ if (duration_ms < 1)
+ duration_ms = 0;
+ num_of_samples = num_filtered_samples;
+ }
+
+ if (num_of_samples) {
+ qsort(samples, num_of_samples, sizeof(samples[0]), compare_pc32);
+
+ write_gmon(samples, num_of_samples, CMD_ARGV[1], target, duration_ms);
+ command_print(CMD, "Wrote %s", CMD_ARGV[1]);
+ } else {
+ command_print(CMD, "Wrote no samples");
+ }
free(samples);
return retval;
-----------------------------------------------------------------------
Summary of changes:
src/target/target.c | 72 +++++++++++++++++++++++++++--------------------------
1 file changed, 37 insertions(+), 35 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-05-17 20:57:53
|
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 c177844f4ae148846c1086c898ad1ace51f4dcd6 (commit)
from 6fc1cf08562f30bfb9dc8b9ac8cbe0a4594fdcec (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 c177844f4ae148846c1086c898ad1ace51f4dcd6
Author: Richard Allen <rs...@gm...>
Date: Fri Nov 29 12:27:40 2024 -0600
target: const-correct write_gmon
Mark samples buffer pointer as const, since
write_gmon() will not change it.
Change-Id: I38276dd1be013ee5981b0264b7cbb08c32a1a2a2
Signed-off-by: Richard Allen <rs...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8603
Reviewed-by: Antonio Borneo <bor...@gm...>
Reviewed-by: Samuel Obuch <sam...@es...>
Tested-by: jenkins
diff --git a/src/target/target.c b/src/target/target.c
index d0776834e..105a38881 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -4155,7 +4155,7 @@ static void write_string(FILE *f, char *s)
typedef unsigned char UNIT[2]; /* unit of profiling */
/* Dump a gmon.out histogram file. */
-static void write_gmon(uint32_t *samples, uint32_t sample_num, const char *filename, bool with_range,
+static void write_gmon(const uint32_t *samples, uint32_t sample_num, const char *filename, bool with_range,
uint32_t start_address, uint32_t end_address, struct target *target, uint32_t duration_ms)
{
uint32_t i;
-----------------------------------------------------------------------
Summary of changes:
src/target/target.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-05-17 20:56:47
|
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 6fc1cf08562f30bfb9dc8b9ac8cbe0a4594fdcec (commit)
from 3a7635f4472fd293d22c4d6973161270a7679090 (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 6fc1cf08562f30bfb9dc8b9ac8cbe0a4594fdcec
Author: Marc Schink <de...@za...>
Date: Mon Apr 27 08:32:19 2026 +0200
adapter/openjtag: Use adapter core USB product name handling
Use the USB product name handling provided by the adapter core instead
of having it in the driver code itself.
Keep the legacy 'openjtag device_desc' command for backwards compatibility,
but mark it as deprecated.
Change-Id: I4973f37a9a3f9cc4e7fd439b64dee1a716d13bd8
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9611
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/doc/openocd.texi b/doc/openocd.texi
index aa2c256eb..6538ff936 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -3647,11 +3647,6 @@ Currently valid @var{variant} values include:
(see @uref{http://www.cypress.com/?rID=82870}).
@end itemize
@end deffn
-
-@deffn {Config Command} {openjtag device_desc} string
-The USB device description string of the adapter.
-This value is only used with the standard variant.
-@end deffn
@end deffn
diff --git a/src/jtag/drivers/openjtag.c b/src/jtag/drivers/openjtag.c
index bfa094bd6..86b27ac4a 100644
--- a/src/jtag/drivers/openjtag.c
+++ b/src/jtag/drivers/openjtag.c
@@ -78,8 +78,6 @@ enum openjtag_tap_state {
static uint16_t openjtag_vids[] = {0x0403, 0};
static uint16_t openjtag_pids[] = {0x6001, 0};
-static char *openjtag_device_desc;
-
static struct ftdi_context ftdic;
#define OPENJTAG_BUFFER_SIZE 504
@@ -378,11 +376,13 @@ static int openjtag_init_standard(void)
{
uint8_t latency_timer;
+ const char *usb_product_name = adapter_usb_get_product_name();
+
/* Open by device description */
- if (!openjtag_device_desc) {
- LOG_WARNING("no openjtag device description specified, "
+ if (!usb_product_name) {
+ LOG_WARNING("no openjtag USB product name specified, "
"using default 'Open JTAG Project'");
- openjtag_device_desc = "Open JTAG Project";
+ usb_product_name = "Open JTAG Project";
}
if (ftdi_init(&ftdic) < 0)
@@ -398,7 +398,7 @@ static int openjtag_init_standard(void)
for (unsigned int i = 0; vids[i] != 0; i++) {
/* context, vendor id, product id, description, serial id */
- if (ftdi_usb_open_desc(&ftdic, vids[i], pids[i], openjtag_device_desc, NULL) < 0) {
+ if (ftdi_usb_open_desc(&ftdic, vids[i], pids[i], usb_product_name, NULL) < 0) {
LOG_ERROR("unable to open ftdi device: %s", ftdic.error_str);
return ERROR_JTAG_INIT_FAILED;
}
@@ -850,16 +850,6 @@ static int openjtag_khz(int khz, int *jtag_speed)
return ERROR_OK;
}
-COMMAND_HANDLER(openjtag_handle_device_desc_command)
-{
- if (CMD_ARGC == 1)
- openjtag_device_desc = strdup(CMD_ARGV[0]);
- else
- LOG_ERROR("require exactly one argument to "
- "openjtag_device_desc <description>");
- return ERROR_OK;
-}
-
COMMAND_HANDLER(openjtag_handle_variant_command)
{
if (CMD_ARGC == 1) {
@@ -880,13 +870,6 @@ COMMAND_HANDLER(openjtag_handle_variant_command)
}
static const struct command_registration openjtag_subcommand_handlers[] = {
- {
- .name = "device_desc",
- .handler = openjtag_handle_device_desc_command,
- .mode = COMMAND_CONFIG,
- .help = "set the USB device description of the OpenJTAG",
- .usage = "description-string",
- },
{
.name = "variant",
.handler = openjtag_handle_variant_command,
diff --git a/src/jtag/startup.tcl b/src/jtag/startup.tcl
index 2706c752f..78b8ac8e3 100644
--- a/src/jtag/startup.tcl
+++ b/src/jtag/startup.tcl
@@ -354,10 +354,16 @@ proc remote_bitbang_port args {
eval remote_bitbang port $args
}
+lappend _telnet_autocomplete_skip openjtag_device_desc
+proc "openjtag device_desc" args {
+ echo "DEPRECATED! use 'adapter usb product_name' not 'openjtag device_desc'"
+ eval adapter usb product_name $args
+}
+
lappend _telnet_autocomplete_skip openjtag_device_desc
proc openjtag_device_desc args {
- echo "DEPRECATED! use 'openjtag device_desc' not 'openjtag_device_desc'"
- eval openjtag device_desc $args
+ echo "DEPRECATED! use 'adapter usb product_name' not 'openjtag_device_desc'"
+ eval adapter usb product_name $args
}
lappend _telnet_autocomplete_skip openjtag_variant
diff --git a/tcl/interface/openjtag.cfg b/tcl/interface/openjtag.cfg
index 1602352db..3ba5c4472 100644
--- a/tcl/interface/openjtag.cfg
+++ b/tcl/interface/openjtag.cfg
@@ -7,4 +7,4 @@
#
adapter driver openjtag
-openjtag device_desc "Open JTAG Project"
+adapter usb product_name "Open JTAG Project"
-----------------------------------------------------------------------
Summary of changes:
doc/openocd.texi | 5 -----
src/jtag/drivers/openjtag.c | 29 ++++++-----------------------
src/jtag/startup.tcl | 10 ++++++++--
tcl/interface/openjtag.cfg | 2 +-
4 files changed, 15 insertions(+), 31 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-05-17 20:56:27
|
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 3a7635f4472fd293d22c4d6973161270a7679090 (commit)
from e4941a039789227666d5fa2799613db0ca1c7d74 (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 3a7635f4472fd293d22c4d6973161270a7679090
Author: Marc Schink <de...@za...>
Date: Mon Apr 27 08:23:00 2026 +0200
adapter/ch347: Use adapter core USB product name handling
Use the USB product name handling provided by the adapter core instead
of having it in the driver code itself.
Change-Id: I5ba8ed11adbfe9b9e2d54b5d77a9255046809401
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9610
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/doc/openocd.texi b/doc/openocd.texi
index 361a024f3..aa2c256eb 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -2609,17 +2609,6 @@ mitigates the problem.
The driver supports activity LED through the generic
command @ref{adapter gpio, @command{adapter gpio led}}.
-
-This driver has these driver-specific command:
-
-@deffn {Config Command} {ch347 device_desc} description
-If specified connect to a device which exactly has this product description
-string. If not specified the first found device with the correct vendor
-and product ID will be connected.
-@example
-ch347 device_desc "EasyDevKit"
-@end example
-@end deffn
@end deffn
@deffn {Interface Driver} {cklink}
diff --git a/src/jtag/drivers/ch347.c b/src/jtag/drivers/ch347.c
index 31762eb47..0a33dbdf0 100644
--- a/src/jtag/drivers/ch347.c
+++ b/src/jtag/drivers/ch347.c
@@ -255,7 +255,6 @@ static bool swd_mode;
static uint16_t default_ch347_vids[] = {DEFAULT_VENDOR_ID, DEFAULT_VENDOR_ID, DEFAULT_VENDOR_ID, 0};
static uint16_t default_ch347_pids[] = {DEFAULT_CH347T_PRODUCT_ID,
DEFAULT_CH347F_PRODUCT_ID, DEFAULT_OTHER_PRODUCT_ID, 0};
-static char *ch347_device_desc;
static uint8_t ch347_activity_led_gpio_pin = 0xFF;
static bool ch347_activity_led_active_high;
static struct ch347_info ch347;
@@ -1426,7 +1425,8 @@ static int ch347_open_device(void)
ch347_pids = adapter_usb_get_pids();
}
- int retval = jtag_libusb_open(ch347_vids, ch347_pids, ch347_device_desc, &ch347_handle, NULL);
+ int retval = jtag_libusb_open(ch347_vids, ch347_pids,
+ adapter_usb_get_product_name(), &ch347_handle, NULL);
if (retval != ERROR_OK) {
char error_message[256];
snprintf(error_message, sizeof(error_message), "CH347 not found. Tried VID/PID pairs: ");
@@ -1776,38 +1776,11 @@ static int ch347_speed_get_index(int khz, int *speed_idx)
return ERROR_OK;
}
-/**
- * @brief The command handler for setting the device description that should be found
- *
- * @return ERROR_OK at success; ERROR_COMMAND_SYNTAX_ERROR otherwise
- */
-COMMAND_HANDLER(ch347_handle_device_desc_command)
-{
- if (CMD_ARGC != 1)
- return ERROR_COMMAND_SYNTAX_ERROR;
-
- free(ch347_device_desc);
- ch347_device_desc = strdup(CMD_ARGV[0]);
- return ERROR_OK;
-}
-
-static const struct command_registration ch347_subcommand_handlers[] = {
- {
- .name = "device_desc",
- .handler = &ch347_handle_device_desc_command,
- .mode = COMMAND_CONFIG,
- .help = "set the USB device description of the CH347 device",
- .usage = "description_string",
- },
- COMMAND_REGISTRATION_DONE
-};
-
static const struct command_registration ch347_command_handlers[] = {
{
.name = "ch347",
.mode = COMMAND_ANY,
.help = "perform ch347 management",
- .chain = ch347_subcommand_handlers,
.usage = "",
},
COMMAND_REGISTRATION_DONE
diff --git a/tcl/board/easydevkits/esp32-wrover-e-wch-jtag-devkit.cfg b/tcl/board/easydevkits/esp32-wrover-e-wch-jtag-devkit.cfg
index 53a4098f0..491fe533d 100644
--- a/tcl/board/easydevkits/esp32-wrover-e-wch-jtag-devkit.cfg
+++ b/tcl/board/easydevkits/esp32-wrover-e-wch-jtag-devkit.cfg
@@ -12,7 +12,7 @@ adapter driver ch347
# Identify the device
adapter usb vid_pid 0x1a86 0x55dd
-ch347 device_desc "EasyDevKit"
+adapter usb product_name "EasyDevKit"
# Configure activity LED
# Note: The LED is active-low on GPIO4.
-----------------------------------------------------------------------
Summary of changes:
doc/openocd.texi | 11 --------
src/jtag/drivers/ch347.c | 31 ++--------------------
.../easydevkits/esp32-wrover-e-wch-jtag-devkit.cfg | 2 +-
3 files changed, 3 insertions(+), 41 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-05-17 20:56:09
|
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 e4941a039789227666d5fa2799613db0ca1c7d74 (commit)
from a41341bbf7f1e06910ce967b7e199cf64ab77c3a (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 e4941a039789227666d5fa2799613db0ca1c7d74
Author: Marc Schink <de...@za...>
Date: Mon Apr 27 07:59:25 2026 +0200
adapter/ftdi: Use adapter core USB product name handling
Use the USB product name handling provided by the adapter core instead
of having it in the driver code itself.
Keep the legacy 'ftdi device_desc' command for backwards compatibility,
but mark it as deprecated.
Change-Id: I2948c576c5fa2cc1ca3cf87bb35049279b27f230
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9609
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/doc/openocd.texi b/doc/openocd.texi
index 76499deb7..361a024f3 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -2767,12 +2767,6 @@ signal. The following output buffer configurations are supported:
These interfaces have several commands, used to configure the driver
before initializing the JTAG scan chain:
-@deffn {Config Command} {ftdi device_desc} description
-Provides the USB device description (the @emph{iProduct string})
-of the adapter. If not specified, the device description is ignored
-during device selection.
-@end deffn
-
@deffn {Config Command} {ftdi channel} channel
Selects the channel of the FTDI device to use for MPSSE operations. Most
adapters use the default, channel 0, but there are exceptions.
diff --git a/src/jtag/drivers/ftdi.c b/src/jtag/drivers/ftdi.c
index 9f32c2ab5..159aa9eca 100644
--- a/src/jtag/drivers/ftdi.c
+++ b/src/jtag/drivers/ftdi.c
@@ -89,7 +89,6 @@
#define JTAG_MODE_ALT (LSB_FIRST | NEG_EDGE_IN | NEG_EDGE_OUT)
#define SWD_MODE (LSB_FIRST | POS_EDGE_IN | NEG_EDGE_OUT)
-static char *ftdi_device_desc;
static uint8_t ftdi_channel;
static uint8_t ftdi_jtag_mode = JTAG_MODE;
@@ -735,7 +734,7 @@ static int ftdi_initialize(void)
}
mpsse_ctx = mpsse_open(adapter_usb_get_vids(), adapter_usb_get_pids(),
- ftdi_device_desc, adapter_get_required_serial(),
+ adapter_usb_get_product_name(), adapter_get_required_serial(),
adapter_usb_get_location(), ftdi_channel);
if (!mpsse_ctx)
return ERROR_JTAG_INIT_FAILED;
@@ -791,8 +790,6 @@ static int ftdi_quit(void)
sig = next;
}
- free(ftdi_device_desc);
-
free(swd_cmd_queue);
return ERROR_OK;
@@ -1078,18 +1075,6 @@ static void cjtag_reset_online_activate(void)
}
#endif /* #if BUILD_FTDI_CJTAG == 1 */
-COMMAND_HANDLER(ftdi_handle_device_desc_command)
-{
- if (CMD_ARGC == 1) {
- free(ftdi_device_desc);
- ftdi_device_desc = strdup(CMD_ARGV[0]);
- } else {
- LOG_ERROR("expected exactly one argument to ftdi device_desc <description>");
- }
-
- return ERROR_OK;
-}
-
COMMAND_HANDLER(ftdi_handle_channel_command)
{
if (CMD_ARGC == 1)
@@ -1286,13 +1271,6 @@ COMMAND_HANDLER(ftdi_handle_jscan3_mode_command)
#endif
static const struct command_registration ftdi_subcommand_handlers[] = {
- {
- .name = "device_desc",
- .handler = &ftdi_handle_device_desc_command,
- .mode = COMMAND_CONFIG,
- .help = "set the USB device description of the FTDI device",
- .usage = "description_string",
- },
{
.name = "channel",
.handler = &ftdi_handle_channel_command,
diff --git a/src/jtag/startup.tcl b/src/jtag/startup.tcl
index 995a289b0..2706c752f 100644
--- a/src/jtag/startup.tcl
+++ b/src/jtag/startup.tcl
@@ -276,10 +276,16 @@ proc "hla newtap" {args} {
eval swj_newdap $args
}
+lappend _telnet_autocomplete_skip "ftdi device_desc"
+proc "ftdi device_desc" args {
+ echo "DEPRECATED! use 'adapter usb product_name' not 'ftdi device_desc'"
+ eval adapter usb product_name $args
+}
+
lappend _telnet_autocomplete_skip ftdi_device_desc
proc ftdi_device_desc args {
- echo "DEPRECATED! use 'ftdi device_desc' not 'ftdi_device_desc'"
- eval ftdi device_desc $args
+ echo "DEPRECATED! use 'adapter usb product_name' not 'ftdi_device_desc'"
+ eval adapter usb product_name $args
}
lappend _telnet_autocomplete_skip ftdi_serial
diff --git a/tcl/board/calao-usb-a9260.cfg b/tcl/board/calao-usb-a9260.cfg
index 26aa535ee..662db345c 100644
--- a/tcl/board/calao-usb-a9260.cfg
+++ b/tcl/board/calao-usb-a9260.cfg
@@ -3,7 +3,7 @@
# CALAO Systems USB-A9260 (C01 and C02)
adapter driver ftdi
-ftdi device_desc "USB-A9260"
+adapter usb product_name "USB-A9260"
adapter usb vid_pid 0x0403 0x6001 0x0403 0x6010
ftdi layout_init 0x0c08 0x0f1b
ftdi layout_signal nTRST -data 0x0100 -noe 0x0400
diff --git a/tcl/board/calao-usb-a9g20-c01.cfg b/tcl/board/calao-usb-a9g20-c01.cfg
index 49d368d8a..214f93b47 100644
--- a/tcl/board/calao-usb-a9g20-c01.cfg
+++ b/tcl/board/calao-usb-a9g20-c01.cfg
@@ -4,7 +4,7 @@
# Authors: Gregory Hermant, Jean-Christophe PLAGNIOL-VILLARD, Wolfram Sang
adapter driver ftdi
-ftdi device_desc "USB-A9G20"
+adapter usb product_name "USB-A9G20"
adapter usb vid_pid 0x0403 0x6010
ftdi layout_init 0x0c08 0x0f1b
ftdi layout_signal nTRST -data 0x0100 -noe 0x0400
diff --git a/tcl/board/digilent_analog_discovery.cfg b/tcl/board/digilent_analog_discovery.cfg
index fcad50496..453a9dd7d 100644
--- a/tcl/board/digilent_analog_discovery.cfg
+++ b/tcl/board/digilent_analog_discovery.cfg
@@ -10,7 +10,7 @@
#
adapter driver ftdi
-ftdi device_desc "Digilent USB Device"
+adapter usb product_name "Digilent USB Device"
adapter usb vid_pid 0x0403 0x6014
ftdi layout_init 0x8008 0x800b
diff --git a/tcl/board/digilent_anvyl.cfg b/tcl/board/digilent_anvyl.cfg
index 5982ffe78..cd4be2a61 100644
--- a/tcl/board/digilent_anvyl.cfg
+++ b/tcl/board/digilent_anvyl.cfg
@@ -7,7 +7,7 @@
adapter driver ftdi
adapter speed 30000
-ftdi device_desc "Digilent USB Device"
+adapter usb product_name "Digilent USB Device"
adapter usb vid_pid 0x0403 0x6010
# channel 0 is the JTAG channel
diff --git a/tcl/board/digilent_nexys_video.cfg b/tcl/board/digilent_nexys_video.cfg
index 50e529247..dd84b89bd 100644
--- a/tcl/board/digilent_nexys_video.cfg
+++ b/tcl/board/digilent_nexys_video.cfg
@@ -6,7 +6,7 @@
adapter driver ftdi
adapter speed 30000
-ftdi device_desc "Digilent USB Device"
+adapter usb product_name "Digilent USB Device"
adapter usb vid_pid 0x0403 0x6010
# channel 0 is dedicated for Digilent's DPTI Interface
diff --git a/tcl/board/digilent_zybo.cfg b/tcl/board/digilent_zybo.cfg
index ad2797861..ed990dc4a 100644
--- a/tcl/board/digilent_zybo.cfg
+++ b/tcl/board/digilent_zybo.cfg
@@ -9,7 +9,7 @@
adapter driver ftdi
ftdi channel 0
-#ftdi_device_desc "Digilent Adept USB Device"
+#adapter usb product_name "Digilent Adept USB Device"
adapter usb vid_pid 0x0403 0x6010
ftdi layout_init 0x3088 0x1f8b
ftdi layout_signal nSRST -data 0x3000 -oe 0x1000
diff --git a/tcl/board/easydevkits/esp32-wrover-e-ftdi-jtag-devkit.cfg b/tcl/board/easydevkits/esp32-wrover-e-ftdi-jtag-devkit.cfg
index 57b0852a8..8992e2bbb 100644
--- a/tcl/board/easydevkits/esp32-wrover-e-ftdi-jtag-devkit.cfg
+++ b/tcl/board/easydevkits/esp32-wrover-e-ftdi-jtag-devkit.cfg
@@ -11,7 +11,7 @@
adapter driver ftdi
# Identify the device
-ftdi device_desc "EasyDevKit"
+adapter usb product_name "EasyDevKit"
adapter usb vid_pid 0x0403 0x6010
# interface 0 is JTAG; interface 1 is the uart
ftdi channel 0
diff --git a/tcl/board/kasli.cfg b/tcl/board/kasli.cfg
index 9256d4b57..3c331b170 100644
--- a/tcl/board/kasli.cfg
+++ b/tcl/board/kasli.cfg
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-or-later
adapter driver ftdi
-ftdi device_desc "Quad RS232-HS"
+adapter usb product_name "Quad RS232-HS"
adapter usb vid_pid 0x0403 0x6011
ftdi channel 0
ftdi layout_init 0x0008 0x000b
diff --git a/tcl/board/nds32_corvettef1.cfg b/tcl/board/nds32_corvettef1.cfg
index 0c2114d9e..195977e43 100644
--- a/tcl/board/nds32_corvettef1.cfg
+++ b/tcl/board/nds32_corvettef1.cfg
@@ -7,7 +7,7 @@
adapter speed 10000
adapter driver ftdi
-ftdi device_desc "Dual RS232-HS"
+adapter usb product_name "Dual RS232-HS"
adapter usb vid_pid 0x0403 0x6010
ftdi layout_init 0x0c08 0x0f1b
diff --git a/tcl/board/numato_mimas_a7.cfg b/tcl/board/numato_mimas_a7.cfg
index 5f795a1b6..0a357a64f 100644
--- a/tcl/board/numato_mimas_a7.cfg
+++ b/tcl/board/numato_mimas_a7.cfg
@@ -10,7 +10,7 @@
# Therefore, prefer external power supply.
adapter driver ftdi
-ftdi device_desc "Mimas Artix 7 FPGA Module"
+adapter usb product_name "Mimas Artix 7 FPGA Module"
adapter usb vid_pid 0x2a19 0x1009
# channel 0 is for custom purpose by users (like uart, fifo etc)
diff --git a/tcl/board/sayma_amc.cfg b/tcl/board/sayma_amc.cfg
index 2323cf72a..665bd3153 100644
--- a/tcl/board/sayma_amc.cfg
+++ b/tcl/board/sayma_amc.cfg
@@ -13,7 +13,7 @@
# which features an Artix 7 FPGA.
adapter driver ftdi
-ftdi device_desc "Quad RS232-HS"
+adapter usb product_name "Quad RS232-HS"
adapter usb vid_pid 0x0403 0x6011
ftdi channel 0
# Use this to distinguish multiple boards by topology
diff --git a/tcl/board/sifive/hifive1.cfg b/tcl/board/sifive/hifive1.cfg
index 07e654139..fbe096179 100644
--- a/tcl/board/sifive/hifive1.cfg
+++ b/tcl/board/sifive/hifive1.cfg
@@ -3,7 +3,7 @@
adapter speed 10000
adapter driver ftdi
-ftdi device_desc "Dual RS232-HS"
+adapter usb product_name "Dual RS232-HS"
adapter usb vid_pid 0x0403 0x6010
ftdi layout_init 0x0008 0x001b
diff --git a/tcl/interface/ftdi/100ask-openjtag.cfg b/tcl/interface/ftdi/100ask-openjtag.cfg
index 272d60201..452b4585f 100644
--- a/tcl/interface/ftdi/100ask-openjtag.cfg
+++ b/tcl/interface/ftdi/100ask-openjtag.cfg
@@ -10,7 +10,7 @@
#
adapter driver ftdi
-ftdi device_desc "USB<=>JTAG&RS232"
+adapter usb product_name "USB<=>JTAG&RS232"
adapter usb vid_pid 0x1457 0x5118
ftdi layout_init 0x0f08 0x0f1b
diff --git a/tcl/interface/ftdi/ashling-opella-ld-jtag.cfg b/tcl/interface/ftdi/ashling-opella-ld-jtag.cfg
index 6ea042777..f17589732 100644
--- a/tcl/interface/ftdi/ashling-opella-ld-jtag.cfg
+++ b/tcl/interface/ftdi/ashling-opella-ld-jtag.cfg
@@ -6,7 +6,7 @@
#
adapter driver ftdi
-ftdi device_desc "Opella-LD Debug Probe"
+adapter usb product_name "Opella-LD Debug Probe"
adapter usb vid_pid 0x0B6B 0x0040
ftdi tdo_sample_edge falling
ftdi layout_init 0x0A68 0xFF7B
diff --git a/tcl/interface/ftdi/ashling-opella-ld-swd.cfg b/tcl/interface/ftdi/ashling-opella-ld-swd.cfg
index 107e1b146..1d960efc0 100644
--- a/tcl/interface/ftdi/ashling-opella-ld-swd.cfg
+++ b/tcl/interface/ftdi/ashling-opella-ld-swd.cfg
@@ -6,7 +6,7 @@
#
adapter driver ftdi
-ftdi device_desc "Opella-LD Debug Probe"
+adapter usb product_name "Opella-LD Debug Probe"
adapter usb vid_pid 0x0B6B 0x0040
ftdi layout_init 0x0860 0x0b7b
ftdi channel 0
diff --git a/tcl/interface/ftdi/axm0432.cfg b/tcl/interface/ftdi/axm0432.cfg
index 590d9f239..e0a99ba63 100644
--- a/tcl/interface/ftdi/axm0432.cfg
+++ b/tcl/interface/ftdi/axm0432.cfg
@@ -12,7 +12,7 @@ echo "Please report your experience with this file to openocd-devel mailing list
echo "so it could be marked as working or fixed."
adapter driver ftdi
-ftdi device_desc "Symphony SoundBite"
+adapter usb product_name "Symphony SoundBite"
adapter usb vid_pid 0x0403 0x6010
ftdi layout_init 0x0c08 0x0c2b
diff --git a/tcl/interface/ftdi/c232hm.cfg b/tcl/interface/ftdi/c232hm.cfg
index 43340e9b8..fc78895fc 100644
--- a/tcl/interface/ftdi/c232hm.cfg
+++ b/tcl/interface/ftdi/c232hm.cfg
@@ -16,8 +16,8 @@
# http://www.ftdichip.com/Support/Documents/AppNotes/AN_129_FTDI_Hi_Speed_USB_To_JTAG_Example.pdf
adapter driver ftdi
-#ftdi device_desc "C232HM-DDHSL-0"
-#ftdi device_desc "C232HM-EDHSL-0"
+#adapter usb product_name "C232HM-DDHSL-0"
+#adapter usb product_name "C232HM-EDHSL-0"
# Common PID for FT232H
adapter usb vid_pid 0x0403 0x6014
diff --git a/tcl/interface/ftdi/cortino.cfg b/tcl/interface/ftdi/cortino.cfg
index 6e4f6e56e..1c28e2a64 100644
--- a/tcl/interface/ftdi/cortino.cfg
+++ b/tcl/interface/ftdi/cortino.cfg
@@ -7,7 +7,7 @@
#
adapter driver ftdi
-ftdi device_desc "Cortino"
+adapter usb product_name "Cortino"
adapter usb vid_pid 0x0640 0x0032
ftdi layout_init 0x0108 0x010b
diff --git a/tcl/interface/ftdi/digilent-hs1.cfg b/tcl/interface/ftdi/digilent-hs1.cfg
index 5a418fd64..e3021701c 100644
--- a/tcl/interface/ftdi/digilent-hs1.cfg
+++ b/tcl/interface/ftdi/digilent-hs1.cfg
@@ -4,7 +4,7 @@
# (the later being the OEM on-board version)
adapter driver ftdi
-ftdi device_desc "Digilent Adept USB Device"
+adapter usb product_name "Digilent Adept USB Device"
adapter usb vid_pid 0x0403 0x6010
# channel 1 does not have any functionality
ftdi channel 0
diff --git a/tcl/interface/ftdi/digilent-hs2.cfg b/tcl/interface/ftdi/digilent-hs2.cfg
index 4652d62e4..83f1a7446 100644
--- a/tcl/interface/ftdi/digilent-hs2.cfg
+++ b/tcl/interface/ftdi/digilent-hs2.cfg
@@ -7,7 +7,7 @@
# ACBUS5=SEL_TDO controls mux to TDO input: 0=TDO 1=TMS
adapter driver ftdi
-ftdi device_desc "Digilent Adept USB Device"
+adapter usb product_name "Digilent Adept USB Device"
adapter usb vid_pid 0x0403 0x6014
ftdi channel 0
diff --git a/tcl/interface/ftdi/digilent_jtag_hs3.cfg b/tcl/interface/ftdi/digilent_jtag_hs3.cfg
index fc45650ba..9834c6ae5 100644
--- a/tcl/interface/ftdi/digilent_jtag_hs3.cfg
+++ b/tcl/interface/ftdi/digilent_jtag_hs3.cfg
@@ -6,7 +6,7 @@
adapter driver ftdi
adapter usb vid_pid 0x0403 0x6014
-ftdi device_desc "Digilent USB Device"
+adapter usb product_name "Digilent USB Device"
# From Digilent support:
# The SRST pin is [...] 0x20 and 0x10 is the /OE (active low output enable)
diff --git a/tcl/interface/ftdi/digilent_jtag_smt2_nc.cfg b/tcl/interface/ftdi/digilent_jtag_smt2_nc.cfg
index 5abd31602..439fe41d5 100644
--- a/tcl/interface/ftdi/digilent_jtag_smt2_nc.cfg
+++ b/tcl/interface/ftdi/digilent_jtag_smt2_nc.cfg
@@ -10,10 +10,10 @@
# https://www.xilinx.com/products/boards-and-kits/kcu105.html#documentation
#
# Note that the digilent_jtag_smt2 layout does not work and hangs while
-# the ftdi device_desc from digilent_hs2 is wrong.
+# the adapter usb product_name from digilent_hs2 is wrong.
adapter driver ftdi
-ftdi device_desc "Digilent USB Device"
+adapter usb product_name "Digilent USB Device"
adapter usb vid_pid 0x0403 0x6014
ftdi channel 0
ftdi layout_init 0x00e8 0x60eb
diff --git a/tcl/interface/ftdi/dlp-usb1232h.cfg b/tcl/interface/ftdi/dlp-usb1232h.cfg
index ce855d8b7..96802af3a 100644
--- a/tcl/interface/ftdi/dlp-usb1232h.cfg
+++ b/tcl/interface/ftdi/dlp-usb1232h.cfg
@@ -15,7 +15,7 @@ echo "in ft2232.c. Please report your experience with this file to openocd-devel
echo "mailing list, so it could be marked as working or fixed."
adapter driver ftdi
-ftdi device_desc "Dual RS232-HS"
+adapter usb product_name "Dual RS232-HS"
adapter usb vid_pid 0x0403 0x6010
ftdi layout_init 0x0008 0x000b
diff --git a/tcl/interface/ftdi/dp_busblaster.cfg b/tcl/interface/ftdi/dp_busblaster.cfg
index 8c6f6c276..7269f31fb 100644
--- a/tcl/interface/ftdi/dp_busblaster.cfg
+++ b/tcl/interface/ftdi/dp_busblaster.cfg
@@ -14,7 +14,7 @@ echo "Info : If you need SWD support, flash KT-Link buffer from https://github.c
and use dp_busblaster_kt-link.cfg instead"
adapter driver ftdi
-ftdi device_desc "Dual RS232-HS"
+adapter usb product_name "Dual RS232-HS"
adapter usb vid_pid 0x0403 0x6010
ftdi layout_init 0x0c08 0x0f1b
diff --git a/tcl/interface/ftdi/dp_busblaster_kt-link.cfg b/tcl/interface/ftdi/dp_busblaster_kt-link.cfg
index 20b79a8a0..cbe2b1f2d 100644
--- a/tcl/interface/ftdi/dp_busblaster_kt-link.cfg
+++ b/tcl/interface/ftdi/dp_busblaster_kt-link.cfg
@@ -12,7 +12,7 @@
#
adapter driver ftdi
-ftdi device_desc "Dual RS232-HS"
+adapter usb product_name "Dual RS232-HS"
adapter usb vid_pid 0x0403 0x6010
ftdi layout_init 0x8c28 0xff3b
diff --git a/tcl/interface/ftdi/flossjtag-noeeprom.cfg b/tcl/interface/ftdi/flossjtag-noeeprom.cfg
index 658c0dfd7..e98c9e1cb 100644
--- a/tcl/interface/ftdi/flossjtag-noeeprom.cfg
+++ b/tcl/interface/ftdi/flossjtag-noeeprom.cfg
@@ -20,7 +20,7 @@ echo "Please report your experience with this file to openocd-devel mailing list
echo "so it could be marked as working or fixed."
adapter driver ftdi
-ftdi device_desc "Dual RS232-HS"
+adapter usb product_name "Dual RS232-HS"
adapter usb vid_pid 0x0403 0x6010
ftdi layout_init 0x0008 0x000b
diff --git a/tcl/interface/ftdi/flossjtag.cfg b/tcl/interface/ftdi/flossjtag.cfg
index 13c413638..f67d1e825 100644
--- a/tcl/interface/ftdi/flossjtag.cfg
+++ b/tcl/interface/ftdi/flossjtag.cfg
@@ -21,7 +21,7 @@ echo "so it could be marked as working or fixed."
adapter driver ftdi
adapter usb vid_pid 0x0403 0x6010
-ftdi device_desc "FLOSS-JTAG"
+adapter usb product_name "FLOSS-JTAG"
# adapter serial "FJ000001"
ftdi layout_init 0x0008 0x180b
diff --git a/tcl/interface/ftdi/flyswatter.cfg b/tcl/interface/ftdi/flyswatter.cfg
index 9f59542c3..4cbca3e39 100644
--- a/tcl/interface/ftdi/flyswatter.cfg
+++ b/tcl/interface/ftdi/flyswatter.cfg
@@ -7,7 +7,7 @@
#
adapter driver ftdi
-ftdi device_desc "Flyswatter"
+adapter usb product_name "Flyswatter"
adapter usb vid_pid 0x0403 0x6010
ftdi layout_init 0x0818 0x0cfb
diff --git a/tcl/interface/ftdi/flyswatter2.cfg b/tcl/interface/ftdi/flyswatter2.cfg
index 4c0a5c3e0..fc0a35757 100644
--- a/tcl/interface/ftdi/flyswatter2.cfg
+++ b/tcl/interface/ftdi/flyswatter2.cfg
@@ -7,7 +7,7 @@
#
adapter driver ftdi
-ftdi device_desc "Flyswatter2"
+adapter usb product_name "Flyswatter2"
adapter usb vid_pid 0x0403 0x6010
ftdi layout_init 0x0538 0x057b
diff --git a/tcl/interface/ftdi/gw16042.cfg b/tcl/interface/ftdi/gw16042.cfg
index 0e7b097d5..b2b8fc5fb 100644
--- a/tcl/interface/ftdi/gw16042.cfg
+++ b/tcl/interface/ftdi/gw16042.cfg
@@ -20,7 +20,7 @@
#
adapter driver ftdi
-ftdi device_desc "USB-JTAG"
+adapter usb product_name "USB-JTAG"
adapter usb vid_pid 0x0403 0x6010
ftdi layout_init 0x0058 0x007b
diff --git a/tcl/interface/ftdi/hie-jtag.cfg b/tcl/interface/ftdi/hie-jtag.cfg
index 155e04138..b85200664 100644
--- a/tcl/interface/ftdi/hie-jtag.cfg
+++ b/tcl/interface/ftdi/hie-jtag.cfg
@@ -8,7 +8,7 @@
adapter driver ftdi
ftdi channel 0
adapter usb vid_pid 0x0403 0x6014
-ftdi device_desc "HIE JTAG Debugger"
+adapter usb product_name "HIE JTAG Debugger"
ftdi layout_init 0x0c08 0x4f1b
diff --git a/tcl/interface/ftdi/hilscher_nxhx10_etm.cfg b/tcl/interface/ftdi/hilscher_nxhx10_etm.cfg
index 17a222b31..bd3d43b8c 100644
--- a/tcl/interface/ftdi/hilscher_nxhx10_etm.cfg
+++ b/tcl/interface/ftdi/hilscher_nxhx10_etm.cfg
@@ -12,7 +12,7 @@ echo "Please report your experience with this file to openocd-devel mailing list
echo "so it could be marked as working or fixed."
adapter driver ftdi
-ftdi device_desc "NXHX 10-ETM"
+adapter usb product_name "NXHX 10-ETM"
adapter usb vid_pid 0x0640 0x0028
ftdi layout_init 0x0308 0x030b
diff --git a/tcl/interface/ftdi/hilscher_nxhx500_etm.cfg b/tcl/interface/ftdi/hilscher_nxhx500_etm.cfg
index 5d5c262b4..0367c2349 100644
--- a/tcl/interface/ftdi/hilscher_nxhx500_etm.cfg
+++ b/tcl/interface/ftdi/hilscher_nxhx500_etm.cfg
@@ -12,7 +12,7 @@ echo "Please report your experience with this file to openocd-devel mailing list
echo "so it could be marked as working or fixed."
adapter driver ftdi
-ftdi device_desc "NXHX 500-ETM"
+adapter usb product_name "NXHX 500-ETM"
adapter usb vid_pid 0x0640 0x0028
ftdi layout_init 0x0308 0x030b
diff --git a/tcl/interface/ftdi/hilscher_nxhx500_re.cfg b/tcl/interface/ftdi/hilscher_nxhx500_re.cfg
index 39afe43f2..1f76d6fa5 100644
--- a/tcl/interface/ftdi/hilscher_nxhx500_re.cfg
+++ b/tcl/interface/ftdi/hilscher_nxhx500_re.cfg
@@ -12,7 +12,7 @@ echo "Please report your experience with this file to openocd-devel mailing list
echo "so it could be marked as working or fixed."
adapter driver ftdi
-ftdi device_desc "NXHX 500-RE"
+adapter usb product_name "NXHX 500-RE"
adapter usb vid_pid 0x0640 0x0028
ftdi layout_init 0x0308 0x030b
diff --git a/tcl/interface/ftdi/hilscher_nxhx50_etm.cfg b/tcl/interface/ftdi/hilscher_nxhx50_etm.cfg
index 0ae708881..5116f2e2c 100644
--- a/tcl/interface/ftdi/hilscher_nxhx50_etm.cfg
+++ b/tcl/interface/ftdi/hilscher_nxhx50_etm.cfg
@@ -12,7 +12,7 @@ echo "Please report your experience with this file to openocd-devel mailing list
echo "so it could be marked as working or fixed."
adapter driver ftdi
-ftdi device_desc "NXHX 50-ETM"
+adapter usb product_name "NXHX 50-ETM"
adapter usb vid_pid 0x0640 0x0028
ftdi layout_init 0x0308 0x030b
diff --git a/tcl/interface/ftdi/hilscher_nxhx50_re.cfg b/tcl/interface/ftdi/hilscher_nxhx50_re.cfg
index fb1bdb2e9..ad45e623b 100644
--- a/tcl/interface/ftdi/hilscher_nxhx50_re.cfg
+++ b/tcl/interface/ftdi/hilscher_nxhx50_re.cfg
@@ -12,7 +12,7 @@ echo "Please report your experience with this file to openocd-devel mailing list
echo "so it could be marked as working or fixed."
adapter driver ftdi
-ftdi device_desc "NXHX50-RE"
+adapter usb product_name "NXHX50-RE"
adapter usb vid_pid 0x0640 0x0028
ftdi layout_init 0x0308 0x030b
diff --git a/tcl/interface/ftdi/hitex_lpc1768stick.cfg b/tcl/interface/ftdi/hitex_lpc1768stick.cfg
index 3d3220195..31c3a7017 100644
--- a/tcl/interface/ftdi/hitex_lpc1768stick.cfg
+++ b/tcl/interface/ftdi/hitex_lpc1768stick.cfg
@@ -8,7 +8,7 @@
adapter driver ftdi
-ftdi device_desc "LPC1768-Stick"
+adapter usb product_name "LPC1768-Stick"
adapter usb vid_pid 0x0640 0x0026
ftdi layout_init 0x0388 0x038b
diff --git a/tcl/interface/ftdi/hitex_str9-comstick.cfg b/tcl/interface/ftdi/hitex_str9-comstick.cfg
index bbeefd15c..0f16a116b 100644
--- a/tcl/interface/ftdi/hitex_str9-comstick.cfg
+++ b/tcl/interface/ftdi/hitex_str9-comstick.cfg
@@ -7,7 +7,7 @@
#
adapter driver ftdi
-ftdi device_desc "STR9-comStick"
+adapter usb product_name "STR9-comStick"
adapter usb vid_pid 0x0640 0x002c
ftdi layout_init 0x0108 0x010b
diff --git a/tcl/interface/ftdi/icebear.cfg b/tcl/interface/ftdi/icebear.cfg
index 230d8af0c..c7c95f1be 100644
--- a/tcl/interface/ftdi/icebear.cfg
+++ b/tcl/interface/ftdi/icebear.cfg
@@ -12,7 +12,7 @@ echo "Please report your experience with this file to openocd-devel mailing list
echo "so it could be marked as working or fixed."
adapter driver ftdi
-ftdi device_desc "ICEbear JTAG adapter"
+adapter usb product_name "ICEbear JTAG adapter"
adapter usb vid_pid 0x0403 0xc140
ftdi layout_init 0x0028 0x002b
diff --git a/tcl/interface/ftdi/jtag-lock-pick_tiny_2.cfg b/tcl/interface/ftdi/jtag-lock-pick_tiny_2.cfg
index 74d4f55a9..f955e817a 100644
--- a/tcl/interface/ftdi/jtag-lock-pick_tiny_2.cfg
+++ b/tcl/interface/ftdi/jtag-lock-pick_tiny_2.cfg
@@ -7,7 +7,7 @@
#
adapter driver ftdi
-ftdi device_desc "JTAG-lock-pick Tiny 2"
+adapter usb product_name "JTAG-lock-pick Tiny 2"
adapter usb vid_pid 0x0403 0x8220
ftdi layout_init 0x8c28 0xff3b
diff --git a/tcl/interface/ftdi/jtagkey.cfg b/tcl/interface/ftdi/jtagkey.cfg
index a066cf5e8..25b64466e 100644
--- a/tcl/interface/ftdi/jtagkey.cfg
+++ b/tcl/interface/ftdi/jtagkey.cfg
@@ -7,7 +7,7 @@
#
adapter driver ftdi
-ftdi device_desc "Amontec JTAGkey"
+adapter usb product_name "Amontec JTAGkey"
adapter usb vid_pid 0x0403 0xcff8
ftdi layout_init 0x0c08 0x0f1b
diff --git a/tcl/interface/ftdi/jtagkey2.cfg b/tcl/interface/ftdi/jtagkey2.cfg
index 68a8fe228..36da3d38d 100644
--- a/tcl/interface/ftdi/jtagkey2.cfg
+++ b/tcl/interface/ftdi/jtagkey2.cfg
@@ -7,7 +7,7 @@
#
adapter driver ftdi
-ftdi device_desc "Amontec JTAGkey-2"
+adapter usb product_name "Amontec JTAGkey-2"
adapter usb vid_pid 0x0403 0xcff8
ftdi layout_init 0x0c08 0x0f1b
diff --git a/tcl/interface/ftdi/jtagkey2p.cfg b/tcl/interface/ftdi/jtagkey2p.cfg
index 72ab634fb..3a661a1d4 100644
--- a/tcl/interface/ftdi/jtagkey2p.cfg
+++ b/tcl/interface/ftdi/jtagkey2p.cfg
@@ -7,7 +7,7 @@
#
adapter driver ftdi
-ftdi device_desc "Amontec JTAGkey-2P"
+adapter usb product_name "Amontec JTAGkey-2P"
adapter usb vid_pid 0x0403 0xcff8
ftdi layout_init 0x0c08 0x0f1b
diff --git a/tcl/interface/ftdi/kt-link.cfg b/tcl/interface/ftdi/kt-link.cfg
index 60a9bdd9e..4787724cf 100644
--- a/tcl/interface/ftdi/kt-link.cfg
+++ b/tcl/interface/ftdi/kt-link.cfg
@@ -7,7 +7,7 @@
#
adapter driver ftdi
-ftdi device_desc "KT-LINK"
+adapter usb product_name "KT-LINK"
adapter usb vid_pid 0x0403 0xbbe2
ftdi layout_init 0x8c28 0xff3b
diff --git a/tcl/interface/ftdi/lambdaconcept_ecpix-5.cfg b/tcl/interface/ftdi/lambdaconcept_ecpix-5.cfg
index 7a79183a2..2976b0f2a 100644
--- a/tcl/interface/ftdi/lambdaconcept_ecpix-5.cfg
+++ b/tcl/interface/ftdi/lambdaconcept_ecpix-5.cfg
@@ -7,7 +7,7 @@
adapter driver ftdi
adapter speed 10000
-ftdi device_desc "Dual RS232-HS"
+adapter usb product_name "Dual RS232-HS"
adapter usb vid_pid 0x0403 0x6010
ftdi layout_init 0xfff8 0xfffb
diff --git a/tcl/interface/ftdi/lisa-l.cfg b/tcl/interface/ftdi/lisa-l.cfg
index e35e8ce09..f90fb7152 100644
--- a/tcl/interface/ftdi/lisa-l.cfg
+++ b/tcl/interface/ftdi/lisa-l.cfg
@@ -12,7 +12,7 @@ echo "in ft2232.c. Please report your experience with this file to openocd-devel
echo "mailing list, so it could be marked as working or fixed."
adapter driver ftdi
-ftdi device_desc "Lisa/L"
+adapter usb product_name "Lisa/L"
adapter usb vid_pid 0x0403 0x6010
ftdi channel 1
diff --git a/tcl/interface/ftdi/luminary-icdi.cfg b/tcl/interface/ftdi/luminary-icdi.cfg
index ffc92b6d9..238adf57f 100644
--- a/tcl/interface/ftdi/luminary-icdi.cfg
+++ b/tcl/interface/ftdi/luminary-icdi.cfg
@@ -18,7 +18,7 @@
#
adapter driver ftdi
-ftdi device_desc "Luminary Micro ICDI Board"
+adapter usb product_name "Luminary Micro ICDI Board"
adapter usb vid_pid 0x0403 0xbcda
ftdi layout_init 0x00a8 0x00eb
diff --git a/tcl/interface/ftdi/luminary-lm3s811.cfg b/tcl/interface/ftdi/luminary-lm3s811.cfg
index bf9b2aa64..dcbc0cdfe 100644
--- a/tcl/interface/ftdi/luminary-lm3s811.cfg
+++ b/tcl/interface/ftdi/luminary-lm3s811.cfg
@@ -14,7 +14,7 @@
#
adapter driver ftdi
-ftdi device_desc "LM3S811 Evaluation Board"
+adapter usb product_name "LM3S811 Evaluation Board"
adapter usb vid_pid 0x0403 0xbcd9
ftdi layout_init 0x0088 0x008b
diff --git a/tcl/interface/ftdi/luminary.cfg b/tcl/interface/ftdi/luminary.cfg
index f34d74fca..fd5403476 100644
--- a/tcl/interface/ftdi/luminary.cfg
+++ b/tcl/interface/ftdi/luminary.cfg
@@ -27,7 +27,7 @@
#
adapter driver ftdi
-ftdi device_desc "Stellaris Evaluation Board"
+adapter usb product_name "Stellaris Evaluation Board"
adapter usb vid_pid 0x0403 0xbcd9
ftdi layout_init 0x00a8 0x00eb
diff --git a/tcl/interface/ftdi/m53evk.cfg b/tcl/interface/ftdi/m53evk.cfg
index 409d62ed6..cb2542faa 100644
--- a/tcl/interface/ftdi/m53evk.cfg
+++ b/tcl/interface/ftdi/m53evk.cfg
@@ -7,7 +7,7 @@
#
adapter driver ftdi
-ftdi device_desc "Dual RS232-HS"
+adapter usb product_name "Dual RS232-HS"
adapter usb vid_pid 0x0403 0x6010
ftdi channel 0
diff --git a/tcl/interface/ftdi/mbftdi.cfg b/tcl/interface/ftdi/mbftdi.cfg
index dc9f2ca69..1bdebb4e5 100644
--- a/tcl/interface/ftdi/mbftdi.cfg
+++ b/tcl/interface/ftdi/mbftdi.cfg
@@ -12,7 +12,7 @@
#
adapter driver ftdi
-ftdi device_desc "Dual RS232-HS"
+adapter usb product_name "Dual RS232-HS"
adapter usb vid_pid 0x0403 0x6010
ftdi layout_init 0x0008 0x000b
diff --git a/tcl/interface/ftdi/minimodule-swd.cfg b/tcl/interface/ftdi/minimodule-swd.cfg
index 8d21503e5..aca361a91 100644
--- a/tcl/interface/ftdi/minimodule-swd.cfg
+++ b/tcl/interface/ftdi/minimodule-swd.cfg
@@ -40,11 +40,11 @@ adapter driver ftdi
#Select your module type and channel
-#ftdi device_desc "FT2232H MiniModule"
+#adapter usb product_name "FT2232H MiniModule"
adapter usb vid_pid 0x0403 0x6010
#ftdi channel 1
-#ftdi device_desc "FT4232H MiniModule"
+#adapter usb product_name "FT4232H MiniModule"
#adapter usb vid_pid 0x0403 0x6011
#ftdi channel 1
diff --git a/tcl/interface/ftdi/minimodule.cfg b/tcl/interface/ftdi/minimodule.cfg
index 4adad7885..cfd18af7a 100644
--- a/tcl/interface/ftdi/minimodule.cfg
+++ b/tcl/interface/ftdi/minimodule.cfg
@@ -7,7 +7,7 @@
#
adapter driver ftdi
-ftdi device_desc "FT2232H MiniModule"
+adapter usb product_name "FT2232H MiniModule"
adapter usb vid_pid 0x0403 0x6010
# Every pin set as high impedance except TCK, TDI, TDO and TMS
diff --git a/tcl/interface/ftdi/minispartan6.cfg b/tcl/interface/ftdi/minispartan6.cfg
index c22886c14..74b13bfb2 100644
--- a/tcl/interface/ftdi/minispartan6.cfg
+++ b/tcl/interface/ftdi/minispartan6.cfg
@@ -5,7 +5,7 @@
adapter driver ftdi
# The miniSpartan6+ sadly doesn't have a custom device description, so we just
# have to hope you got it right.
-#ftdi device_desc "Dual RS232-HS"
+#adapter usb product_name "Dual RS232-HS"
adapter usb vid_pid 0x0403 0x6010
# interface 1 is the uart
ftdi channel 0
diff --git a/tcl/interface/ftdi/miniwiggler.cfg b/tcl/interface/ftdi/miniwiggler.cfg
index e6d6903ca..a10ec49d3 100644
--- a/tcl/interface/ftdi/miniwiggler.cfg
+++ b/tcl/interface/ftdi/miniwiggler.cfg
@@ -25,7 +25,7 @@
#
adapter driver ftdi
-ftdi device_desc "DAS JDS miniWiggler V3.1"
+adapter usb product_name "DAS JDS miniWiggler V3.1"
adapter usb vid_pid 0x058b 0x0043
ftdi channel 0
diff --git a/tcl/interface/ftdi/neodb.cfg b/tcl/interface/ftdi/neodb.cfg
index 42babc2b9..9b90823a3 100644
--- a/tcl/interface/ftdi/neodb.cfg
+++ b/tcl/interface/ftdi/neodb.cfg
@@ -7,7 +7,7 @@
#
adapter driver ftdi
-ftdi device_desc "Debug Board for Neo1973"
+adapter usb product_name "Debug Board for Neo1973"
adapter usb vid_pid 0x1457 0x5118
ftdi layout_init 0x0508 0x0f1b
diff --git a/tcl/interface/ftdi/ngxtech.cfg b/tcl/interface/ftdi/ngxtech.cfg
index e961defcc..a5825c83f 100644
--- a/tcl/interface/ftdi/ngxtech.cfg
+++ b/tcl/interface/ftdi/ngxtech.cfg
@@ -13,7 +13,7 @@ echo "experience with this file to openocd-devel mailing list, so it could be ma
echo "as working or fixed."
adapter driver ftdi
-ftdi device_desc "NGX JTAG"
+adapter usb product_name "NGX JTAG"
adapter usb vid_pid 0x0403 0x6010
ftdi layout_init 0x0508 0x0f1b
diff --git a/tcl/interface/ftdi/olimex-arm-jtag-cjtag.cfg b/tcl/interface/ftdi/olimex-arm-jtag-cjtag.cfg
index abd7d90a3..c782ec3b9 100644
--- a/tcl/interface/ftdi/olimex-arm-jtag-cjtag.cfg
+++ b/tcl/interface/ftdi/olimex-arm-jtag-cjtag.cfg
@@ -13,7 +13,7 @@
interface ftdi
ftdi oscan1_mode on
-ftdi device_desc "Olimex OpenOCD JTAG ARM-USB-TINY-H"
+adapter usb product_name "Olimex OpenOCD JTAG ARM-USB-TINY-H"
adapter usb vid_pid 0x15ba 0x002a
ftdi layout_init 0x0808 0x0a1b
diff --git a/tcl/interface/ftdi/olimex-arm-usb-ocd-h-cjtag.cfg b/tcl/interface/ftdi/olimex-arm-usb-ocd-h-cjtag.cfg
index bbd761388..657fb85f5 100644
--- a/tcl/interface/ftdi/olimex-arm-usb-ocd-h-cjtag.cfg
+++ b/tcl/interface/ftdi/olimex-arm-usb-ocd-h-cjtag.cfg
@@ -8,7 +8,7 @@
interface ftdi
ftdi oscan1_mode on
-ftdi device_desc "Olimex OpenOCD JTAG ARM-USB-OCD-H"
+adapter usb product_name "Olimex OpenOCD JTAG ARM-USB-OCD-H"
adapter usb vid_pid 0x15ba 0x002b
ftdi layout_init 0x0808 0x0a1b
diff --git a/tcl/interface/ftdi/olimex-arm-usb-ocd-h.cfg b/tcl/interface/ftdi/olimex-arm-usb-ocd-h.cfg
index a568b8b0b..dd67b6d57 100644
--- a/tcl/interface/ftdi/olimex-arm-usb-ocd-h.cfg
+++ b/tcl/interface/ftdi/olimex-arm-usb-ocd-h.cfg
@@ -7,7 +7,7 @@
#
adapter driver ftdi
-ftdi device_desc "Olimex OpenOCD JTAG ARM-USB-OCD-H"
+adapter usb product_name "Olimex OpenOCD JTAG ARM-USB-OCD-H"
adapter usb vid_pid 0x15ba 0x002b
ftdi layout_init 0x0908 0x0b1b
diff --git a/tcl/interface/ftdi/olimex-arm-usb-ocd.cfg b/tcl/interface/ftdi/olimex-arm-usb-ocd.cfg
index ba5386af1..9d0b0091c 100644
--- a/tcl/interface/ftdi/olimex-arm-usb-ocd.cfg
+++ b/tcl/interface/ftdi/olimex-arm-usb-ocd.cfg
@@ -7,7 +7,7 @@
#
adapter driver ftdi
-ftdi device_desc "Olimex OpenOCD JTAG"
+adapter usb product_name "Olimex OpenOCD JTAG"
adapter usb vid_pid 0x15ba 0x0003
ftdi layout_init 0x0c08 0x0f1b
diff --git a/tcl/interface/ftdi/olimex-arm-usb-tiny-h-cjtag.cfg b/tcl/interface/ftdi/olimex-arm-usb-tiny-h-cjtag.cfg
index bd32b4b48..62ca02c4d 100644
--- a/tcl/interface/ftdi/olimex-arm-usb-tiny-h-cjtag.cfg
+++ b/tcl/interface/ftdi/olimex-arm-usb-tiny-h-cjtag.cfg
@@ -13,7 +13,7 @@
interface ftdi
ftdi oscan1_mode on
-ftdi device_desc "Olimex OpenOCD JTAG ARM-USB-TINY-H"
+adapter usb product_name "Olimex OpenOCD JTAG ARM-USB-TINY-H"
adapter usb vid_pid 0x15ba 0x002a
ftdi layout_init 0x0808 0x0a1b
diff --git a/tcl/interface/ftdi/olimex-arm-usb-tiny-h.cfg b/tcl/interface/ftdi/olimex-arm-usb-tiny-h.cfg
index 1e4397440..e77134848 100644
--- a/tcl/interface/ftdi/olimex-arm-usb-tiny-h.cfg
+++ b/tcl/interface/ftdi/olimex-arm-usb-tiny-h.cfg
@@ -7,7 +7,7 @@
#
adapter driver ftdi
-ftdi device_desc "Olimex OpenOCD JTAG ARM-USB-TINY-H"
+adapter usb product_name "Olimex OpenOCD JTAG ARM-USB-TINY-H"
adapter usb vid_pid 0x15ba 0x002a
ftdi layout_init 0x0808 0x0a1b
diff --git a/tcl/interface/ftdi/olimex-jtag-tiny.cfg b/tcl/interface/ftdi/olimex-jtag-tiny.cfg
index f3a83c8e3..889b4e08b 100644
--- a/tcl/interface/ftdi/olimex-jtag-tiny.cfg
+++ b/tcl/interface/ftdi/olimex-jtag-tiny.cfg
@@ -7,7 +7,7 @@
#
adapter driver ftdi
-ftdi device_desc "Olimex OpenOCD JTAG TINY"
+adapter usb product_name "Olimex OpenOCD JTAG TINY"
adapter usb vid_pid 0x15ba 0x0004
ftdi layout_init 0x0808 0x0a1b
diff --git a/tcl/interface/ftdi/oocdlink.cfg b/tcl/interface/ftdi/oocdlink.cfg
index 226567b70..88f799a1e 100644
--- a/tcl/interface/ftdi/oocdlink.cfg
+++ b/tcl/interface/ftdi/oocdlink.cfg
@@ -13,7 +13,7 @@ echo "experience with this file to openocd-devel mailing list, so it could be ma
echo "as working or fixed."
adapter driver ftdi
-ftdi device_desc "OOCDLink"
+adapter usb product_name "OOCDLink"
adapter usb vid_pid 0x0403 0xbaf8
ftdi layout_init 0x0508 0x0f1b
diff --git a/tcl/interface/ftdi/opendous_ftdi.cfg b/tcl/interface/ftdi/opendous_ftdi.cfg
index 0bd7fdab9..faa3952f6 100644
--- a/tcl/interface/ftdi/opendous_ftdi.cfg
+++ b/tcl/interface/ftdi/opendous_ftdi.cfg
@@ -10,7 +10,7 @@
#
adapter driver ftdi
-ftdi device_desc "Dual RS232-HS"
+adapter usb product_name "Dual RS232-HS"
adapter usb vid_pid 0x0403 0x6010
ftdi channel 1
diff --git a/tcl/interface/ftdi/openocd-usb-hs.cfg b/tcl/interface/ftdi/openocd-usb-hs.cfg
index a270d10fc..4f1ab058d 100644
--- a/tcl/interface/ftdi/openocd-usb-hs.cfg
+++ b/tcl/interface/ftdi/openocd-usb-hs.cfg
@@ -7,7 +7,7 @@
#
adapter driver ftdi
-ftdi device_desc "Dual RS232-HS"
+adapter usb product_name "Dual RS232-HS"
adapter usb vid_pid 0x0403 0x6010
ftdi layout_init 0x0508 0x0f1b
diff --git a/tcl/interface/ftdi/openocd-usb.cfg b/tcl/interface/ftdi/openocd-usb.cfg
index e9dea563c..da39d3660 100644
--- a/tcl/interface/ftdi/openocd-usb.cfg
+++ b/tcl/interface/ftdi/openocd-usb.cfg
@@ -7,7 +7,7 @@
#
adapter driver ftdi
-ftdi device_desc "Dual RS232"
+adapter usb product_name "Dual RS232"
adapter usb vid_pid 0x0403 0x6010
ftdi layout_init 0x0508 0x0f1b
diff --git a/tcl/interface/ftdi/openrd.cfg b/tcl/interface/ftdi/openrd.cfg
index 875ca0a07..19da745ce 100644
--- a/tcl/interface/ftdi/openrd.cfg
+++ b/tcl/interface/ftdi/openrd.cfg
@@ -7,7 +7,7 @@
#
adapter driver ftdi
-ftdi device_desc "OpenRD JTAGKey FT2232D B"
+adapter usb product_name "OpenRD JTAGKey FT2232D B"
adapter usb vid_pid 0x0403 0x9e90
ftdi channel 0
diff --git a/tcl/interface/ftdi/pipistrello.cfg b/tcl/interface/ftdi/pipistrello.cfg
index 2a27f45b2..c76112ddf 100644
--- a/tcl/interface/ftdi/pipistrello.cfg
+++ b/tcl/interface/ftdi/pipistrello.cfg
@@ -3,7 +3,7 @@
# http://pipistrello.saanlima.com/
# http://www.saanlima.com/download/pipistrello-v2.0/pipistrello_v2_schematic.pdf
adapter driver ftdi
-ftdi device_desc "Pipistrello LX45"
+adapter usb product_name "Pipistrello LX45"
adapter usb vid_pid 0x0403 0x6010
# interface 1 is the uart
ftdi channel 0
diff --git a/tcl/interface/ftdi/pls_spc5.cfg b/tcl/interface/ftdi/pls_spc5.cfg
index 09a21ff4d..5be8e25e0 100644
--- a/tcl/interface/ftdi/pls_spc5.cfg
+++ b/tcl/interface/ftdi/pls_spc5.cfg
@@ -27,7 +27,7 @@
#
adapter driver ftdi
-ftdi device_desc "PLS USB/JTAG Adapter for SPC5xxx"
+adapter usb product_name "PLS USB/JTAG Adapter for SPC5xxx"
adapter usb vid_pid 0x263d 0x4001
ftdi channel 0
diff --git a/tcl/interface/ftdi/sheevaplug.cfg b/tcl/interface/ftdi/sheevaplug.cfg
index c889a634e..24c9ee77f 100644
--- a/tcl/interface/ftdi/sheevaplug.cfg
+++ b/tcl/interface/ftdi/sheevaplug.cfg
@@ -7,7 +7,7 @@
#
adapter driver ftdi
-ftdi device_desc "SheevaPlug JTAGKey FT2232D B"
+adapter usb product_name "SheevaPlug JTAGKey FT2232D B"
adapter usb vid_pid 0x9e88 0x9e8f
ftdi channel 0
diff --git a/tcl/interface/ftdi/signalyzer-lite.cfg b/tcl/interface/ftdi/signalyzer-lite.cfg
index 068de80ef..85459ed49 100644
--- a/tcl/interface/ftdi/signalyzer-lite.cfg
+++ b/tcl/interface/ftdi/signalyzer-lite.cfg
@@ -12,7 +12,7 @@ echo "Please report your experience with this file to openocd-devel mailing list
echo "so it could be marked as working or fixed."
adapter driver ftdi
-ftdi device_desc "Signalyzer LITE"
+adapter usb product_name "Signalyzer LITE"
adapter usb vid_pid 0x0403 0xbca1
ftdi layout_init 0x0008 0x000b
diff --git a/tcl/interface/ftdi/signalyzer.cfg b/tcl/interface/ftdi/signalyzer.cfg
index 739a5702b..5c055d330 100644
--- a/tcl/interface/ftdi/signalyzer.cfg
+++ b/tcl/interface/ftdi/signalyzer.cfg
@@ -12,7 +12,7 @@ echo "Please report your experience with this file to openocd-devel mailing list
echo "so it could be marked as working or fixed."
adapter driver ftdi
-ftdi device_desc "Signalyzer"
+adapter usb product_name "Signalyzer"
adapter usb vid_pid 0x0403 0xbca0
ftdi layout_init 0x0008 0x000b
diff --git a/tcl/interface/ftdi/sipeed-rv-debugger.cfg b/tcl/interface/ftdi/sipeed-rv-debugger.cfg
index ae4ee90bf..cc8f4f036 100644
--- a/tcl/interface/ftdi/sipeed-rv-debugger.cfg
+++ b/tcl/interface/ftdi/sipeed-rv-debugger.cfg
@@ -7,7 +7,7 @@
adapter driver ftdi
adapter speed 6000
-ftdi device_desc "JTAG Debugger"
+adapter usb product_name "JTAG Debugger"
adapter usb vid_pid 0x0403 0x6010
ftdi layout_init 0x0008 0x001b
ftdi layout_signal nSRST -oe 0x0020 -data 0x0020
diff --git a/tcl/interface/ftdi/sipeed-usb-jtag-debugger.cfg b/tcl/interface/ftdi/sipeed-usb-jtag-debugger.cfg
index b13bc0bf6..cc6455e1a 100644
--- a/tcl/interface/ftdi/sipeed-usb-jtag-debugger.cfg
+++ b/tcl/interface/ftdi/sipeed-usb-jtag-debugger.cfg
@@ -7,7 +7,7 @@
#
adapter driver ftdi
-ftdi device_desc "Dual RS232"
+adapter usb product_name "Dual RS232"
adapter usb vid_pid 0x0403 0x6010
ftdi channel 0
diff --git a/tcl/interface/ftdi/stm32-stick.cfg b/tcl/interface/ftdi/stm32-stick.cfg
index af9d2a8a5..cbf0a723d 100644
--- a/tcl/interface/ftdi/stm32-stick.cfg
+++ b/tcl/interface/ftdi/stm32-stick.cfg
@@ -7,7 +7,7 @@
#
adapter driver ftdi
-ftdi device_desc "STM32-PerformanceStick"
+adapter usb product_name "STM32-PerformanceStick"
adapter usb vid_pid 0x0640 0x002d
ftdi layout_init 0x0388 0x038b
diff --git a/tcl/interface/ftdi/tigard.cfg b/tcl/interface/ftdi/tigard.cfg
index f73d26690..7a14c1688 100644
--- a/tcl/interface/ftdi/tigard.cfg
+++ b/tcl/interface/ftdi/tigard.cfg
@@ -5,7 +5,7 @@
adapter driver ftdi
-ftdi device_desc "Tigard V1.1"
+adapter usb product_name "Tigard V1.1"
adapter usb vid_pid 0x0403 0x6010
ftdi channel 1
diff --git a/tcl/interface/ftdi/turtelizer2-revB.cfg b/tcl/interface/ftdi/turtelizer2-revB.cfg
index 574c69741..29655e6b0 100644
--- a/tcl/interface/ftdi/turtelizer2-revB.cfg
+++ b/tcl/interface/ftdi/turtelizer2-revB.cfg
@@ -12,7 +12,7 @@ echo "in ft2232.c. Please report your experience with this file to openocd-devel
echo "mailing list, so it could be marked as working or fixed."
adapter driver ftdi
-ftdi device_desc "Turtelizer JTAG/RS232 Adapter"
+adapter usb product_name "Turtelizer JTAG/RS232 Adapter"
adapter usb vid_pid 0x0403 0xbdc8
ftdi layout_init 0x0008 0x0c5b
diff --git a/tcl/interface/ftdi/turtelizer2-revC.cfg b/tcl/interface/ftdi/turtelizer2-revC.cfg
index 4afd24cac..858ff6ff8 100644
--- a/tcl/interface/ftdi/turtelizer2-revC.cfg
+++ b/tcl/interface/ftdi/turtelizer2-revC.cfg
@@ -7,7 +7,7 @@
#
adapter driver ftdi
-ftdi device_desc "Turtelizer JTAG/RS232 Adapter"
+adapter usb product_name "Turtelizer JTAG/RS232 Adapter"
adapter usb vid_pid 0x0403 0xbdc8
ftdi layout_init 0x0008 0x0c7b
diff --git a/tcl/interface/ftdi/um232h.cfg b/tcl/interface/ftdi/um232h.cfg
index 657162c0f..1e7f7faa4 100644
--- a/tcl/interface/ftdi/um232h.cfg
+++ b/tcl/interface/ftdi/um232h.cfg
@@ -10,7 +10,7 @@
#
adapter driver ftdi
-#ftdi device_desc "UM232H"
+#adapter usb product_name "UM232H"
adapter usb vid_pid 0x0403 0x6014
ftdi layout_init 0xfff8 0xfffb
diff --git a/tcl/interface/ftdi/vpaclink.cfg b/tcl/interface/ftdi/vpaclink.cfg
index ed8fbcaa8..a7807ab0b 100644
--- a/tcl/interface/ftdi/vpaclink.cfg
+++ b/tcl/interface/ftdi/vpaclink.cfg
@@ -13,7 +13,7 @@ echo "experience with this file to openocd-devel mailing list, so it could be ma
echo "as working or fixed."
adapter driver ftdi
-ftdi device_desc "VPACLink"
+adapter usb product_name "VPACLink"
adapter usb vid_pid 0x0403 0x6010
ftdi layout_init 0x0508 0x0f1b
-----------------------------------------------------------------------
Summary of changes:
doc/openocd.texi | 6 ------
src/jtag/drivers/ftdi.c | 24 +---------------------
src/jtag/startup.tcl | 10 +++++++--
tcl/board/calao-usb-a9260.cfg | 2 +-
tcl/board/calao-usb-a9g20-c01.cfg | 2 +-
tcl/board/digilent_analog_discovery.cfg | 2 +-
tcl/board/digilent_anvyl.cfg | 2 +-
tcl/board/digilent_nexys_video.cfg | 2 +-
tcl/board/digilent_zybo.cfg | 2 +-
.../esp32-wrover-e-ftdi-jtag-devkit.cfg | 2 +-
tcl/board/kasli.cfg | 2 +-
tcl/board/nds32_corvettef1.cfg | 2 +-
tcl/board/numato_mimas_a7.cfg | 2 +-
tcl/board/sayma_amc.cfg | 2 +-
tcl/board/sifive/hifive1.cfg | 2 +-
tcl/interface/ftdi/100ask-openjtag.cfg | 2 +-
tcl/interface/ftdi/ashling-opella-ld-jtag.cfg | 2 +-
tcl/interface/ftdi/ashling-opella-ld-swd.cfg | 2 +-
tcl/interface/ftdi/axm0432.cfg | 2 +-
tcl/interface/ftdi/c232hm.cfg | 4 ++--
tcl/interface/ftdi/cortino.cfg | 2 +-
tcl/interface/ftdi/digilent-hs1.cfg | 2 +-
tcl/interface/ftdi/digilent-hs2.cfg | 2 +-
tcl/interface/ftdi/digilent_jtag_hs3.cfg | 2 +-
tcl/interface/ftdi/digilent_jtag_smt2_nc.cfg | 4 ++--
tcl/interface/ftdi/dlp-usb1232h.cfg | 2 +-
tcl/interface/ftdi/dp_busblaster.cfg | 2 +-
tcl/interface/ftdi/dp_busblaster_kt-link.cfg | 2 +-
tcl/interface/ftdi/flossjtag-noeeprom.cfg | 2 +-
tcl/interface/ftdi/flossjtag.cfg | 2 +-
tcl/interface/ftdi/flyswatter.cfg | 2 +-
tcl/interface/ftdi/flyswatter2.cfg | 2 +-
tcl/interface/ftdi/gw16042.cfg | 2 +-
tcl/interface/ftdi/hie-jtag.cfg | 2 +-
tcl/interface/ftdi/hilscher_nxhx10_etm.cfg | 2 +-
tcl/interface/ftdi/hilscher_nxhx500_etm.cfg | 2 +-
tcl/interface/ftdi/hilscher_nxhx500_re.cfg | 2 +-
tcl/interface/ftdi/hilscher_nxhx50_etm.cfg | 2 +-
tcl/interface/ftdi/hilscher_nxhx50_re.cfg | 2 +-
tcl/interface/ftdi/hitex_lpc1768stick.cfg | 2 +-
tcl/interface/ftdi/hitex_str9-comstick.cfg | 2 +-
tcl/interface/ftdi/icebear.cfg | 2 +-
tcl/interface/ftdi/jtag-lock-pick_tiny_2.cfg | 2 +-
tcl/interface/ftdi/jtagkey.cfg | 2 +-
tcl/interface/ftdi/jtagkey2.cfg | 2 +-
tcl/interface/ftdi/jtagkey2p.cfg | 2 +-
tcl/interface/ftdi/kt-link.cfg | 2 +-
tcl/interface/ftdi/lambdaconcept_ecpix-5.cfg | 2 +-
tcl/interface/ftdi/lisa-l.cfg | 2 +-
tcl/interface/ftdi/luminary-icdi.cfg | 2 +-
tcl/interface/ftdi/luminary-lm3s811.cfg | 2 +-
tcl/interface/ftdi/luminary.cfg | 2 +-
tcl/interface/ftdi/m53evk.cfg | 2 +-
tcl/interface/ftdi/mbftdi.cfg | 2 +-
tcl/interface/ftdi/minimodule-swd.cfg | 4 ++--
tcl/interface/ftdi/minimodule.cfg | 2 +-
tcl/interface/ftdi/minispartan6.cfg | 2 +-
tcl/interface/ftdi/miniwiggler.cfg | 2 +-
tcl/interface/ftdi/neodb.cfg | 2 +-
tcl/interface/ftdi/ngxtech.cfg | 2 +-
tcl/interface/ftdi/olimex-arm-jtag-cjtag.cfg | 2 +-
tcl/interface/ftdi/olimex-arm-usb-ocd-h-cjtag.cfg | 2 +-
tcl/interface/ftdi/olimex-arm-usb-ocd-h.cfg | 2 +-
tcl/interface/ftdi/olimex-arm-usb-ocd.cfg | 2 +-
tcl/interface/ftdi/olimex-arm-usb-tiny-h-cjtag.cfg | 2 +-
tcl/interface/ftdi/olimex-arm-usb-tiny-h.cfg | 2 +-
tcl/interface/ftdi/olimex-jtag-tiny.cfg | 2 +-
tcl/interface/ftdi/oocdlink.cfg | 2 +-
tcl/interface/ftdi/opendous_ftdi.cfg | 2 +-
tcl/interface/ftdi/openocd-usb-hs.cfg | 2 +-
tcl/interface/ftdi/openocd-usb.cfg | 2 +-
tcl/interface/ftdi/openrd.cfg | 2 +-
tcl/interface/ftdi/pipistrello.cfg | 2 +-
tcl/interface/ftdi/pls_spc5.cfg | 2 +-
tcl/interface/ftdi/sheevaplug.cfg | 2 +-
tcl/interface/ftdi/signalyzer-lite.cfg | 2 +-
tcl/interface/ftdi/signalyzer.cfg | 2 +-
tcl/interface/ftdi/sipeed-rv-debugger.cfg | 2 +-
tcl/interface/ftdi/sipeed-usb-jtag-debugger.cfg | 2 +-
tcl/interface/ftdi/stm32-stick.cfg | 2 +-
tcl/interface/ftdi/tigard.cfg | 2 +-
tcl/interface/ftdi/turtelizer2-revB.cfg | 2 +-
tcl/interface/ftdi/turtelizer2-revC.cfg | 2 +-
tcl/interface/ftdi/um232h.cfg | 2 +-
tcl/interface/ftdi/vpaclink.cfg | 2 +-
85 files changed, 94 insertions(+), 116 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-05-17 20:55:48
|
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 a41341bbf7f1e06910ce967b7e199cf64ab77c3a (commit)
from 2acd694e3c6d7e3fb11d4ad92b4440f2b51db2d3 (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 a41341bbf7f1e06910ce967b7e199cf64ab77c3a
Author: Marc Schink <de...@za...>
Date: Mon Apr 27 07:55:19 2026 +0200
adapter: Implement USB product name handling
Multiple adapter drivers currently implement their own 'device_desc'
commands, leading to duplicated code. Move this functionality into the
adapter core, similar to how device serial handling is implemented.
Additionally, rename the command from 'device_desc' to 'product_name' to
more accurately describe its purpose and align with what it actually does.
Driver specific changes will follow in a separate patch series.
Change-Id: If4ef83e9e47e91c9b41dd98c49c074fcdd4ec497
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9608
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/doc/openocd.texi b/doc/openocd.texi
index b36e45254..76499deb7 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -2517,6 +2517,11 @@ The USB bus topology can be queried with the command @emph{lsusb -t} or @emph{dm
This command is only available if your libusb1 is at least version 1.0.16.
@end deffn
+@deffn {Config Command} {adapter usb product_name} name
+Specifies the USB product name (the @emph{iProduct} string) of the adapter to use.
+If this is not set, the product name is not used during device selection.
+@end deffn
+
@deffn {Config Command} {adapter serial} serial_string
Specifies the @var{serial_string} of the adapter to use.
If this command is not specified, serial strings are not checked.
diff --git a/src/jtag/adapter.c b/src/jtag/adapter.c
index b17331f88..dcdc047f3 100644
--- a/src/jtag/adapter.c
+++ b/src/jtag/adapter.c
@@ -45,6 +45,7 @@ static struct {
// vid = pid = 0 marks the end of the list.
uint16_t usb_vids[MAX_USB_IDS + 1];
uint16_t usb_pids[MAX_USB_IDS + 1];
+ char *product_name;
char *serial;
enum adapter_clk_mode clock_mode;
int speed_khz;
@@ -201,6 +202,7 @@ int adapter_quit(void)
free(adapter_config.serial);
free(adapter_config.usb_location);
+ free(adapter_config.product_name);
struct jtag_tap *t = jtag_all_taps();
while (t) {
@@ -345,6 +347,11 @@ const char *adapter_usb_get_location(void)
return adapter_config.usb_location;
}
+const char *adapter_usb_get_product_name(void)
+{
+ return adapter_config.product_name;
+}
+
bool adapter_usb_location_equal(uint8_t dev_bus, uint8_t *port_path, size_t path_len)
{
size_t path_step, string_length;
@@ -1145,6 +1152,20 @@ COMMAND_HANDLER(handle_usb_vid_pid_command)
return ERROR_OK;
}
+COMMAND_HANDLER(handle_usb_product_name_command)
+{
+ if (CMD_ARGC != 1)
+ return ERROR_COMMAND_SYNTAX_ERROR;
+
+ free(adapter_config.product_name);
+ adapter_config.product_name = NULL;
+
+ if (*CMD_ARGV[0])
+ adapter_config.product_name = strdup(CMD_ARGV[0]);
+
+ return ERROR_OK;
+}
+
static const struct command_registration adapter_usb_command_handlers[] = {
{
.name = "vid_pid",
@@ -1153,6 +1174,13 @@ static const struct command_registration adapter_usb_command_handlers[] = {
.help = "set the USB VID and PID of the USB device",
.usage = "(vid pid)*",
},
+ {
+ .name = "product_name",
+ .handler = &handle_usb_product_name_command,
+ .mode = COMMAND_CONFIG,
+ .help = "set the USB product name of the USB device",
+ .usage = "name",
+ },
#ifdef HAVE_LIBUSB_GET_PORT_NUMBERS
{
.name = "location",
diff --git a/src/jtag/adapter.h b/src/jtag/adapter.h
index 4254ae96d..c22ac53fe 100644
--- a/src/jtag/adapter.h
+++ b/src/jtag/adapter.h
@@ -92,6 +92,9 @@ bool is_adapter_initialized(void);
/** @returns USB location string set with command 'adapter usb location' */
const char *adapter_usb_get_location(void);
+/** @returns USB product name set with command 'adapter usb product_name' */
+const char *adapter_usb_get_product_name(void);
+
/** @returns true if USB location string is "<dev_bus>-<port_path[0]>[.<port_path[1]>[...]]" */
bool adapter_usb_location_equal(uint8_t dev_bus, uint8_t *port_path, size_t path_len);
-----------------------------------------------------------------------
Summary of changes:
doc/openocd.texi | 5 +++++
src/jtag/adapter.c | 28 ++++++++++++++++++++++++++++
src/jtag/adapter.h | 3 +++
3 files changed, 36 insertions(+)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-05-17 20:55:28
|
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 2acd694e3c6d7e3fb11d4ad92b4440f2b51db2d3 (commit)
from 2fb8a4752ac59c134209ffec497ba96e3f51f520 (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 2acd694e3c6d7e3fb11d4ad92b4440f2b51db2d3
Author: Marc Schink <de...@za...>
Date: Mon Aug 4 12:57:05 2025 +0200
helper: Use proper return values for duration_{start,measure}
The return value of gettimeofday() is used directly as return value of
duration_{start,measure}, but checked inconsistently against 0 or
ERROR_OK. Use proper return values and make the code more consistent.
While at it, remove unnecessary parentheses to make checkpatch happy.
Change-Id: I6bb8418887b09c7510d2f79e4ec7e5389f59849b
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9286
Reviewed-by: Antonio Borneo <bor...@gm...>
Tested-by: jenkins
diff --git a/src/flash/nor/tcl.c b/src/flash/nor/tcl.c
index add7df437..bbf8a4fb0 100644
--- a/src/flash/nor/tcl.c
+++ b/src/flash/nor/tcl.c
@@ -275,7 +275,7 @@ COMMAND_HANDLER(handle_flash_erase_address_command)
if (retval == ERROR_OK)
retval = flash_erase_address_range(target, do_pad, address, length);
- if ((retval == ERROR_OK) && (duration_measure(&bench) == ERROR_OK)) {
+ if (retval == ERROR_OK && duration_measure(&bench) == ERROR_OK) {
command_print(CMD, "erased address " TARGET_ADDR_FMT " (length %" PRIu32 ")"
" in %fs (%0.3f KiB/s)", address, length,
duration_elapsed(&bench), duration_kbps(&bench, length));
@@ -323,7 +323,7 @@ COMMAND_HANDLER(handle_flash_erase_command)
retval = flash_driver_erase(p, first, last);
- if ((retval == ERROR_OK) && (duration_measure(&bench) == ERROR_OK)) {
+ if (retval == ERROR_OK && duration_measure(&bench) == ERROR_OK) {
command_print(CMD, "erased sectors %" PRIu32 " "
"through %" PRIu32 " on flash bank %u "
"in %fs", first, last, p->bank_number, duration_elapsed(&bench));
@@ -449,7 +449,7 @@ COMMAND_HANDLER(handle_flash_write_image_command)
return retval;
}
- if ((retval == ERROR_OK) && (duration_measure(&bench) == ERROR_OK)) {
+ if (retval == ERROR_OK && duration_measure(&bench) == ERROR_OK) {
command_print(CMD, "wrote %" PRIu32 " bytes from file %s "
"in %fs (%0.3f KiB/s)", written, CMD_ARGV[0],
duration_elapsed(&bench), duration_kbps(&bench, written));
@@ -501,7 +501,7 @@ COMMAND_HANDLER(handle_flash_verify_image_command)
return retval;
}
- if ((retval == ERROR_OK) && (duration_measure(&bench) == ERROR_OK)) {
+ if (retval == ERROR_OK && duration_measure(&bench) == ERROR_OK) {
command_print(CMD, "verified %" PRIu32 " bytes from file %s "
"in %fs (%0.3f KiB/s)", verified, CMD_ARGV[0],
duration_elapsed(&bench), duration_kbps(&bench, verified));
@@ -655,7 +655,7 @@ COMMAND_HANDLER(handle_flash_fill_command)
ptr += wordsize;
}
- if ((retval == ERROR_OK) && (duration_measure(&bench) == ERROR_OK)) {
+ if (retval == ERROR_OK && duration_measure(&bench) == ERROR_OK) {
command_print(CMD, "wrote %" PRIu32 " bytes to " TARGET_ADDR_FMT
" in %fs (%0.3f KiB/s)", size_bytes, address,
duration_elapsed(&bench), duration_kbps(&bench, size_bytes));
@@ -950,7 +950,7 @@ COMMAND_HANDLER(handle_flash_write_bank_command)
free(buffer);
- if ((retval == ERROR_OK) && (duration_measure(&bench) == ERROR_OK)) {
+ if (retval == ERROR_OK && duration_measure(&bench) == ERROR_OK) {
command_print(CMD, "wrote %zu bytes from file %s to flash bank %u"
" at offset 0x%8.8" PRIx32 " in %fs (%0.3f KiB/s)",
length, CMD_ARGV[1], bank->bank_number, offset,
diff --git a/src/helper/time_support.c b/src/helper/time_support.c
index dda3cb3e4..46fb17246 100644
--- a/src/helper/time_support.c
+++ b/src/helper/time_support.c
@@ -15,6 +15,8 @@
#include "config.h"
#endif
+#include <helper/log.h>
+
#include "time_support.h"
/* calculate difference between two struct timeval values */
@@ -68,16 +70,21 @@ int timeval_compare(const struct timeval *x, const struct timeval *y)
int duration_start(struct duration *duration)
{
- return gettimeofday(&duration->start, NULL);
+ if (gettimeofday(&duration->start, NULL) != 0)
+ return ERROR_FAIL;
+
+ return ERROR_OK;
}
int duration_measure(struct duration *duration)
{
struct timeval end;
- int retval = gettimeofday(&end, NULL);
- if (retval == 0)
- timeval_subtract(&duration->elapsed, &end, &duration->start);
- return retval;
+ if (gettimeofday(&end, NULL) != 0)
+ return ERROR_FAIL;
+
+ timeval_subtract(&duration->elapsed, &end, &duration->start);
+
+ return ERROR_OK;
}
float duration_elapsed(const struct duration *duration)
diff --git a/src/target/espressif/esp32_apptrace.c b/src/target/espressif/esp32_apptrace.c
index 307096019..77201ae90 100644
--- a/src/target/espressif/esp32_apptrace.c
+++ b/src/target/espressif/esp32_apptrace.c
@@ -488,7 +488,7 @@ int esp32_apptrace_cmd_ctx_init(struct esp32_apptrace_cmd_ctx *cmd_ctx, struct c
cmd_ctx->stats.min_blk_read_time = 1000000.0;
cmd_ctx->stats.min_blk_proc_time = 1000000.0;
}
- if (duration_start(&cmd_ctx->idle_time) != 0) {
+ if (duration_start(&cmd_ctx->idle_time) != ERROR_OK) {
command_print(cmd, "Failed to start idle time measurement!");
esp32_apptrace_cmd_ctx_cleanup(cmd_ctx);
return ERROR_FAIL;
@@ -905,7 +905,7 @@ static int esp32_apptrace_process_data(struct esp32_apptrace_cmd_ctx *ctx,
/* check for stop condition */
if (ctx->tot_len > cmd_data->skip_len && (ctx->tot_len - cmd_data->skip_len >= cmd_data->max_len)) {
ctx->running = 0;
- if (duration_measure(&ctx->read_time) != 0) {
+ if (duration_measure(&ctx->read_time) != ERROR_OK) {
LOG_ERROR("Failed to stop trace read time measure!");
return ERROR_FAIL;
}
@@ -1005,7 +1005,7 @@ static int esp32_apptrace_check_connection(struct esp32_apptrace_cmd_ctx *ctx)
}
if (ctx->stop_tmo != -1.0) {
/* re-start idle time measurement */
- if (duration_start(&ctx->idle_time) != 0) {
+ if (duration_start(&ctx->idle_time) != ERROR_OK) {
LOG_ERROR("Failed to re-start idle time measure!");
return ERROR_FAIL;
}
@@ -1082,7 +1082,7 @@ static int esp32_apptrace_poll(void *priv)
ctx->last_blk_id = max_block_id;
}
if (ctx->stop_tmo != -1.0) {
- if (duration_measure(&ctx->idle_time) != 0) {
+ if (duration_measure(&ctx->idle_time) != ERROR_OK) {
ctx->running = 0;
LOG_ERROR("Failed to measure idle time!");
return ERROR_FAIL;
@@ -1102,7 +1102,7 @@ static int esp32_apptrace_poll(void *priv)
return ERROR_FAIL;
}
if (ctx->tot_len == 0) {
- if (duration_start(&ctx->read_time) != 0) {
+ if (duration_start(&ctx->read_time) != ERROR_OK) {
ctx->running = 0;
LOG_ERROR("Failed to start trace read time measurement!");
return ERROR_FAIL;
@@ -1116,7 +1116,7 @@ static int esp32_apptrace_poll(void *priv)
}
if (s_time_stats_enable) {
/* read block */
- if (duration_start(&blk_proc_time) != 0) {
+ if (duration_start(&blk_proc_time) != ERROR_OK) {
ctx->running = 0;
LOG_ERROR("Failed to start block read time measurement!");
return ERROR_FAIL;
@@ -1136,7 +1136,7 @@ static int esp32_apptrace_poll(void *priv)
block->data_len = target_state[fired_target_num].data_len;
ctx->raw_tot_len += block->data_len;
if (s_time_stats_enable) {
- if (duration_measure(&blk_proc_time) != 0) {
+ if (duration_measure(&blk_proc_time) != ERROR_OK) {
ctx->running = 0;
LOG_ERROR("Failed to measure block read time!");
return ERROR_FAIL;
@@ -1148,7 +1148,7 @@ static int esp32_apptrace_poll(void *priv)
if (brt < ctx->stats.min_blk_read_time)
ctx->stats.min_blk_read_time = brt;
- if (duration_start(&blk_proc_time) != 0) {
+ if (duration_start(&blk_proc_time) != ERROR_OK) {
ctx->running = 0;
LOG_ERROR("Failed to start block proc time measurement!");
return ERROR_FAIL;
@@ -1194,14 +1194,14 @@ static int esp32_apptrace_poll(void *priv)
}
if (ctx->stop_tmo != -1.0) {
/* start idle time measurement */
- if (duration_start(&ctx->idle_time) != 0) {
+ if (duration_start(&ctx->idle_time) != ERROR_OK) {
ctx->running = 0;
LOG_ERROR("Failed to start idle time measure!");
return ERROR_FAIL;
}
}
if (s_time_stats_enable) {
- if (duration_measure(&blk_proc_time) != 0) {
+ if (duration_measure(&blk_proc_time) != ERROR_OK) {
ctx->running = 0;
LOG_ERROR("Failed to stop block proc time measure!");
return ERROR_FAIL;
@@ -1223,7 +1223,7 @@ static inline bool is_sysview_mode(int mode)
static void esp32_apptrace_cmd_stop(struct esp32_apptrace_cmd_ctx *ctx)
{
- if (duration_measure(&ctx->read_time) != 0)
+ if (duration_measure(&ctx->read_time) != ERROR_OK)
LOG_ERROR("Failed to stop trace read time measurement!");
int res = target_unregister_timer_callback(esp32_apptrace_poll, ctx);
if (res != ERROR_OK)
@@ -1362,7 +1362,7 @@ static int esp32_sysview_stop(struct esp32_apptrace_cmd_ctx *ctx)
}
/* wait for block switch (command sent), so we can disconnect from targets */
old_block_id = target_state[fired_target_num].block_id;
- if (duration_start(&wait_time) != 0) {
+ if (duration_start(&wait_time) != ERROR_OK) {
LOG_ERROR("Failed to start trace stop timeout measurement!");
return ERROR_FAIL;
}
@@ -1418,7 +1418,7 @@ static int esp32_sysview_stop(struct esp32_apptrace_cmd_ctx *ctx)
old_block_id = target_state[fired_target_num].block_id;
}
}
- if (duration_measure(&wait_time) != 0) {
+ if (duration_measure(&wait_time) != ERROR_OK) {
LOG_ERROR("Failed to start trace stop timeout measurement!");
return ERROR_FAIL;
}
@@ -1532,7 +1532,7 @@ static int esp32_cmd_apptrace_generic(struct command_invocation *cmd, int mode,
esp32_apptrace_cmd_stop(&s_at_cmd_ctx);
return ERROR_OK;
} else if (strcmp(argv[0], "status") == 0) {
- if (s_at_cmd_ctx.running && duration_measure(&s_at_cmd_ctx.read_time) != 0)
+ if (s_at_cmd_ctx.running && duration_measure(&s_at_cmd_ctx.read_time) != ERROR_OK)
LOG_ERROR("Failed to measure trace read time!");
esp32_apptrace_print_stats(&s_at_cmd_ctx);
return ERROR_OK;
diff --git a/src/target/espressif/esp32_sysview.c b/src/target/espressif/esp32_sysview.c
index 2fe215778..d8eda0773 100644
--- a/src/target/espressif/esp32_sysview.c
+++ b/src/target/espressif/esp32_sysview.c
@@ -545,7 +545,7 @@ int esp32_sysview_process_data(struct esp32_apptrace_cmd_ctx *ctx,
if (ctx->tot_len > cmd_data->apptrace.skip_len &&
(ctx->tot_len - cmd_data->apptrace.skip_len >= cmd_data->apptrace.max_len)) {
ctx->running = 0;
- if (duration_measure(&ctx->read_time) != 0) {
+ if (duration_measure(&ctx->read_time) != ERROR_OK) {
LOG_ERROR("Failed to stop trace read time measure!");
return ERROR_FAIL;
}
diff --git a/src/target/espressif/esp_algorithm.c b/src/target/espressif/esp_algorithm.c
index 79f610b92..ddb557583 100644
--- a/src/target/espressif/esp_algorithm.c
+++ b/src/target/espressif/esp_algorithm.c
@@ -307,7 +307,7 @@ int esp_algorithm_load_func_image(struct target *target, struct esp_algorithm_ru
if (!run || !run->hw)
return ERROR_FAIL;
- if (duration_start(&algo_time) != 0) {
+ if (duration_start(&algo_time) != ERROR_OK) {
LOG_ERROR("Failed to start algo time measurement!");
return ERROR_FAIL;
}
@@ -486,7 +486,7 @@ int esp_algorithm_load_func_image(struct target *target, struct esp_algorithm_ru
run->stub.stack_addr = run->stub.stack->address + run->stack_size;
}
- if (duration_measure(&algo_time) != 0) {
+ if (duration_measure(&algo_time) != ERROR_OK) {
LOG_ERROR("Failed to stop algo run measurement!");
retval = ERROR_FAIL;
goto _on_error;
@@ -536,7 +536,7 @@ int esp_algorithm_load_onboard_func(struct target *target, target_addr_t func_ad
if (!run || !run->hw)
return ERROR_FAIL;
- if (duration_start(&algo_time) != 0) {
+ if (duration_start(&algo_time) != ERROR_OK) {
LOG_ERROR("Failed to start algo time measurement!");
return ERROR_FAIL;
}
@@ -572,7 +572,7 @@ int esp_algorithm_load_onboard_func(struct target *target, target_addr_t func_ad
}
}
- if (duration_measure(&algo_time) != 0) {
+ if (duration_measure(&algo_time) != ERROR_OK) {
LOG_ERROR("Failed to stop algo run measurement!");
return ERROR_FAIL;
}
diff --git a/src/target/target.c b/src/target/target.c
index 154891d0f..d0776834e 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -3630,7 +3630,7 @@ COMMAND_HANDLER(handle_load_image_command)
free(buffer);
}
- if ((retval == ERROR_OK) && (duration_measure(&bench) == ERROR_OK)) {
+ if (retval == ERROR_OK && duration_measure(&bench) == ERROR_OK) {
command_print(CMD, "downloaded %" PRIu32 " bytes "
"in %fs (%0.3f KiB/s)", image_size,
duration_elapsed(&bench), duration_kbps(&bench, image_size));
@@ -3687,7 +3687,7 @@ COMMAND_HANDLER(handle_dump_image_command)
free(buffer);
- if ((retval == ERROR_OK) && (duration_measure(&bench) == ERROR_OK)) {
+ if (retval == ERROR_OK && duration_measure(&bench) == ERROR_OK) {
size_t filesize;
retval = fileio_size(fileio, &filesize);
if (retval != ERROR_OK)
@@ -3838,7 +3838,7 @@ static COMMAND_HELPER(handle_verify_image_command_internal, enum verify_mode ver
done:
if (diffs > 0)
retval = ERROR_FAIL;
- if ((retval == ERROR_OK) && (duration_measure(&bench) == ERROR_OK)) {
+ if (retval == ERROR_OK && duration_measure(&bench) == ERROR_OK) {
command_print(CMD, "verified %" PRIu32 " bytes "
"in %fs (%0.3f KiB/s)", image_size,
duration_elapsed(&bench), duration_kbps(&bench, image_size));
@@ -6160,7 +6160,7 @@ COMMAND_HANDLER(handle_fast_load_image_command)
free(buffer);
}
- if ((retval == ERROR_OK) && (duration_measure(&bench) == ERROR_OK)) {
+ if (retval == ERROR_OK && duration_measure(&bench) == ERROR_OK) {
command_print(CMD, "Loaded %" PRIu32 " bytes "
"in %fs (%0.3f KiB/s)", image_size,
duration_elapsed(&bench), duration_kbps(&bench, image_size));
-----------------------------------------------------------------------
Summary of changes:
src/flash/nor/tcl.c | 12 ++++++------
src/helper/time_support.c | 17 ++++++++++++-----
src/target/espressif/esp32_apptrace.c | 28 ++++++++++++++--------------
src/target/espressif/esp32_sysview.c | 2 +-
src/target/espressif/esp_algorithm.c | 8 ++++----
src/target/target.c | 8 ++++----
6 files changed, 41 insertions(+), 34 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-05-17 20:54:19
|
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 2fb8a4752ac59c134209ffec497ba96e3f51f520 (commit)
from eeacc589af6062e38658e19dfb6f315f9e5db26c (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 2fb8a4752ac59c134209ffec497ba96e3f51f520
Author: Evgeniy Naydanov <eu...@gm...>
Date: Thu Mar 12 14:52:21 2026 +0300
target/riscv: drop version-specific `arch_state()`
Drop these placeholders.
This is a part of the effort to eliminate "fake" `riscv013_target` and
`riscv011_target` `target_type`s.
Change-Id: I055ce3114178cc870a6679aa91bc5477870bbeea
Signed-off-by: Evgeniy Naydanov <eu...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9587
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/target/riscv/riscv-011.c b/src/target/riscv/riscv-011.c
index 2bef2228e..8fd3792bf 100644
--- a/src/target/riscv/riscv-011.c
+++ b/src/target/riscv/riscv-011.c
@@ -2347,11 +2347,6 @@ static int access_memory(struct target *target, const struct riscv_mem_access_ar
return read_memory(target, args);
}
-static int arch_state(struct target *target)
-{
- return ERROR_OK;
-}
-
static COMMAND_HELPER(riscv011_print_info, struct target *target)
{
/* Abstract description. */
@@ -2472,6 +2467,4 @@ struct target_type riscv011_target = {
.assert_reset = assert_reset,
.deassert_reset = deassert_reset,
-
- .arch_state = arch_state,
};
diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c
index 23485d34f..1b47d5e77 100644
--- a/src/target/riscv/riscv-013.c
+++ b/src/target/riscv/riscv-013.c
@@ -5074,10 +5074,6 @@ static unsigned int riscv013_get_progbufsize(const struct target *target)
return r->progbufsize;
}
-static int arch_state(struct target *target)
-{
- return ERROR_OK;
-}
struct target_type riscv013_target = {
.name = "riscv",
@@ -5092,8 +5088,6 @@ struct target_type riscv013_target = {
.assert_reset = assert_reset,
.deassert_reset = deassert_reset,
-
- .arch_state = arch_state
};
/*** 0.13-specific implementations of various RISC-V helper functions. ***/
diff --git a/src/target/riscv/riscv.c b/src/target/riscv/riscv.c
index 0688ad327..1e2b9caa3 100644
--- a/src/target/riscv/riscv.c
+++ b/src/target/riscv/riscv.c
@@ -3573,11 +3573,7 @@ static int riscv_arch_state(struct target *target)
target_name(target),
debug_reason_name(target),
semihosting_active ? " Semihosting is active." : "");
- struct target_type *tt = get_target_type(target);
- if (!tt)
- return ERROR_FAIL;
- assert(tt->arch_state);
- return tt->arch_state(target);
+ return ERROR_OK;
}
/* Algorithm must end with a software breakpoint instruction. */
-----------------------------------------------------------------------
Summary of changes:
src/target/riscv/riscv-011.c | 7 -------
src/target/riscv/riscv-013.c | 6 ------
src/target/riscv/riscv.c | 6 +-----
3 files changed, 1 insertion(+), 18 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-05-17 20:53:56
|
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 eeacc589af6062e38658e19dfb6f315f9e5db26c (commit)
from 0e901c561f238fff70ab1423600af6d706fd603c (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 eeacc589af6062e38658e19dfb6f315f9e5db26c
Author: Tomas Vanek <va...@fb...>
Date: Wed Apr 29 11:07:21 2026 +0200
jtag/core: fix is_jtag_poll_safe() logic
RESET_SRST_NO_GATING reset config option is used also for
other transports, mainly for SWD.
Disable polling implicitly while SRST is gating the debug
HW regardless the selected transport.
While on it, add FIXME comment to mark similar issue with
sensed SRST signal. Currently there is no support for
SRST sensing in drivers so no way to test eventual change.
Change-Id: I88a7cbd5141b4343db9877d386f9ff37630b5fca
Signed-off-by: Tomas Vanek <va...@fb...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9605
Reviewed-by: Antonio Borneo <bor...@gm...>
Tested-by: jenkins
diff --git a/src/jtag/core.c b/src/jtag/core.c
index 941d9f3b4..9c438a01b 100644
--- a/src/jtag/core.c
+++ b/src/jtag/core.c
@@ -146,18 +146,15 @@ static bool jtag_poll_en = true;
bool is_jtag_poll_safe(void)
{
/* Polling can be disabled explicitly with set_enabled(false).
- * It can also be masked with mask().
- * It is also implicitly disabled while TRST is active and
- * while SRST is gating the JTAG clock.
- */
- if (!jtag_poll_en)
+ * It can also be masked with mask(). */
+ if (!jtag_poll_en || !jtag_poll)
return false;
- if (!transport_is_jtag())
- return jtag_poll;
-
- if (!jtag_poll || jtag_trst != 0)
+ /* On JTAG transport it is also implicitly disabled while TRST is active */
+ if (transport_is_jtag() && jtag_trst)
return false;
+
+ /* On any transport while SRST is gating the JTAG clock or other debug HW */
return jtag_srst == 0 || (jtag_reset_config & RESET_SRST_NO_GATING);
}
diff --git a/src/target/target.c b/src/target/target.c
index f8cb7e483..154891d0f 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -2937,6 +2937,8 @@ static int handle_target(void *priv)
recursive = 0;
}
+ /* FIXME: sensed SRST state should be treated similarly as
+ * active SRST control and honour reset config RESET_SRST_NO_GATING */
if (sensed_power_dropout || sensed_srst_asserted)
return ERROR_OK;
-----------------------------------------------------------------------
Summary of changes:
src/jtag/core.c | 15 ++++++---------
src/target/target.c | 2 ++
2 files changed, 8 insertions(+), 9 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-05-17 20:53:37
|
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 0e901c561f238fff70ab1423600af6d706fd603c (commit)
via af6c19d59db1dc123e7628165166f15772b80714 (commit)
from 822ac747877426b192fd45b62537d6436d30c0c9 (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 0e901c561f238fff70ab1423600af6d706fd603c
Author: Tomas Vanek <va...@fb...>
Date: Tue Apr 28 17:14:46 2026 +0200
target: rename srst_asserted and power_dropout variables
Add sensed_ prefix to make sure the variables are not
mismatched mainly with the active srst control ones.
While on it update sense_handler() comment
No functional change.
int type variables misused as a bool left as is.
Change-Id: I208196b59588acab2da38602449d5666f5e0395f
Signed-off-by: Tomas Vanek <va...@fb...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9604
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/target/target.c b/src/target/target.c
index f862fae7c..f8cb7e483 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -2807,10 +2807,10 @@ COMMAND_HANDLER(handle_targets_command)
return retval;
}
-/* every 300ms we check for reset & powerdropout and issue a "reset halt" if so. */
+/* every polling_interval we check for reset & powerdropout */
-static int power_dropout;
-static int srst_asserted;
+static int sensed_power_dropout;
+static int sensed_srst_asserted;
static int run_power_restore;
static int run_power_dropout;
@@ -2822,29 +2822,29 @@ static int sense_handler(void)
static int prev_srst_asserted;
static int prev_power_dropout;
- int retval = jtag_power_dropout(&power_dropout);
+ int retval = jtag_power_dropout(&sensed_power_dropout);
if (retval != ERROR_OK)
return retval;
int power_restored;
- power_restored = prev_power_dropout && !power_dropout;
+ power_restored = prev_power_dropout && !sensed_power_dropout;
if (power_restored)
run_power_restore = 1;
int64_t current = timeval_ms();
static int64_t last_power;
bool wait_more = last_power + 2000 > current;
- if (power_dropout && !wait_more) {
+ if (sensed_power_dropout && !wait_more) {
run_power_dropout = 1;
last_power = current;
}
- retval = jtag_srst_asserted(&srst_asserted);
+ retval = jtag_srst_asserted(&sensed_srst_asserted);
if (retval != ERROR_OK)
return retval;
int srst_deasserted;
- srst_deasserted = prev_srst_asserted && !srst_asserted;
+ srst_deasserted = prev_srst_asserted && !sensed_srst_asserted;
static int64_t last_srst;
wait_more = last_srst + 2000 > current;
@@ -2853,11 +2853,11 @@ static int sense_handler(void)
last_srst = current;
}
- if (!prev_srst_asserted && srst_asserted)
+ if (!prev_srst_asserted && sensed_srst_asserted)
run_srst_asserted = 1;
- prev_srst_asserted = srst_asserted;
- prev_power_dropout = power_dropout;
+ prev_srst_asserted = sensed_srst_asserted;
+ prev_power_dropout = sensed_power_dropout;
if (srst_deasserted || power_restored) {
/* Other than logging the event we can't do anything here.
@@ -2937,7 +2937,7 @@ static int handle_target(void *priv)
recursive = 0;
}
- if (power_dropout || srst_asserted)
+ if (sensed_power_dropout || sensed_srst_asserted)
return ERROR_OK;
int retval = ERROR_OK;
commit af6c19d59db1dc123e7628165166f15772b80714
Author: Tim Newsome <ti...@si...>
Date: Thu Oct 21 17:08:49 2021 -0700
target: base poll frequency on wall time
Replaces code that would count number of invocations.
This is based on [1].
The behavior is changed, namely:
* `TARGET_EVENT_GDB_HALT` is not called -- the user can hit Ctrl-C if he
needs to halt the target, this use of the callback seems
counterintuitive. See [2].
* There is no early-exit when re-examining the target fails -- there are
still other targets that need to be processed.
1: https://github.com/riscv/riscv-openocd/pull/727
2: https://github.com/riscv-collab/riscv-openocd/commit/21433e83eeda7
Change-Id: Id865f191f0fbb48abece8b8558cc9fa2041a26df
Signed-off-by: Tim Newsome <ti...@si...>
Reviewed-on: https://review.openocd.org/c/openocd/+/6964
Reviewed-by: Tomas Vanek <va...@fb...>
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/target/target.c b/src/target/target.c
index 6a21280fc..f862fae7c 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -118,7 +118,7 @@ static struct target_timer_callback *target_timer_callbacks;
static int64_t target_timer_next_event_value;
static OOCD_LIST_HEAD(target_reset_callback_list);
static OOCD_LIST_HEAD(target_trace_callback_list);
-static const int polling_interval = TARGET_DEFAULT_POLLING_INTERVAL;
+static const unsigned int polling_interval = TARGET_DEFAULT_POLLING_INTERVAL;
static OOCD_LIST_HEAD(empty_smp_targets);
enum nvp_assert {
@@ -2869,11 +2869,24 @@ static int sense_handler(void)
return ERROR_OK;
}
+static int handle_one_target(struct target *target)
+{
+ if (!target_active_polled(target) || !target->tap->enabled)
+ return ERROR_OK;
+
+ int res = target_poll(target);
+ if (res == ERROR_OK)
+ return res;
+
+ LOG_TARGET_ERROR(target, "Polling failed, trying to reexamine");
+ target_reset_examined(target);
+ return target_examine_one(target);
+}
+
/* process target state changes */
static int handle_target(void *priv)
{
Jim_Interp *interp = (Jim_Interp *)priv;
- int retval = ERROR_OK;
if (!is_jtag_poll_safe()) {
/* polling is disabled currently */
@@ -2924,56 +2937,34 @@ static int handle_target(void *priv)
recursive = 0;
}
+ if (power_dropout || srst_asserted)
+ return ERROR_OK;
+
+ int retval = ERROR_OK;
/* Poll targets for state changes unless that's globally disabled.
* Skip targets that are currently disabled.
*/
for (struct target *target = all_targets;
is_jtag_poll_safe() && target;
target = target->next) {
-
- if (!target_active_polled(target))
- continue;
-
- if (!target->tap->enabled)
- continue;
-
- if (target->backoff.times > target->backoff.count) {
- /* do not poll this time as we failed previously */
- target->backoff.count++;
+ /* This function only gets called every polling_interval, so
+ * allow some slack in the time comparison. Otherwise, if we
+ * schedule for now+polling_interval, the next poll won't
+ * actually happen until a polling_interval later. */
+ if (timeval_ms() + polling_interval / 2 < target->backoff.next_attempt)
continue;
- }
- target->backoff.count = 0;
- /* only poll target if we've got power and srst isn't asserted */
- if (!power_dropout && !srst_asserted) {
- /* polling may fail silently until the target has been examined */
- retval = target_poll(target);
- if (retval != ERROR_OK) {
- /* 100ms polling interval. Increase interval between polling up to 5000ms */
- if (target->backoff.times * polling_interval < 5000) {
- target->backoff.times *= 2;
- target->backoff.times++;
- }
-
- /* Tell GDB to halt the debugger. This allows the user to
- * run monitor commands to handle the situation.
- */
- target_call_event_callbacks(target, TARGET_EVENT_GDB_HALT);
- }
- if (target->backoff.times > 0) {
- LOG_TARGET_ERROR(target, "Polling failed, trying to reexamine");
- target_reset_examined(target);
- retval = target_examine_one(target);
- if (retval != ERROR_OK) {
- LOG_TARGET_ERROR(target, "Examination failed, GDB will be halted. Polling again in %dms",
- target->backoff.times * polling_interval);
- return retval;
- }
- }
-
- /* Since we succeeded, we reset backoff count */
- target->backoff.times = 0;
+ int tgt_res = handle_one_target(target);
+ if (tgt_res != ERROR_OK) {
+ retval = tgt_res;
+ target->backoff.interval = MAX(polling_interval,
+ MIN(target->backoff.interval * 2u + 1u, TARGET_MAX_POLLING_INTERVAL_MS));
+ } else {
+ target->backoff.interval = polling_interval;
}
+ target->backoff.next_attempt = timeval_ms() + target->backoff.interval;
+ LOG_TARGET_DEBUG_IO(target, "target_poll() -> %d, next attempt in %ums",
+ tgt_res, target->backoff.interval);
}
return retval;
diff --git a/src/target/target.h b/src/target/target.h
index eb4d27a33..ce1fc728b 100644
--- a/src/target/target.h
+++ b/src/target/target.h
@@ -105,8 +105,8 @@ struct gdb_service {
/* target back off timer */
struct backoff_timer {
- int times;
- int count;
+ int64_t next_attempt;
+ unsigned int interval;
};
/* split target registers into multiple class */
@@ -193,6 +193,9 @@ struct target {
struct rtos *rtos; /* Instance of Real Time Operating System support */
bool rtos_auto_detect; /* A flag that indicates that the RTOS has been specified as "auto"
* and must be detected when symbols are offered */
+ /* Track when next to poll(). If polling is failing, we don't want to
+ * poll too quickly because we'll just overwhelm the user with error
+ * messages. */
struct backoff_timer backoff;
unsigned int smp; /* Unique non-zero number for each SMP group */
struct list_head *smp_targets; /* list all targets in this smp group/cluster
@@ -826,7 +829,8 @@ int target_profiling_default(struct target *target, uint32_t *samples, uint32_t
extern bool get_target_reset_nag(void);
-#define TARGET_DEFAULT_POLLING_INTERVAL 100
+#define TARGET_DEFAULT_POLLING_INTERVAL 100u
+#define TARGET_MAX_POLLING_INTERVAL_MS 5000u
const char *target_debug_reason_str(enum target_debug_reason reason);
-----------------------------------------------------------------------
Summary of changes:
src/target/target.c | 99 ++++++++++++++++++++++++-----------------------------
src/target/target.h | 10 ++++--
2 files changed, 52 insertions(+), 57 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-05-17 20:53:25
|
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 822ac747877426b192fd45b62537d6436d30c0c9 (commit)
from 97a11c4f5319a4cdfe8cc1668b4ccf7680c1b639 (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 822ac747877426b192fd45b62537d6436d30c0c9
Author: Marc Schink <de...@za...>
Date: Mon Apr 13 15:58:47 2026 +0000
tcl/board/st: Add NUCLEO-U3C5ZI-Q config
Tested on NUCLEO-U3C5ZI-Q development board.
Change-Id: I236f1fd3c0b75422f125cf4466f245bbb42893b1
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9577
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/tcl/board/st/nucleo-u3c5zi-q.cfg b/tcl/board/st/nucleo-u3c5zi-q.cfg
new file mode 100644
index 000000000..21b8439c1
--- /dev/null
+++ b/tcl/board/st/nucleo-u3c5zi-q.cfg
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+# NUCLEO-U3C5ZI-Q
+# https://www.st.com/en/evaluation-tools/nucleo-u3c5zi-q.html
+
+source [find interface/stlink.cfg]
+
+transport select swd
+
+source [find target/stm32u3x.cfg]
+
+reset_config srst_only
-----------------------------------------------------------------------
Summary of changes:
tcl/board/st/{stm32mp257f-dk.cfg => nucleo-u3c5zi-q.cfg} | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
copy tcl/board/st/{stm32mp257f-dk.cfg => nucleo-u3c5zi-q.cfg} (52%)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-05-17 20:52:36
|
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 97a11c4f5319a4cdfe8cc1668b4ccf7680c1b639 (commit)
from 2a0cc01c6b87c34fe008e9085f514b6c29bfb1d2 (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 97a11c4f5319a4cdfe8cc1668b4ccf7680c1b639
Author: William Markezana <wil...@gm...>
Date: Fri Apr 10 12:45:43 2026 -0400
jtag/drivers: add T-Head CK-Link JTAG adapter driver
Driver for T-Head CK-Link Lite V2 probes, including the Bouffalo Lab
BL616/BL702 CK-Link clones used as built-in debuggers on BL61x/BL70x
evaluation boards. The wire protocol is a framed command format over
USB bulk endpoints, reverse-engineered from T-Head's DebugServer.
Implements JTAG_SCAN via the probe's batch opcode, with IR caching
across execute_queue boundaries and end-of-queue flush so OpenOCD's
Capture-IR validation reads real hardware data. Speed is programmable
(freq_kHz = 48000 / (N+1), capped at the DebugServer-validated 2526
kHz). Probes are matched against a built-in VID/PID list (overridable
via 'adapter usb vid_pid') and by adapter serial.
Known protocol limitations, surfaced as one-time warnings:
- Single batch entry encodes IR/DR bit-counts in single bytes;
scans > 255 bits are clamped with TDI pass-through on the
un-shifted portion.
- The T-Head DTM's Capture-IR returns the current IR value rather
than the IEEE 1149.1 'xxx01' pattern; init pre-loads IR = IDCODE.
- No TMS-sequence opcode: JTAG_TMS and JTAG_PATHMOVE return
ERROR_JTAG_NOT_IMPLEMENTED.
- Multi-TAP chains are not supported.
- RTCK is not supported.
Tested against BL618 and BL702 evaluation boards.
Change-Id: If6adaec0445748f3e97078bf980c502eff4d5001
Signed-off-by: William Markezana <wil...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9586
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/configure.ac b/configure.ac
index 26c854d73..19901770b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -128,6 +128,7 @@ m4_define([USB1_ADAPTERS],
[[[ftdi], [MPSSE mode of FTDI based devices], [FTDI]],
[[ftdi_cjtag], [cJTAG (OScan1, JScan3) tunneled thru MPSSE], [FTDI_CJTAG]],
[[ch347], [CH347 based devices], [CH347]],
+ [[cklink], [T-Head CK-Link JTAG Probe], [CKLINK]],
[[stlink], [ST-Link Programmer], [HLADAPTER_STLINK]],
[[ti_icdi], [TI ICDI JTAG Programmer], [HLADAPTER_ICDI]],
[[ulink], [Keil ULINK JTAG Programmer], [ULINK]],
diff --git a/contrib/60-openocd.rules b/contrib/60-openocd.rules
index 151b4e2c0..775a25f24 100644
--- a/contrib/60-openocd.rules
+++ b/contrib/60-openocd.rules
@@ -254,6 +254,12 @@ ATTRS{idVendor}=="2aec", ATTRS{idProduct}=="1106", MODE="660", GROUP="plugdev",
ATTRS{idVendor}=="303a", ATTRS{idProduct}=="1001", MODE="660", GROUP="plugdev", TAG+="uaccess"
ATTRS{idVendor}=="303a", ATTRS{idProduct}=="1002", MODE="660", GROUP="plugdev", TAG+="uaccess"
+# T-Head CK-Link Lite (PingTouGe Semiconductor)
+ATTRS{idVendor}=="32bf", ATTRS{idProduct}=="b210", MODE="660", GROUP="plugdev", TAG+="uaccess"
+
+# Bouffalo Lab BL616/BL702 CK-Link clones
+ATTRS{idVendor}=="42bf", ATTRS{idProduct}=="b210", MODE="660", GROUP="plugdev", TAG+="uaccess"
+
# ANGIE USB-JTAG Adapter
ATTRS{idVendor}=="584e", ATTRS{idProduct}=="414f", MODE="660", GROUP="plugdev", TAG+="uaccess"
ATTRS{idVendor}=="584e", ATTRS{idProduct}=="424e", MODE="660", GROUP="plugdev", TAG+="uaccess"
diff --git a/doc/openocd.texi b/doc/openocd.texi
index 2b70054f8..b36e45254 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -2617,6 +2617,22 @@ ch347 device_desc "EasyDevKit"
@end deffn
@end deffn
+@deffn {Interface Driver} {cklink}
+Driver for the T-Head CK-Link Lite V2 JTAG probe and Bouffalo Lab
+BL616/BL702 clones, including the built-in debugger on Bouffalo BL618
+evaluation boards. Communication is over USB bulk endpoints using a
+T-Head DebugServer-compatible framed command protocol.
+
+The driver only supports JTAG transport and a single-TAP chain. The
+probe runs at a fixed clock; @command{adapter speed} requests are
+accepted but ignored (with a one-time warning). @command{JTAG_TMS} and
+@command{JTAG_PATHMOVE} are not supported by this probe's protocol.
+
+By default the driver matches 0x42bf/0xb210 (Bouffalo) and
+0x32bf/0xb210 (T-Head). The built-in list can be overridden via
+@command{adapter usb vid_pid}.
+@end deffn
+
@deffn {Interface Driver} {cmsis-dap}
ARM CMSIS-DAP compliant based adapter v1 (USB HID based)
or v2 (USB bulk or TCP/IP).
diff --git a/src/jtag/drivers/Makefile.am b/src/jtag/drivers/Makefile.am
index af97e54aa..82507ad74 100644
--- a/src/jtag/drivers/Makefile.am
+++ b/src/jtag/drivers/Makefile.am
@@ -213,6 +213,9 @@ endif
if CH347
DRIVERFILES += %D%/ch347.c
endif
+if CKLINK
+DRIVERFILES += %D%/cklink.c
+endif
if XVC
DRIVERFILES += %D%/xvc.c
endif
diff --git a/src/jtag/drivers/cklink.c b/src/jtag/drivers/cklink.c
new file mode 100644
index 000000000..0e974fe2e
--- /dev/null
+++ b/src/jtag/drivers/cklink.c
@@ -0,0 +1,747 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+/***************************************************************************
+ * T-Head CK-Link JTAG adapter driver. *
+ * *
+ * Supports the CK-Link Lite V2 wire protocol used by T-Head probes and *
+ * Bouffalo Lab BL616/BL702 CK-Link clones. USB bulk with a framed *
+ * command protocol reverse-engineered from T-Head's DebugServer. *
+ * *
+ * Copyright (C) 2026 by William Markezana *
+ * <wil...@gm...> *
+ * *
+ ***************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <assert.h>
+
+#include <jtag/adapter.h>
+#include <jtag/interface.h>
+#include <jtag/commands.h>
+#include <helper/binarybuffer.h>
+#include <helper/bits.h>
+#include <helper/time_support.h>
+#include "libusb_helper.h"
+
+// USB identification. Defaults can be overridden via `adapter usb vid_pid`.
+#define CKLINK_VID_BOUFFALO 0x42bf
+#define CKLINK_VID_THEAD 0x32bf
+#define CKLINK_PID_LITE_V2 0xb210
+
+#define CKLINK_USB_INTERFACE 0
+#define CKLINK_EP_OUT 0x02
+#define CKLINK_EP_IN 0x81
+#define CKLINK_USB_TIMEOUT_MS 1000
+#define CKLINK_USB_BUF_SIZE 2048
+
+// Wire-protocol framing bytes
+#define CKLINK_FRAME_START 0x68
+#define CKLINK_FRAME_END 0x16
+
+// Response frame layout: start + status + payload + checksum + end
+#define CKLINK_FRAME_OVERHEAD 4
+#define CKLINK_RESP_PAYLOAD_OFFSET 2
+
+// Opcodes
+#define CKLINK_OP_SELFREG_WRITE 0x06
+#define CKLINK_OP_SELFREG_READ 0x87
+#define CKLINK_OP_JTAG_BATCH 0x88
+
+// Self-register indices
+#define CKLINK_SR_CSR 0 // clock divider + CDI mode
+#define CKLINK_SR_MTCR_WAIT 1 // target-comm wait cycles
+#define CKLINK_SR_JTAG_CONFIG 8 // JTAG config word
+#define CKLINK_SELFREG_BYTES 4
+
+/*
+ * Init values replayed from a captured DebugServer session.
+ * sr0 (CSR): byte 0 = clock divider, byte 3 = CDI mode (0x60=5-wire JTAG,
+ * 0x61=2-wire cJTAG). The 5->2->5 mode toggle at end of init acts as a
+ * TAP reset: the wire driver re-initializes on each switch.
+ * sr1 MTCR_WAIT = 1000 cycles. sr8 JTAG_CONFIG: opaque, known-good.
+ */
+#define CKLINK_SR0_SETUP_CLK_BYTE 0x17 // ~2000 kHz
+#define CKLINK_SR0_RUN_CLK_BYTE 0x12 // ~2526 kHz, DebugServer default
+#define CKLINK_SR0_MODE_JTAG 0x60
+#define CKLINK_SR0_MODE_CJTAG 0x61
+#define CKLINK_SR1_INIT_VALUE 0x000003e8
+#define CKLINK_SR8_INIT_VALUE 0x00622250
+
+// freq_kHz = 48000 / (N + 1); cap at DebugServer-validated 0x12.
+#define CKLINK_CLK_SOURCE_KHZ 48000
+#define CKLINK_CLK_DIV_MIN CKLINK_SR0_RUN_CLK_BYTE
+#define CKLINK_CLK_DIV_MAX 0xff
+
+#define CKLINK_CSR(clk, mode) (((uint32_t)(mode) << 24) | (clk))
+
+// Batch opcode encodes IR/DR bit-counts in single bytes.
+#define CKLINK_MAX_SCAN_BITS 255
+#define CKLINK_MAX_SCAN_BYTES 32 // DIV_ROUND_UP(255, 8)
+
+// Synthesized IR when a DR scan arrives without a cached IR.
+#define CKLINK_PLACEHOLDER_IR_BITS 5
+#define CKLINK_PLACEHOLDER_IR_VALUE 0x01
+
+struct cklink_ctx {
+ struct libusb_device_handle *usb_dev;
+ uint8_t tx_buf[CKLINK_USB_BUF_SIZE];
+ uint8_t rx_buf[CKLINK_USB_BUF_SIZE];
+ uint8_t csr_clk;
+ uint8_t ir_value[CKLINK_MAX_SCAN_BYTES];
+ unsigned int ir_bits;
+ struct jtag_command *pending_ir_cmd;
+ uint8_t *scan_tdi;
+ uint8_t *scan_tdo;
+ size_t scan_buf_size;
+ bool long_scan_warned;
+ bool dropped_ir_warned;
+};
+
+static struct cklink_ctx *cklink_handle;
+
+// Built-in VID/PID list, used when `adapter usb vid_pid` is not set.
+static const uint16_t cklink_default_vids[] = {
+ CKLINK_VID_BOUFFALO,
+ CKLINK_VID_THEAD,
+ 0,
+};
+static const uint16_t cklink_default_pids[] = {
+ CKLINK_PID_LITE_V2,
+ CKLINK_PID_LITE_V2,
+ 0,
+};
+
+// Sum-mod-256.
+static uint8_t cklink_checksum(const uint8_t *buf, unsigned int len)
+{
+ uint8_t sum = 0;
+ for (unsigned int i = 0; i < len; i++)
+ sum += buf[i];
+ return sum;
+}
+
+/* Send a framed command; NULL rxlen means fire-and-forget (selfreg writes
+ * are not acknowledged). @p opcode selects the response-checksum rule. */
+static int cklink_usb_xfer(struct cklink_ctx *ck, uint8_t opcode,
+ unsigned int txlen, unsigned int *rxlen)
+{
+ int actual = 0;
+ int ret = jtag_libusb_bulk_write(ck->usb_dev, CKLINK_EP_OUT,
+ (char *)ck->tx_buf, txlen,
+ CKLINK_USB_TIMEOUT_MS, &actual);
+ if (ret != ERROR_OK || (unsigned int)actual != txlen) {
+ LOG_ERROR("CK-Link bulk write failed (ret=%d, actual=%d/%d)",
+ ret, actual, txlen);
+ return ERROR_FAIL;
+ }
+
+ if (!rxlen)
+ return ERROR_OK;
+
+ ret = jtag_libusb_bulk_read(ck->usb_dev, CKLINK_EP_IN,
+ (char *)ck->rx_buf, CKLINK_USB_BUF_SIZE,
+ CKLINK_USB_TIMEOUT_MS, &actual);
+ if (ret != ERROR_OK || actual < (int)CKLINK_FRAME_OVERHEAD) {
+ LOG_ERROR("CK-Link bulk read failed (ret=%d, actual=%d)",
+ ret, actual);
+ return ERROR_FAIL;
+ }
+ if (ck->rx_buf[0] != CKLINK_FRAME_START) {
+ LOG_ERROR("CK-Link bad response start byte 0x%02x",
+ ck->rx_buf[0]);
+ return ERROR_FAIL;
+ }
+ if (ck->rx_buf[actual - 1] != CKLINK_FRAME_END) {
+ LOG_ERROR("CK-Link bad response end byte 0x%02x",
+ ck->rx_buf[actual - 1]);
+ return ERROR_FAIL;
+ }
+ /*
+ * RX checksum is opcode-specific: selfreg reads sum all payload;
+ * single-entry JTAG batch sums all except the last byte of dr_tdo.
+ */
+ unsigned int csum_end = actual - ((opcode == CKLINK_OP_JTAG_BATCH) ? 3 : 2);
+ uint8_t computed = cklink_checksum(ck->rx_buf, csum_end);
+ if (computed != ck->rx_buf[actual - 2]) {
+ LOG_ERROR("CK-Link response checksum mismatch: op=0x%02x stated=0x%02x computed=0x%02x",
+ opcode, ck->rx_buf[actual - 2], computed);
+ return ERROR_FAIL;
+ }
+ // Status byte semantics undocumented; log non-zero for traces.
+ if (ck->rx_buf[1] != 0) {
+ LOG_DEBUG("CK-Link op=0x%02x returned status=0x%02x",
+ opcode, ck->rx_buf[1]);
+ }
+ *rxlen = (unsigned int)actual;
+ return ERROR_OK;
+}
+
+static unsigned int cklink_frame_start(struct cklink_ctx *ck, uint8_t opcode)
+{
+ ck->tx_buf[0] = CKLINK_FRAME_START;
+ ck->tx_buf[1] = opcode;
+ return 2;
+}
+
+static unsigned int cklink_frame_end(struct cklink_ctx *ck, unsigned int pos)
+{
+ assert(pos + 2 <= CKLINK_USB_BUF_SIZE);
+ ck->tx_buf[pos] = cklink_checksum(ck->tx_buf, pos);
+ ck->tx_buf[pos + 1] = CKLINK_FRAME_END;
+ return pos + 2;
+}
+
+static int cklink_selfreg_write(struct cklink_ctx *ck, uint8_t reg,
+ const uint8_t *value)
+{
+ unsigned int pos = cklink_frame_start(ck, CKLINK_OP_SELFREG_WRITE);
+ ck->tx_buf[pos++] = reg;
+ memcpy(&ck->tx_buf[pos], value, CKLINK_SELFREG_BYTES);
+ pos += CKLINK_SELFREG_BYTES;
+ pos = cklink_frame_end(ck, pos);
+ return cklink_usb_xfer(ck, CKLINK_OP_SELFREG_WRITE, pos, NULL);
+}
+
+static int cklink_selfreg_read(struct cklink_ctx *ck, uint8_t reg, uint8_t *value)
+{
+ unsigned int pos = cklink_frame_start(ck, CKLINK_OP_SELFREG_READ);
+ ck->tx_buf[pos++] = reg;
+ pos = cklink_frame_end(ck, pos);
+
+ unsigned int rxlen = 0;
+ int ret = cklink_usb_xfer(ck, CKLINK_OP_SELFREG_READ, pos, &rxlen);
+ if (ret != ERROR_OK)
+ return ret;
+
+ const unsigned int expected = CKLINK_FRAME_OVERHEAD + CKLINK_SELFREG_BYTES;
+ if (rxlen < expected) {
+ LOG_ERROR("CK-Link selfreg read response too short (%u < %u)",
+ rxlen, expected);
+ return ERROR_FAIL;
+ }
+ memcpy(value, &ck->rx_buf[CKLINK_RESP_PAYLOAD_OFFSET],
+ CKLINK_SELFREG_BYTES);
+ return ERROR_OK;
+}
+
+/* Single-entry batch scan. Scans > 255 bits are clamped with a one-time
+ * warning: chunking across entries breaks Shift-DR continuity, and
+ * erroring out here breaks OpenOCD's chain probe's -expected-id recovery. */
+static int cklink_jtag_scan(struct cklink_ctx *ck,
+ unsigned int ir_bits, const uint8_t *ir_tdi,
+ uint8_t *ir_tdo,
+ unsigned int dr_bits, const uint8_t *dr_tdi,
+ uint8_t *dr_tdo)
+{
+ if ((ir_bits > CKLINK_MAX_SCAN_BITS || dr_bits > CKLINK_MAX_SCAN_BITS)
+ && !ck->long_scan_warned) {
+ LOG_WARNING("CK-Link: scan exceeds %u-bit per-entry limit (ir=%u dr=%u); clamping",
+ CKLINK_MAX_SCAN_BITS, ir_bits, dr_bits);
+ ck->long_scan_warned = true;
+ }
+ if (ir_bits > CKLINK_MAX_SCAN_BITS)
+ ir_bits = CKLINK_MAX_SCAN_BITS;
+ if (dr_bits > CKLINK_MAX_SCAN_BITS)
+ dr_bits = CKLINK_MAX_SCAN_BITS;
+
+ const unsigned int ir_bytes = DIV_ROUND_UP(ir_bits, 8);
+ const unsigned int dr_bytes = DIV_ROUND_UP(dr_bits, 8);
+
+ unsigned int pos = cklink_frame_start(ck, CKLINK_OP_JTAG_BATCH);
+ ck->tx_buf[pos++] = 0; // entry_count - 1
+ ck->tx_buf[pos++] = (uint8_t)ir_bits;
+ if (ir_tdi)
+ memcpy(&ck->tx_buf[pos], ir_tdi, ir_bytes);
+ else
+ memset(&ck->tx_buf[pos], 0, ir_bytes);
+ pos += ir_bytes;
+ ck->tx_buf[pos++] = (uint8_t)dr_bits;
+ if (dr_tdi)
+ memcpy(&ck->tx_buf[pos], dr_tdi, dr_bytes);
+ else
+ memset(&ck->tx_buf[pos], 0, dr_bytes);
+ pos += dr_bytes;
+ pos = cklink_frame_end(ck, pos);
+
+ unsigned int rxlen = 0;
+ int ret = cklink_usb_xfer(ck, CKLINK_OP_JTAG_BATCH, pos, &rxlen);
+ if (ret != ERROR_OK)
+ return ret;
+
+ // Response: start + status + ir_tdo + dr_echo + dr_tdo + csum + end.
+ const unsigned int expected =
+ CKLINK_FRAME_OVERHEAD + ir_bytes + 1 + dr_bytes;
+ if (rxlen < expected) {
+ LOG_ERROR("CK-Link scan response truncated: got %u, need %u (ir=%u dr=%u)",
+ rxlen, expected, ir_bits, dr_bits);
+ return ERROR_FAIL;
+ }
+
+ if (ir_tdo && ir_bytes)
+ memcpy(ir_tdo, &ck->rx_buf[CKLINK_RESP_PAYLOAD_OFFSET], ir_bytes);
+
+ const unsigned int dr_tdo_offset =
+ CKLINK_RESP_PAYLOAD_OFFSET + ir_bytes + 1;
+ if (dr_tdo)
+ memcpy(dr_tdo, &ck->rx_buf[dr_tdo_offset], dr_bytes);
+
+ return ERROR_OK;
+}
+
+// Shift num_bits of idle cycles, chunked to the 255-bit protocol limit.
+static int cklink_idle_cycles(struct cklink_ctx *ck, unsigned int num_bits)
+{
+ static const uint8_t zeros[CKLINK_MAX_SCAN_BYTES] = { 0 };
+
+ while (num_bits > 0) {
+ unsigned int chunk = num_bits > CKLINK_MAX_SCAN_BITS
+ ? CKLINK_MAX_SCAN_BITS : num_bits;
+ int ret = cklink_jtag_scan(ck, 0, NULL, NULL,
+ chunk, zeros, NULL);
+ if (ret != ERROR_OK)
+ return ret;
+ num_bits -= chunk;
+ }
+ return ERROR_OK;
+}
+
+/* Flush a pending IR with a 1-bit dummy DR so its in_value gets populated
+ * with real captured IR TDO. Called at end of execute_queue so Capture-IR
+ * validation sees real hardware data. */
+static int cklink_flush_pending_ir(struct cklink_ctx *ck)
+{
+ if (!ck || !ck->pending_ir_cmd)
+ return ERROR_OK;
+
+ uint8_t ir_tdo[CKLINK_MAX_SCAN_BYTES] = { 0 };
+ uint8_t dummy_dr = 0;
+ int ret = cklink_jtag_scan(ck, ck->ir_bits, ck->ir_value, ir_tdo,
+ 1, &dummy_dr, NULL);
+ if (ret != ERROR_OK)
+ return ret;
+
+ struct scan_command *scan = ck->pending_ir_cmd->cmd.scan;
+ unsigned int off = 0;
+ for (unsigned int i = 0; i < scan->num_fields; i++) {
+ struct scan_field *f = &scan->fields[i];
+ if (f->in_value) {
+ buf_set_buf(ir_tdo, off, f->in_value, 0,
+ f->num_bits);
+ }
+ off += f->num_bits;
+ }
+ ck->pending_ir_cmd = NULL;
+ // ir_bits/ir_value stay valid: hardware IR is still what we cached.
+ return ERROR_OK;
+}
+
+static int cklink_execute_scan(struct cklink_ctx *ck, struct jtag_command *cmd)
+{
+ struct scan_command *scan = cmd->cmd.scan;
+
+ unsigned int total_bits = 0;
+ for (unsigned int i = 0; i < scan->num_fields; i++)
+ total_bits += scan->fields[i].num_bits;
+
+ if (total_bits == 0)
+ return ERROR_OK;
+
+ const unsigned int total_bytes = DIV_ROUND_UP(total_bits, 8);
+ if (total_bytes > ck->scan_buf_size) {
+ uint8_t *ntdi = realloc(ck->scan_tdi, total_bytes);
+ uint8_t *ntdo = realloc(ck->scan_tdo, total_bytes);
+ if (!ntdi || !ntdo) {
+ LOG_ERROR("CK-Link: out of memory for %u-bit scan",
+ total_bits);
+ // Partial success is fine; freed in cklink_quit.
+ if (ntdi)
+ ck->scan_tdi = ntdi;
+ if (ntdo)
+ ck->scan_tdo = ntdo;
+ return ERROR_FAIL;
+ }
+ ck->scan_tdi = ntdi;
+ ck->scan_tdo = ntdo;
+ ck->scan_buf_size = total_bytes;
+ }
+ memset(ck->scan_tdi, 0, total_bytes);
+ memset(ck->scan_tdo, 0, total_bytes);
+
+ unsigned int bit_offset = 0;
+ for (unsigned int i = 0; i < scan->num_fields; i++) {
+ struct scan_field *field = &scan->fields[i];
+ if (field->out_value) {
+ buf_set_buf(field->out_value, 0, ck->scan_tdi,
+ bit_offset, field->num_bits);
+ }
+ bit_offset += field->num_bits;
+ }
+
+ if (scan->ir_scan) {
+ /*
+ * Defer IR until paired with a DR (batch needs both).
+ * Back-to-back IR drops the first: mid-queue flush would
+ * cycle Capture-DR/Update-DR on the previous IR's register
+ * (e.g. DMI), triggering spurious transactions.
+ */
+ if (total_bytes > sizeof(ck->ir_value)) {
+ LOG_ERROR("CK-Link: IR scan of %u bits exceeds cache (%zu bytes)",
+ total_bits, sizeof(ck->ir_value));
+ return ERROR_JTAG_QUEUE_FAILED;
+ }
+ if (ck->pending_ir_cmd) {
+ if (!ck->dropped_ir_warned) {
+ LOG_WARNING("CK-Link: back-to-back IR scan dropped pending IR; multi-TAP chains are not supported");
+ ck->dropped_ir_warned = true;
+ } else {
+ LOG_DEBUG("CK-Link: dropping pending IR (%u bits) before new IR scan",
+ ck->ir_bits);
+ }
+ }
+ memcpy(ck->ir_value, ck->scan_tdi, total_bytes);
+ ck->ir_bits = total_bits;
+ ck->pending_ir_cmd = cmd;
+ return ERROR_OK;
+ }
+
+ // No cached IR yet: inject IDCODE placeholder so chain detection works.
+ const uint8_t placeholder_ir = CKLINK_PLACEHOLDER_IR_VALUE;
+ const unsigned int eff_ir_bits = ck->ir_bits ? ck->ir_bits
+ : CKLINK_PLACEHOLDER_IR_BITS;
+ const uint8_t *eff_ir_value = ck->ir_bits ? ck->ir_value : &placeholder_ir;
+ if (!ck->ir_bits)
+ LOG_DEBUG("CK-Link: DR scan with no cached IR; injecting IDCODE placeholder");
+
+ uint8_t ir_tdo_buf[CKLINK_MAX_SCAN_BYTES] = { 0 };
+ int ret = cklink_jtag_scan(ck, eff_ir_bits, eff_ir_value, ir_tdo_buf,
+ total_bits, ck->scan_tdi, ck->scan_tdo);
+ if (ret != ERROR_OK)
+ return ret;
+
+ // Scatter captured IR TDO back into the deferred IR command's fields.
+ if (ck->pending_ir_cmd) {
+ struct scan_command *ir_scan = ck->pending_ir_cmd->cmd.scan;
+ unsigned int ir_off = 0;
+ for (unsigned int i = 0; i < ir_scan->num_fields; i++) {
+ struct scan_field *f = &ir_scan->fields[i];
+ if (f->in_value) {
+ buf_set_buf(ir_tdo_buf, ir_off,
+ f->in_value, 0, f->num_bits);
+ }
+ ir_off += f->num_bits;
+ }
+ ck->pending_ir_cmd = NULL;
+ }
+
+ /*
+ * For clamped scans, fill un-shifted TDO with caller's TDI (models
+ * "no more TAPs past the limit" - a bare wire). Gives OpenOCD's
+ * bypass chain-length probe the expected end-of-chain marker.
+ */
+ if (total_bits > CKLINK_MAX_SCAN_BITS) {
+ buf_set_buf(ck->scan_tdi, CKLINK_MAX_SCAN_BITS,
+ ck->scan_tdo, CKLINK_MAX_SCAN_BITS,
+ total_bits - CKLINK_MAX_SCAN_BITS);
+ }
+
+ bit_offset = 0;
+ for (unsigned int i = 0; i < scan->num_fields; i++) {
+ struct scan_field *field = &scan->fields[i];
+ if (field->in_value) {
+ buf_set_buf(ck->scan_tdo, bit_offset,
+ field->in_value, 0, field->num_bits);
+ }
+ bit_offset += field->num_bits;
+ }
+
+ return ERROR_OK;
+}
+
+static int cklink_write_csr(struct cklink_ctx *ck, uint8_t clk, uint8_t mode)
+{
+ uint8_t buf[CKLINK_SELFREG_BYTES];
+ h_u32_to_le(buf, CKLINK_CSR(clk, mode));
+ return cklink_selfreg_write(ck, CKLINK_SR_CSR, buf);
+}
+
+// khz -> sr0 byte 0 divider, rounded up so we never exceed the request.
+static uint8_t cklink_khz_to_div(int khz)
+{
+ if (khz <= 0)
+ return CKLINK_CLK_DIV_MAX;
+ int n = ((CKLINK_CLK_SOURCE_KHZ + khz - 1) / khz) - 1;
+ if (n < CKLINK_CLK_DIV_MIN)
+ n = CKLINK_CLK_DIV_MIN;
+ if (n > CKLINK_CLK_DIV_MAX)
+ n = CKLINK_CLK_DIV_MAX;
+ return (uint8_t)n;
+}
+
+static int cklink_execute_tlr_reset(struct cklink_ctx *ck)
+{
+ // Probe-side reset via 5->2->5 mode toggle; target TAP reset not guaranteed.
+ int ret;
+
+ ret = cklink_write_csr(ck, ck->csr_clk, CKLINK_SR0_MODE_CJTAG);
+ if (ret != ERROR_OK)
+ return ret;
+ ret = cklink_write_csr(ck, ck->csr_clk, CKLINK_SR0_MODE_CJTAG);
+ if (ret != ERROR_OK)
+ return ret;
+ ret = cklink_write_csr(ck, ck->csr_clk, CKLINK_SR0_MODE_JTAG);
+ if (ret != ERROR_OK)
+ return ret;
+
+ ck->ir_bits = 0;
+ memset(ck->ir_value, 0, sizeof(ck->ir_value));
+ ck->pending_ir_cmd = NULL;
+ tap_set_state(TAP_RESET);
+ return ERROR_OK;
+}
+
+static int cklink_execute_runtest(struct cklink_ctx *ck, struct jtag_command *cmd)
+{
+ return cklink_idle_cycles(ck, cmd->cmd.runtest->num_cycles);
+}
+
+static int cklink_execute_stableclocks(struct cklink_ctx *ck, struct jtag_command *cmd)
+{
+ // TMS=0 shifts only hold state in RTI; other stable states would advance.
+ return cklink_idle_cycles(ck, cmd->cmd.stableclocks->num_cycles);
+}
+
+static int cklink_execute_tms(struct jtag_command *cmd)
+{
+ // No TMS-sequence opcode: honoring JTAG_TMS is impossible.
+ LOG_ERROR("CK-Link: JTAG_TMS (%u bits) is not supported by this probe",
+ cmd->cmd.tms->num_bits);
+ return ERROR_JTAG_NOT_IMPLEMENTED;
+}
+
+static int cklink_execute_reset(struct cklink_ctx *ck, struct jtag_command *cmd)
+{
+ // Only TRST is meaningful here: we have no separate SRST control.
+ if (cmd->cmd.reset->trst)
+ return cklink_execute_tlr_reset(ck);
+ return ERROR_OK;
+}
+
+static int cklink_execute_queue(struct jtag_command *cmd_queue)
+{
+ struct cklink_ctx *ck = cklink_handle;
+ if (!ck)
+ return ERROR_JTAG_INIT_FAILED;
+
+ for (struct jtag_command *cmd = cmd_queue; cmd; cmd = cmd->next) {
+ int ret;
+
+ switch (cmd->type) {
+ case JTAG_SCAN:
+ ret = cklink_execute_scan(ck, cmd);
+ break;
+ case JTAG_TLR_RESET:
+ ret = cklink_execute_tlr_reset(ck);
+ break;
+ case JTAG_RUNTEST:
+ ret = cklink_execute_runtest(ck, cmd);
+ break;
+ case JTAG_RESET:
+ ret = cklink_execute_reset(ck, cmd);
+ break;
+ case JTAG_PATHMOVE:
+ // No TMS-sequence opcode: honoring PATHMOVE is impossible.
+ LOG_ERROR("CK-Link: JTAG_PATHMOVE is not supported by this probe");
+ ret = ERROR_JTAG_NOT_IMPLEMENTED;
+ break;
+ case JTAG_STABLECLOCKS:
+ ret = cklink_execute_stableclocks(ck, cmd);
+ break;
+ case JTAG_TMS:
+ ret = cklink_execute_tms(cmd);
+ break;
+ case JTAG_SLEEP:
+ jtag_sleep(cmd->cmd.sleep->us);
+ ret = ERROR_OK;
+ break;
+ default:
+ LOG_ERROR("CK-Link: unsupported JTAG command %d",
+ cmd->type);
+ return ERROR_JTAG_QUEUE_FAILED;
+ }
+ if (ret != ERROR_OK)
+ return ret;
+ }
+ // Flush so any un-paired IR's in_value is populated before OpenOCD reads.
+ return cklink_flush_pending_ir(ck);
+}
+
+static int cklink_probe_init(struct cklink_ctx *ck)
+{
+ uint8_t sr1[CKLINK_SELFREG_BYTES];
+ uint8_t sr8[CKLINK_SELFREG_BYTES];
+ uint8_t readback[CKLINK_SELFREG_BYTES];
+ int ret;
+
+ h_u32_to_le(sr1, CKLINK_SR1_INIT_VALUE);
+ h_u32_to_le(sr8, CKLINK_SR8_INIT_VALUE);
+
+ // Configure at slow clock for cold-boot signal-integrity margin.
+ ret = cklink_write_csr(ck, CKLINK_SR0_SETUP_CLK_BYTE,
+ CKLINK_SR0_MODE_JTAG);
+ if (ret != ERROR_OK)
+ return ret;
+ ret = cklink_selfreg_write(ck, CKLINK_SR_MTCR_WAIT, sr1);
+ if (ret != ERROR_OK)
+ return ret;
+ ret = cklink_selfreg_write(ck, CKLINK_SR_JTAG_CONFIG, sr8);
+ if (ret != ERROR_OK)
+ return ret;
+ ret = cklink_write_csr(ck, CKLINK_SR0_RUN_CLK_BYTE,
+ CKLINK_SR0_MODE_JTAG);
+ if (ret != ERROR_OK)
+ return ret;
+
+ ret = cklink_selfreg_read(ck, CKLINK_SR_CSR, readback);
+ if (ret != ERROR_OK)
+ return ret;
+ if (readback[3] != CKLINK_SR0_MODE_JTAG) {
+ LOG_WARNING("CK-Link: sr0 mode byte is 0x%02x, expected 0x%02x (5-wire JTAG)",
+ readback[3], CKLINK_SR0_MODE_JTAG);
+ }
+ ck->csr_clk = CKLINK_SR0_RUN_CLK_BYTE;
+
+ // Pre-load IR = IDCODE; 1-bit DR is the minimum the batch opcode accepts.
+ const uint8_t idcode_ir = CKLINK_PLACEHOLDER_IR_VALUE;
+ const uint8_t dummy_dr = 0;
+ return cklink_jtag_scan(ck, CKLINK_PLACEHOLDER_IR_BITS, &idcode_ir, NULL,
+ 1, &dummy_dr, NULL);
+}
+
+static int cklink_init(void)
+{
+ struct cklink_ctx *ck = calloc(1, sizeof(*ck));
+ if (!ck) {
+ LOG_ERROR("CK-Link: out of memory");
+ return ERROR_JTAG_INIT_FAILED;
+ }
+
+ const uint16_t *vids = adapter_usb_get_vids();
+ const uint16_t *pids = adapter_usb_get_pids();
+ if (!vids[0] || !pids[0]) {
+ vids = cklink_default_vids;
+ pids = cklink_default_pids;
+ }
+
+ const char *serial = adapter_get_required_serial();
+ if (jtag_libusb_open(vids, pids, serial,
+ &ck->usb_dev, NULL) != ERROR_OK) {
+ LOG_ERROR("CK-Link probe not found");
+ free(ck);
+ return ERROR_JTAG_INIT_FAILED;
+ }
+
+ libusb_set_auto_detach_kernel_driver(ck->usb_dev, 1);
+
+ int claim = libusb_claim_interface(ck->usb_dev, CKLINK_USB_INTERFACE);
+ if (claim != 0) {
+ LOG_ERROR("CK-Link: failed to claim interface %d: %s",
+ CKLINK_USB_INTERFACE, libusb_error_name(claim));
+ jtag_libusb_close(ck->usb_dev);
+ free(ck);
+ return ERROR_JTAG_INIT_FAILED;
+ }
+
+ if (cklink_probe_init(ck) != ERROR_OK) {
+ LOG_ERROR("CK-Link: probe initialization failed");
+ libusb_release_interface(ck->usb_dev, CKLINK_USB_INTERFACE);
+ jtag_libusb_close(ck->usb_dev);
+ free(ck);
+ return ERROR_JTAG_INIT_FAILED;
+ }
+
+ cklink_handle = ck;
+ tap_set_state(TAP_RESET);
+ LOG_INFO("CK-Link Lite V2 initialized (5-wire JTAG)");
+ return ERROR_OK;
+}
+
+static int cklink_quit(void)
+{
+ if (!cklink_handle)
+ return ERROR_OK;
+
+ libusb_release_interface(cklink_handle->usb_dev,
+ CKLINK_USB_INTERFACE);
+ jtag_libusb_close(cklink_handle->usb_dev);
+ free(cklink_handle->scan_tdi);
+ free(cklink_handle->scan_tdo);
+ free(cklink_handle);
+ cklink_handle = NULL;
+ return ERROR_OK;
+}
+
+static int cklink_speed(int speed)
+{
+ struct cklink_ctx *ck = cklink_handle;
+ if (!ck)
+ return ERROR_OK; // called before init
+
+ uint8_t div = cklink_khz_to_div(speed);
+ if (div == ck->csr_clk)
+ return ERROR_OK;
+ int ret = cklink_write_csr(ck, div, CKLINK_SR0_MODE_JTAG);
+ if (ret != ERROR_OK)
+ return ret;
+ ck->csr_clk = div;
+ int actual = CKLINK_CLK_SOURCE_KHZ / (div + 1);
+ LOG_DEBUG("CK-Link: adapter speed: requested %d kHz, programmed %d kHz (div=0x%02x)",
+ speed, actual, div);
+ return ERROR_OK;
+}
+
+static int cklink_khz(int khz, int *jtag_speed)
+{
+ if (khz == 0) {
+ LOG_ERROR("CK-Link: adaptive clocking (RTCK) is not supported");
+ return ERROR_JTAG_NOT_IMPLEMENTED;
+ }
+ uint8_t div = cklink_khz_to_div(khz);
+ int achievable = CKLINK_CLK_SOURCE_KHZ / (div + 1);
+ if (achievable != khz) {
+ static int last_clamp_khz;
+ if (khz != last_clamp_khz) {
+ LOG_WARNING("CK-Link: requested %d kHz clamped to %d kHz (div=0x%02x)",
+ khz, achievable, div);
+ last_clamp_khz = khz;
+ }
+ }
+ *jtag_speed = achievable;
+ return ERROR_OK;
+}
+
+static int cklink_speed_div(int speed, int *khz)
+{
+ *khz = speed;
+ return ERROR_OK;
+}
+
+static struct jtag_interface cklink_jtag_interface = {
+ .execute_queue = cklink_execute_queue,
+};
+
+struct adapter_driver cklink_adapter_driver = {
+ .name = "cklink",
+ .transport_ids = TRANSPORT_JTAG,
+ .transport_preferred_id = TRANSPORT_JTAG,
+
+ .init = cklink_init,
+ .quit = cklink_quit,
+ .speed = cklink_speed,
+ .khz = cklink_khz,
+ .speed_div = cklink_speed_div,
+
+ .jtag_ops = &cklink_jtag_interface,
+};
diff --git a/src/jtag/interface.h b/src/jtag/interface.h
index ab68dd777..d5f6d747f 100644
--- a/src/jtag/interface.h
+++ b/src/jtag/interface.h
@@ -380,6 +380,7 @@ extern struct adapter_driver at91rm9200_adapter_driver;
extern struct adapter_driver bcm2835gpio_adapter_driver;
extern struct adapter_driver buspirate_adapter_driver;
extern struct adapter_driver ch347_adapter_driver;
+extern struct adapter_driver cklink_adapter_driver;
extern struct adapter_driver cmsis_dap_adapter_driver;
extern struct adapter_driver dmem_dap_adapter_driver;
extern struct adapter_driver dummy_adapter_driver;
diff --git a/src/jtag/interfaces.c b/src/jtag/interfaces.c
index 173f2fc1b..657b1b310 100644
--- a/src/jtag/interfaces.c
+++ b/src/jtag/interfaces.c
@@ -62,6 +62,9 @@ struct adapter_driver *adapter_drivers[] = {
#if BUILD_CH347 == 1
&ch347_adapter_driver,
#endif
+#if BUILD_CKLINK == 1
+ &cklink_adapter_driver,
+#endif
#if BUILD_CMSIS_DAP_USB == 1 || BUILD_CMSIS_DAP_HID == 1 || BUILD_CMSIS_DAP_TCP == 1
&cmsis_dap_adapter_driver,
#endif
diff --git a/tcl/interface/cklink.cfg b/tcl/interface/cklink.cfg
new file mode 100644
index 000000000..fb017aa05
--- /dev/null
+++ b/tcl/interface/cklink.cfg
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# T-Head CK-Link JTAG adapter (including Bouffalo BL616/BL702 clones)
+#
+
+adapter driver cklink
-----------------------------------------------------------------------
Summary of changes:
configure.ac | 1 +
contrib/60-openocd.rules | 6 +
doc/openocd.texi | 16 +
src/jtag/drivers/Makefile.am | 3 +
src/jtag/drivers/cklink.c | 747 +++++++++++++++++++++++++++++++++++++++++++
src/jtag/interface.h | 1 +
src/jtag/interfaces.c | 3 +
tcl/interface/cklink.cfg | 6 +
8 files changed, 783 insertions(+)
create mode 100644 src/jtag/drivers/cklink.c
create mode 100644 tcl/interface/cklink.cfg
hooks/post-receive
--
Main OpenOCD repository
|