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
(43) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
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
|
|
From: openocd-gerrit <ope...@us...> - 2026-05-17 20:50: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 2a0cc01c6b87c34fe008e9085f514b6c29bfb1d2 (commit)
via 24176654e292a6be285bc8ee2c80b92d1be6ab86 (commit)
from f9212ff31137ee8656cdf99ccac9d74cbd7164d6 (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 2a0cc01c6b87c34fe008e9085f514b6c29bfb1d2
Author: Antonio Borneo <bor...@gm...>
Date: Sun Mar 29 23:58:44 2026 +0200
rtos: linux: drop local get_buffer()
Local get_buffer() is just a dummy wrapper around
target_buffer_get_u32().
Drop the local function and use target_buffer_get_u32().
Change-Id: Iad9ee8622425aef2163522dea16eaeabb86a3f04
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9553
Tested-by: jenkins
diff --git a/src/rtos/linux.c b/src/rtos/linux.c
index 625e84740..92854a4b6 100644
--- a/src/rtos/linux.c
+++ b/src/rtos/linux.c
@@ -145,11 +145,6 @@ static int fill_buffer(struct target *target, uint32_t addr, uint8_t *buffer)
}
-static uint32_t get_buffer(struct target *target, const uint8_t *buffer)
-{
- return target_buffer_get_u32(target, buffer);
-}
-
static int linux_os_thread_reg_list(struct rtos *rtos,
int64_t thread_id, struct rtos_reg **reg_list, int *num_regs)
{
@@ -268,7 +263,7 @@ int fill_task_pid(struct target *target, struct threads *t)
int retval = fill_buffer(target, pid_addr, buffer);
if (retval == ERROR_OK) {
- uint32_t val = get_buffer(target, buffer);
+ uint32_t val = target_buffer_get_u32(target, buffer);
t->pid = val;
} else
LOG_ERROR("fill_task_pid: unable to read memory");
@@ -287,7 +282,7 @@ static int fill_task(struct target *target, struct threads *t)
retval = fill_buffer(target, t->base_addr, buffer);
if (retval == ERROR_OK) {
- uint32_t val = get_buffer(target, buffer);
+ uint32_t val = target_buffer_get_u32(target, buffer);
t->state = val;
} else
LOG_ERROR("fill_task: unable to read memory");
@@ -295,7 +290,7 @@ static int fill_task(struct target *target, struct threads *t)
retval = fill_buffer(target, pid_addr, buffer);
if (retval == ERROR_OK) {
- uint32_t val = get_buffer(target, buffer);
+ uint32_t val = target_buffer_get_u32(target, buffer);
t->pid = val;
} else
LOG_ERROR("fill task: unable to read memory");
@@ -303,7 +298,7 @@ static int fill_task(struct target *target, struct threads *t)
retval = fill_buffer(target, on_cpu, buffer);
if (retval == ERROR_OK) {
- uint32_t val = get_buffer(target, buffer);
+ uint32_t val = target_buffer_get_u32(target, buffer);
t->oncpu = val;
} else
LOG_ERROR("fill task: unable to read memory");
@@ -311,14 +306,14 @@ static int fill_task(struct target *target, struct threads *t)
retval = fill_buffer(target, mem_addr, buffer);
if (retval == ERROR_OK) {
- uint32_t val = get_buffer(target, buffer);
+ uint32_t val = target_buffer_get_u32(target, buffer);
if (val != 0) {
uint32_t asid_addr = val + MM_CTX;
retval = fill_buffer(target, asid_addr, buffer);
if (retval == ERROR_OK) {
- val = get_buffer(target, buffer);
+ val = target_buffer_get_u32(target, buffer);
t->asid = val;
} else
LOG_ERROR
@@ -412,18 +407,18 @@ static int get_current(struct target *target, int create)
reg_list[13]->type->get(reg_list[13]);
buf = reg_list[13]->value;
- val = get_buffer(target, buf);
+ val = target_buffer_get_u32(target, buf);
ti_addr = (val & 0xffffe000);
uint32_t ts_addr = ti_addr + 0xc;
retval = fill_buffer(target, ts_addr, buffer);
if (retval == ERROR_OK) {
- uint32_t TS = get_buffer(target, buffer);
+ uint32_t TS = target_buffer_get_u32(target, buffer);
uint32_t cpu, on_cpu = TS + ONCPU;
retval = fill_buffer(target, on_cpu, buffer);
if (retval == ERROR_OK) {
- /*uint32_t cpu = get_buffer(target, buffer);*/
+ /*uint32_t cpu = target_buffer_get_u32(target, buffer);*/
struct current_thread *ct =
linux_os->current_threads;
cpu = head->target->coreid;
@@ -492,7 +487,7 @@ retry:
retval = fill_buffer(target, stack, buffer);
if (retval == ERROR_OK)
- thread_info_addr = get_buffer(target, buffer);
+ thread_info_addr = target_buffer_get_u32(target, buffer);
else
LOG_ERROR("cpu_context: unable to read memory");
@@ -504,7 +499,7 @@ retry:
retval = fill_buffer(target, preempt_count_addr, buffer);
if (retval == ERROR_OK)
- context->preempt_count = get_buffer(target, buffer);
+ context->preempt_count = target_buffer_get_u32(target, buffer);
else {
if (*thread_info_addr_old != 0xdeadbeef) {
LOG_ERROR
@@ -568,7 +563,7 @@ static uint32_t next_task(struct target *target, struct threads *t)
int retval = fill_buffer(target, next_addr, buffer);
if (retval == ERROR_OK) {
- uint32_t val = get_buffer(target, buffer);
+ uint32_t val = target_buffer_get_u32(target, buffer);
val = val - NEXT;
free(buffer);
return val;
commit 24176654e292a6be285bc8ee2c80b92d1be6ab86
Author: Antonio Borneo <bor...@gm...>
Date: Sun Mar 29 23:29:18 2026 +0200
openocd: simplify return path dropping temp variable
Detect the pattern:
variable = expression;
return variable;
replace it with:
return expression;
and if the temporarily variable is not anymore used, remove it.
This patch has been implemented with a simple coccinelle script
// Step 1: simplify `v = e; return v;` -> `return e;`
@@
identifier v;
expression e;
@@
- v = e;
- return v;
+ return e;
// Step 2: drop declaration of v if it is never used
@@
identifier v;
type T;
@@
- T v;
... when != v
which is nice but not fully trustable as it:
- uses default 8 space TAB indentation;
- replaces also non-local variables;
- drops comments at the end of the modified line;
- doesn't drop useless parenthesis.
Also some replacement makes the code less readable, so the whole
has been manually checked and fixed.
While step 1 in the script is very fast, step 2 is deadly slow.
Change-Id: Id7a8e3f03696f2fbb0237e4a71add0d5ccc1b7df
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9552
Tested-by: jenkins
Reviewed-by: zapb <de...@za...>
diff --git a/src/flash/nand/arm_io.c b/src/flash/nand/arm_io.c
index dd012e161..8261c6386 100644
--- a/src/flash/nand/arm_io.c
+++ b/src/flash/nand/arm_io.c
@@ -56,10 +56,8 @@ static int arm_code_to_working_area(struct target *target,
target_buffer_set_u32_array(target, code_buf, code_size / 4, code);
/* copy code to work area */
- retval = target_write_memory(target, (*area)->address,
+ return target_write_memory(target, (*area)->address,
4, code_size / 4, code_buf);
-
- return retval;
}
/**
@@ -282,7 +280,5 @@ int arm_nandread(struct arm_nand_data *nand, uint8_t *data, uint32_t size)
destroy_reg_param(®_params[2]);
/* read from work area to the host's memory */
- retval = target_read_buffer(target, target_buf, size, data);
-
- return retval;
+ return target_read_buffer(target, target_buf, size, data);
}
diff --git a/src/flash/nand/at91sam9.c b/src/flash/nand/at91sam9.c
index 41cb07bc9..acc9e3634 100644
--- a/src/flash/nand/at91sam9.c
+++ b/src/flash/nand/at91sam9.c
@@ -250,15 +250,12 @@ static int at91sam9_read_block_data(struct nand_device *nand, uint8_t *data, int
{
struct at91sam9_nand *info = nand->controller_priv;
struct arm_nand_data *io = &info->io;
- int status;
if (!at91sam9_halted(nand->target, "read block"))
return ERROR_NAND_OPERATION_FAILED;
io->chunk_size = nand->page_size;
- status = arm_nandread(io, data, size);
-
- return status;
+ return arm_nandread(io, data, size);
}
/**
@@ -274,15 +271,12 @@ static int at91sam9_write_block_data(struct nand_device *nand, uint8_t *data, in
{
struct at91sam9_nand *info = nand->controller_priv;
struct arm_nand_data *io = &info->io;
- int status;
if (!at91sam9_halted(nand->target, "write block"))
return ERROR_NAND_OPERATION_FAILED;
io->chunk_size = nand->page_size;
- status = arm_nandwrite(io, data, size);
-
- return status;
+ return arm_nandwrite(io, data, size);
}
/**
@@ -469,9 +463,7 @@ static int at91sam9_write_page(struct nand_device *nand, uint32_t page,
return retval;
}
- retval = nand_write_finish(nand);
-
- return retval;
+ return nand_write_finish(nand);
}
/**
diff --git a/src/flash/nand/lpc3180.c b/src/flash/nand/lpc3180.c
index d221c34d9..050c63664 100644
--- a/src/flash/nand/lpc3180.c
+++ b/src/flash/nand/lpc3180.c
@@ -88,7 +88,6 @@ static float lpc3180_cycle_time(struct nand_device *nand)
int sysclk;
int hclk;
int hclk_pll;
- float cycle;
/* calculate timings */
@@ -119,9 +118,7 @@ static float lpc3180_cycle_time(struct nand_device *nand)
LOG_DEBUG("LPC3180 HCLK currently clocked at %i kHz", hclk);
- cycle = (1.0 / hclk) * 1000000.0;
-
- return cycle;
+ return (1.0 / hclk) * 1000000.0;
}
static int lpc3180_init(struct nand_device *nand)
diff --git a/src/flash/nand/lpc32xx.c b/src/flash/nand/lpc32xx.c
index c67f2aa30..132a579d3 100644
--- a/src/flash/nand/lpc32xx.c
+++ b/src/flash/nand/lpc32xx.c
@@ -121,7 +121,6 @@ static float lpc32xx_cycle_time(struct nand_device *nand)
int sysclk;
int hclk;
int hclk_pll;
- float cycle;
int retval;
/* calculate timings */
@@ -169,9 +168,7 @@ static float lpc32xx_cycle_time(struct nand_device *nand)
LOG_DEBUG("LPC32xx HCLK currently clocked at %i kHz", hclk);
- cycle = (1.0 / hclk) * 1000000.0;
-
- return cycle;
+ return (1.0 / hclk) * 1000000.0;
}
static int lpc32xx_init(struct nand_device *nand)
diff --git a/src/flash/nor/at91sam3.c b/src/flash/nor/at91sam3.c
index 5f551681d..247950562 100644
--- a/src/flash/nor/at91sam3.c
+++ b/src/flash/nor/at91sam3.c
@@ -69,10 +69,7 @@
static float _tomhz(uint32_t freq_hz)
{
- float f;
-
- f = ((float)(freq_hz)) / 1000000.0;
- return f;
+ return ((float)freq_hz) / 1000000.0;
}
/* How the chip is configured. */
diff --git a/src/flash/nor/at91sam4.c b/src/flash/nor/at91sam4.c
index dd3a1ca3f..a2d720cce 100644
--- a/src/flash/nor/at91sam4.c
+++ b/src/flash/nor/at91sam4.c
@@ -64,10 +64,7 @@
static float _tomhz(uint32_t freq_hz)
{
- float f;
-
- f = ((float)(freq_hz)) / 1000000.0;
- return f;
+ return ((float)freq_hz) / 1000000.0;
}
/* How the chip is configured. */
diff --git a/src/flash/nor/at91sam4l.c b/src/flash/nor/at91sam4l.c
index 1db15377e..f6aff73b7 100644
--- a/src/flash/nor/at91sam4l.c
+++ b/src/flash/nor/at91sam4l.c
@@ -185,9 +185,7 @@ static int sam4l_flash_command(struct target *target, uint8_t cmd, int page)
if (err != 0)
LOG_ERROR("%s got error status 0x%08" PRIx32, __func__, err);
- res = sam4l_flash_wait_until_ready(target);
-
- return res;
+ return sam4l_flash_wait_until_ready(target);
}
FLASH_BANK_COMMAND_HANDLER(sam4l_flash_bank_command)
@@ -505,9 +503,7 @@ static int sam4l_write_page(struct sam4l_info *chip, struct target *target,
res = sam4l_flash_command(target, SAM4L_FCMD_EP, -1);
if (res != ERROR_OK)
return res;
- res = sam4l_flash_command(target, SAM4L_FCMD_WP, -1);
-
- return res;
+ return sam4l_flash_command(target, SAM4L_FCMD_WP, -1);
}
/* Write partial contents into page-aligned 'address' on the Flash from host
diff --git a/src/flash/nor/atsamv.c b/src/flash/nor/atsamv.c
index de0b7dd1d..20f9bedfd 100644
--- a/src/flash/nor/atsamv.c
+++ b/src/flash/nor/atsamv.c
@@ -559,12 +559,8 @@ static int samv_read_standard_page(struct target *target,
static int samv_read_user_signature(struct target *target, uint8_t *buf)
{
- int r;
-
- r = samv_efc_read_sequence(target, SAMV_EFC_FCMD_STUS, SAMV_EFC_FCMD_SPUS,
- buf, SAMV_PAGE_SIZE);
-
- return r;
+ return samv_efc_read_sequence(target, SAMV_EFC_FCMD_STUS,
+ SAMV_EFC_FCMD_SPUS, buf, SAMV_PAGE_SIZE);
}
static int samv_page_read(struct target *target,
diff --git a/src/flash/nor/fm3.c b/src/flash/nor/fm3.c
index 48f4493ab..486f6d435 100644
--- a/src/flash/nor/fm3.c
+++ b/src/flash/nor/fm3.c
@@ -309,8 +309,7 @@ static int fm3_erase(struct flash_bank *bank, unsigned int first,
write_algorithm->address, 0, 100000, &armv7m_info);
if (retval != ERROR_OK) {
LOG_ERROR("Error executing flash erase programming algorithm");
- retval = ERROR_FLASH_OPERATION_FAILED;
- return retval;
+ return ERROR_FLASH_OPERATION_FAILED;
}
retval = fm3_busy_wait(target, offset, 500);
@@ -329,9 +328,8 @@ static int fm3_erase(struct flash_bank *bank, unsigned int first,
if (retval != ERROR_OK)
return retval;
- retval = target_read_u32(target, 0x40000000, &u32_dummy_read); /* dummy read of FASZR */
-
- return retval;
+ // dummy read of FASZR
+ return target_read_u32(target, 0x40000000, &u32_dummy_read);
}
static int fm3_write_block(struct flash_bank *bank, const uint8_t *buffer,
@@ -907,8 +905,7 @@ static int fm3_chip_erase(struct flash_bank *bank)
write_algorithm->address, 0, 100000, &armv7m_info);
if (retval != ERROR_OK) {
LOG_ERROR("Error executing flash erase programming algorithm");
- retval = ERROR_FLASH_OPERATION_FAILED;
- return retval;
+ return ERROR_FLASH_OPERATION_FAILED;
}
target_free_working_area(target, write_algorithm);
@@ -925,9 +922,8 @@ static int fm3_chip_erase(struct flash_bank *bank)
if (retval != ERROR_OK)
return retval;
- retval = target_read_u32(target, 0x40000000, &u32_dummy_read); /* dummy read of FASZR */
-
- return retval;
+ // dummy read of FASZR
+ return target_read_u32(target, 0x40000000, &u32_dummy_read);
}
COMMAND_HANDLER(fm3_handle_chip_erase_command)
diff --git a/src/flash/nor/kinetis.c b/src/flash/nor/kinetis.c
index 82e68de3f..266b447c0 100644
--- a/src/flash/nor/kinetis.c
+++ b/src/flash/nor/kinetis.c
@@ -1224,7 +1224,6 @@ static int kinetis_disable_wdog(struct kinetis_chip *k_chip)
COMMAND_HANDLER(kinetis_disable_wdog_handler)
{
- int result;
struct target *target = get_current_target(CMD_CTX);
struct kinetis_chip *k_chip = kinetis_get_chip(target);
@@ -1234,8 +1233,7 @@ COMMAND_HANDLER(kinetis_disable_wdog_handler)
if (CMD_ARGC > 0)
return ERROR_COMMAND_SYNTAX_ERROR;
- result = kinetis_disable_wdog(k_chip);
- return result;
+ return kinetis_disable_wdog(k_chip);
}
@@ -1589,8 +1587,7 @@ static int kinetis_read_pmstat(struct kinetis_chip *k_chip, uint8_t *pmstat)
switch (k_chip->sysmodectrlr_type) {
case KINETIS_SMC:
- result = target_read_u8(target, SMC_PMSTAT, pmstat);
- return result;
+ return target_read_u8(target, SMC_PMSTAT, pmstat);
case KINETIS_SMC32:
result = target_read_u32(target, SMC32_PMSTAT, &stat32);
diff --git a/src/flash/nor/lpcspifi.c b/src/flash/nor/lpcspifi.c
index f950f21db..c5db16c92 100644
--- a/src/flash/nor/lpcspifi.c
+++ b/src/flash/nor/lpcspifi.c
@@ -445,11 +445,10 @@ static int lpcspifi_erase(struct flash_bank *bank, unsigned int first,
" Will use bulk erase instead of sector-by-sector erase.");
retval = lpcspifi_bulk_erase(bank);
- if (retval == ERROR_OK) {
- retval = lpcspifi_set_hw_mode(bank);
- return retval;
- } else
- LOG_WARNING("Bulk flash erase failed. Falling back to sector-by-sector erase.");
+ if (retval == ERROR_OK)
+ return lpcspifi_set_hw_mode(bank);
+
+ LOG_WARNING("Bulk flash erase failed. Falling back to sector-by-sector erase.");
}
if (lpcspifi_info->dev->erase_cmd == 0x00)
@@ -554,9 +553,7 @@ static int lpcspifi_erase(struct flash_bank *bank, unsigned int first,
destroy_reg_param(®_params[2]);
destroy_reg_param(®_params[3]);
- retval = lpcspifi_set_hw_mode(bank);
-
- return retval;
+ return lpcspifi_set_hw_mode(bank);
}
static int lpcspifi_protect(struct flash_bank *bank, int set,
@@ -749,8 +746,7 @@ static int lpcspifi_write(struct flash_bank *bank, const uint8_t *buffer,
destroy_reg_param(®_params[4]);
/* Switch to HW mode before return to prompt */
- retval = lpcspifi_set_hw_mode(bank);
- return retval;
+ return lpcspifi_set_hw_mode(bank);
}
/* Return ID of flash device */
diff --git a/src/flash/nor/msp432.c b/src/flash/nor/msp432.c
index d7cc253ae..ac87098b3 100644
--- a/src/flash/nor/msp432.c
+++ b/src/flash/nor/msp432.c
@@ -199,9 +199,7 @@ static int msp432_exec_cmd(struct target *target, struct msp432_algo_params
return retval;
/* Write out command to target memory */
- retval = target_write_u32(target, ALGO_FLASH_COMMAND_ADDR, command);
-
- return retval;
+ return target_write_u32(target, ALGO_FLASH_COMMAND_ADDR, command);
}
static int msp432_wait_return_code(struct target *target)
@@ -393,9 +391,7 @@ static int msp432_init(struct flash_bank *bank)
if (retval != ERROR_OK)
return retval;
- retval = msp432_wait_return_code(target);
-
- return retval;
+ return msp432_wait_return_code(target);
}
static int msp432_quit(struct flash_bank *bank)
diff --git a/src/flash/nor/niietcm4.c b/src/flash/nor/niietcm4.c
index aaf072655..4251d13df 100644
--- a/src/flash/nor/niietcm4.c
+++ b/src/flash/nor/niietcm4.c
@@ -1165,10 +1165,8 @@ static int niietcm4_erase(struct flash_bank *bank, unsigned int first,
return ERROR_TARGET_NOT_HALTED;
}
- if ((first == 0) && (last == (bank->num_sectors - 1))) {
- retval = niietcm4_mass_erase(bank);
- return retval;
- }
+ if (first == 0 && last == (bank->num_sectors - 1))
+ return niietcm4_mass_erase(bank);
/* chose between main bootflash and info bootflash */
uint32_t flash_cmd, flash_addr;
diff --git a/src/flash/nor/nrf5.c b/src/flash/nor/nrf5.c
index 5cb552aa9..b92bb5b7c 100644
--- a/src/flash/nor/nrf5.c
+++ b/src/flash/nor/nrf5.c
@@ -796,8 +796,8 @@ static int nrf5_read_ficr_more_info(struct nrf5_info *chip)
if (res != ERROR_OK)
return res;
- res = target_read_u32(target, ficr_base + ficr_offsets->info_flash, &chip->ficr_info.flash);
- return res;
+ return target_read_u32(target, ficr_base + ficr_offsets->info_flash,
+ &chip->ficr_info.flash);
}
/* nRF51 series only */
@@ -1121,8 +1121,7 @@ static int nrf5_erase_page(struct flash_bank *bank,
return res;
}
- res = nrf5_wait_for_nvmc(chip);
- return res;
+ return nrf5_wait_for_nvmc(chip);
}
/* Start a low level flash write for the specified region */
diff --git a/src/flash/nor/psoc5lp.c b/src/flash/nor/psoc5lp.c
index 6b46e3902..e51c1cb1c 100644
--- a/src/flash/nor/psoc5lp.c
+++ b/src/flash/nor/psoc5lp.c
@@ -237,8 +237,7 @@ static int psoc5lp_get_device_id(struct target *target, uint32_t *id)
retval = target_read_u32(target, PANTHER_DEVICE_ID, id); /* dummy read */
if (retval != ERROR_OK)
return retval;
- retval = target_read_u32(target, PANTHER_DEVICE_ID, id);
- return retval;
+ return target_read_u32(target, PANTHER_DEVICE_ID, id);
}
static int psoc5lp_find_device(struct target *target,
@@ -297,8 +296,7 @@ static int psoc5lp_spc_write_opcode(struct target *target, uint8_t opcode)
retval = target_write_u8(target, SPC_CPU_DATA, SPC_KEY2 + opcode);
if (retval != ERROR_OK)
return retval;
- retval = target_write_u8(target, SPC_CPU_DATA, opcode);
- return retval;
+ return target_write_u8(target, SPC_CPU_DATA, opcode);
}
static void psoc5lp_spc_write_opcode_buffer(struct target *target,
diff --git a/src/flash/nor/psoc6.c b/src/flash/nor/psoc6.c
index 3c7b06666..b53be7847 100644
--- a/src/flash/nor/psoc6.c
+++ b/src/flash/nor/psoc6.c
@@ -868,9 +868,7 @@ COMMAND_HANDLER(psoc6_handle_mass_erase_command)
if (hr != ERROR_OK)
return hr;
- hr = psoc6_erase(bank, 0, bank->num_sectors - 1);
-
- return hr;
+ return psoc6_erase(bank, 0, bank->num_sectors - 1);
}
/** ***********************************************************************************************
diff --git a/src/flash/nor/stm32l4x.c b/src/flash/nor/stm32l4x.c
index 1181ab9a4..d46bfbeb5 100644
--- a/src/flash/nor/stm32l4x.c
+++ b/src/flash/nor/stm32l4x.c
@@ -2525,8 +2525,7 @@ COMMAND_HANDLER(stm32l4_handle_option_write_command)
"INFO: a reset or power cycle is required "
"for the new settings to take effect.", bank->driver->name);
- retval = stm32l4_write_option(bank, reg_offset, value, mask);
- return retval;
+ return stm32l4_write_option(bank, reg_offset, value, mask);
}
COMMAND_HANDLER(stm32l4_handle_trustzone_command)
diff --git a/src/flash/nor/stm32lx.c b/src/flash/nor/stm32lx.c
index f0e8db5ba..2e949c5db 100644
--- a/src/flash/nor/stm32lx.c
+++ b/src/flash/nor/stm32lx.c
@@ -1076,10 +1076,8 @@ static int stm32lx_enable_write_half_page(struct flash_bank *bank)
return retval;
reg32 |= FLASH_PECR__PROG;
- retval = target_write_u32(target, stm32lx_info->flash_base + FLASH_PECR,
+ return target_write_u32(target, stm32lx_info->flash_base + FLASH_PECR,
reg32);
-
- return retval;
}
static int stm32lx_lock_program_memory(struct flash_bank *bank)
diff --git a/src/flash/nor/stmqspi.c b/src/flash/nor/stmqspi.c
index bd72fe050..174643b7e 100644
--- a/src/flash/nor/stmqspi.c
+++ b/src/flash/nor/stmqspi.c
@@ -1800,9 +1800,7 @@ static int find_sfdp_dummy(struct flash_bank *bank, int len)
err:
/* Abort operation */
- retval = stmqspi_abort(bank);
-
- return retval;
+ return stmqspi_abort(bank);
}
/* Read SFDP parameter block */
diff --git a/src/flash/nor/str9xpec.c b/src/flash/nor/str9xpec.c
index be0089879..b7156a1ae 100644
--- a/src/flash/nor/str9xpec.c
+++ b/src/flash/nor/str9xpec.c
@@ -171,7 +171,6 @@ static int str9xpec_isc_disable(struct flash_bank *bank)
static int str9xpec_read_config(struct flash_bank *bank)
{
struct scan_field field;
- uint8_t status;
struct jtag_tap *tap;
struct str9xpec_flash_controller *str9xpec_info = bank->driver_priv;
@@ -190,9 +189,7 @@ static int str9xpec_read_config(struct flash_bank *bank)
jtag_add_dr_scan(tap, 1, &field, TAP_IDLE);
jtag_execute_queue();
- status = str9xpec_isc_status(tap);
-
- return status;
+ return str9xpec_isc_status(tap);
}
static int str9xpec_build_block_list(struct flash_bank *bank)
@@ -487,11 +484,7 @@ static int str9xpec_lock_device(struct flash_bank *bank)
static int str9xpec_unlock_device(struct flash_bank *bank)
{
- uint8_t status;
-
- status = str9xpec_erase_area(bank, 0, 255);
-
- return status;
+ return str9xpec_erase_area(bank, 0, 255);
}
static int str9xpec_protect(struct flash_bank *bank, int set,
diff --git a/src/flash/nor/swm050.c b/src/flash/nor/swm050.c
index dcf59d380..880c44e19 100644
--- a/src/flash/nor/swm050.c
+++ b/src/flash/nor/swm050.c
@@ -67,8 +67,7 @@ static int swm050_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t
if (target->state != TARGET_HALTED) {
LOG_ERROR("Target not halted");
- retval = ERROR_TARGET_NOT_HALTED;
- return retval;
+ return ERROR_TARGET_NOT_HALTED;
}
/* Perform write */
diff --git a/src/flash/nor/xmc4xxx.c b/src/flash/nor/xmc4xxx.c
index bf41cc7eb..ceed055fc 100644
--- a/src/flash/nor/xmc4xxx.c
+++ b/src/flash/nor/xmc4xxx.c
@@ -522,9 +522,7 @@ static int xmc4xxx_erase_sector(struct flash_bank *bank, uint32_t address,
}
/* Now we must wait for the erase operation to end */
- res = xmc4xxx_wait_status_busy(bank, FLASH_OP_TIMEOUT);
-
- return res;
+ return xmc4xxx_wait_status_busy(bank, FLASH_OP_TIMEOUT);
}
static int xmc4xxx_erase(struct flash_bank *bank, unsigned int first,
@@ -569,8 +567,7 @@ static int xmc4xxx_erase(struct flash_bank *bank, unsigned int first,
}
clear_status_and_exit:
- res = xmc4xxx_clear_flash_status(bank);
- return res;
+ return xmc4xxx_clear_flash_status(bank);
}
@@ -1131,7 +1128,6 @@ static int xmc4xxx_flash_protect(struct flash_bank *bank, int level, bool read_p
static int xmc4xxx_protect(struct flash_bank *bank, int set, unsigned int first,
unsigned int last)
{
- int ret;
struct xmc4xxx_flash_bank *fb = bank->driver_priv;
/* Check for flash passwords */
@@ -1144,14 +1140,11 @@ static int xmc4xxx_protect(struct flash_bank *bank, int set, unsigned int first,
if (set == 0) {
LOG_WARNING("Flash protection will be temporarily disabled"
" for all pages (User 0 only)!");
- ret = xmc4xxx_temp_unprotect(bank, 0);
- return ret;
+ return xmc4xxx_temp_unprotect(bank, 0);
}
/* Install write protection for user 0 on the specified pages */
- ret = xmc4xxx_flash_protect(bank, 0, false, first, last);
-
- return ret;
+ return xmc4xxx_flash_protect(bank, 0, false, first, last);
}
static int xmc4xxx_protect_check(struct flash_bank *bank)
@@ -1290,9 +1283,7 @@ COMMAND_HANDLER(xmc4xxx_handle_flash_unprotect_command)
COMMAND_PARSE_NUMBER(s32, CMD_ARGV[1], level);
- res = xmc4xxx_flash_unprotect(bank, level);
-
- return res;
+ return xmc4xxx_flash_unprotect(bank, level);
}
static const struct command_registration xmc4xxx_exec_command_handlers[] = {
diff --git a/src/jtag/drivers/buspirate.c b/src/jtag/drivers/buspirate.c
index 7eab94bd0..7a1a93c1b 100644
--- a/src/jtag/drivers/buspirate.c
+++ b/src/jtag/drivers/buspirate.c
@@ -1157,9 +1157,7 @@ static unsigned char buspirate_jtag_command(int fd,
/* TODO add support for WIN32 and others ! */
static int buspirate_serial_open(char *port)
{
- int fd;
- fd = open(buspirate_port, O_RDWR | O_NOCTTY | O_NDELAY);
- return fd;
+ return open(buspirate_port, O_RDWR | O_NOCTTY | O_NDELAY);
}
diff --git a/src/jtag/drivers/dmem.c b/src/jtag/drivers/dmem.c
index 0f1b58299..85f334552 100644
--- a/src/jtag/drivers/dmem.c
+++ b/src/jtag/drivers/dmem.c
@@ -102,13 +102,9 @@ static void dmem_emu_set_ap_reg(uint32_t addr, uint32_t val)
static uint32_t dmem_emu_get_ap_reg(uint32_t addr)
{
- uint32_t val;
-
addr &= ~ARM_APB_PADDR31;
- val = *(volatile uint32_t *)((uintptr_t)dmem_emu_virt_base_addr + addr);
-
- return val;
+ return *(volatile uint32_t *)((uintptr_t)dmem_emu_virt_base_addr + addr);
}
static int dmem_emu_ap_q_read(unsigned int ap_idx, unsigned int reg, uint32_t *data)
diff --git a/src/jtag/drivers/rlink.c b/src/jtag/drivers/rlink.c
index 83c6d6853..3be786d7b 100644
--- a/src/jtag/drivers/rlink.c
+++ b/src/jtag/drivers/rlink.c
@@ -432,14 +432,8 @@ static int dtc_start_download(void)
return usb_err;
/* wait for completion */
- usb_err = jtag_libusb_bulk_read(
- hdev, USB_EP1IN_ADDR,
- (char *)&ep2txr, 1,
- LIBUSB_TIMEOUT_MS,
- &transferred
- );
-
- return usb_err;
+ return jtag_libusb_bulk_read(hdev, USB_EP1IN_ADDR, (char *)&ep2txr, 1,
+ LIBUSB_TIMEOUT_MS, &transferred);
}
static int dtc_run_download(
@@ -807,8 +801,7 @@ static int tap_state_queue_run(void)
tap_state_queue.buffer >>= 1;
}
- retval = tap_state_queue_init();
- return retval;
+ return tap_state_queue_init();
}
static int tap_state_queue_append(uint8_t tms)
diff --git a/src/jtag/drivers/stlink_usb.c b/src/jtag/drivers/stlink_usb.c
index c64e149cb..358765463 100644
--- a/src/jtag/drivers/stlink_usb.c
+++ b/src/jtag/drivers/stlink_usb.c
@@ -2303,16 +2303,13 @@ static int stlink_usb_reset(void *handle)
/** */
static int stlink_usb_run(void *handle)
{
- int res;
struct stlink_usb_handle *h = handle;
assert(handle);
- if (h->version.jtag_api != STLINK_JTAG_API_V1) {
- res = stlink_usb_write_debug_reg(handle, DCB_DHCSR, DBGKEY|C_DEBUGEN);
-
- return res;
- }
+ if (h->version.jtag_api != STLINK_JTAG_API_V1)
+ return stlink_usb_write_debug_reg(handle, DCB_DHCSR,
+ DBGKEY | C_DEBUGEN);
stlink_usb_init_buffer(handle, h->rx_ep, 2);
@@ -2325,16 +2322,13 @@ static int stlink_usb_run(void *handle)
/** */
static int stlink_usb_halt(void *handle)
{
- int res;
struct stlink_usb_handle *h = handle;
assert(handle);
- if (h->version.jtag_api != STLINK_JTAG_API_V1) {
- res = stlink_usb_write_debug_reg(handle, DCB_DHCSR, DBGKEY|C_HALT|C_DEBUGEN);
-
- return res;
- }
+ if (h->version.jtag_api != STLINK_JTAG_API_V1)
+ return stlink_usb_write_debug_reg(handle, DCB_DHCSR,
+ DBGKEY | C_HALT | C_DEBUGEN);
stlink_usb_init_buffer(handle, h->rx_ep, 2);
@@ -4285,8 +4279,6 @@ static int stlink_dap_dp_read(struct adiv5_dap *dap, unsigned int reg, uint32_t
/** */
static int stlink_dap_dp_write(struct adiv5_dap *dap, unsigned int reg, uint32_t data)
{
- int retval;
-
if (!(stlink_dap_handle->version.flags & STLINK_F_HAS_DPBANKSEL))
if (reg & 0x000000F0) {
LOG_ERROR("Banked DP registers not supported in current STLink FW");
@@ -4303,9 +4295,8 @@ static int stlink_dap_dp_write(struct adiv5_dap *dap, unsigned int reg, uint32_t
if (reg == DP_CTRL_STAT)
data &= ~CORUNDETECT;
- retval = stlink_write_dap_register(stlink_dap_handle,
+ return stlink_write_dap_register(stlink_dap_handle,
STLINK_DEBUG_PORT_ACCESS, reg, data);
- return retval;
}
/** */
diff --git a/src/jtag/drivers/ulink.c b/src/jtag/drivers/ulink.c
index ce2d21e0e..eb4e815e5 100644
--- a/src/jtag/drivers/ulink.c
+++ b/src/jtag/drivers/ulink.c
@@ -2220,8 +2220,6 @@ static int ulink_quit(void)
*/
COMMAND_HANDLER(ulink_download_firmware_handler)
{
- int ret;
-
if (CMD_ARGC != 1)
return ERROR_COMMAND_SYNTAX_ERROR;
@@ -2229,10 +2227,8 @@ COMMAND_HANDLER(ulink_download_firmware_handler)
LOG_INFO("Downloading ULINK firmware image %s", CMD_ARGV[0]);
/* Download firmware image in CMD_ARGV[0] */
- ret = ulink_load_firmware_and_renumerate(&ulink_handle, CMD_ARGV[0],
+ return ulink_load_firmware_and_renumerate(&ulink_handle, CMD_ARGV[0],
ULINK_RENUMERATION_DELAY);
-
- return ret;
}
/*************************** Command Registration **************************/
diff --git a/src/jtag/drivers/xds110.c b/src/jtag/drivers/xds110.c
index 75d6a4f81..497f97f63 100644
--- a/src/jtag/drivers/xds110.c
+++ b/src/jtag/drivers/xds110.c
@@ -657,26 +657,18 @@ static bool xds_execute(uint32_t out_length, uint32_t in_length,
static bool xds_connect(void)
{
- bool success;
-
xds110.write_payload[0] = XDS_CONNECT;
- success = xds_execute(XDS_OUT_LEN, XDS_IN_LEN, DEFAULT_ATTEMPTS,
+ return xds_execute(XDS_OUT_LEN, XDS_IN_LEN, DEFAULT_ATTEMPTS,
DEFAULT_TIMEOUT);
-
- return success;
}
static bool xds_disconnect(void)
{
- bool success;
-
xds110.write_payload[0] = XDS_DISCONNECT;
- success = xds_execute(XDS_OUT_LEN, XDS_IN_LEN, DEFAULT_ATTEMPTS,
+ return xds_execute(XDS_OUT_LEN, XDS_IN_LEN, DEFAULT_ATTEMPTS,
DEFAULT_TIMEOUT);
-
- return success;
}
static bool xds_version(uint32_t *firmware_id, uint16_t *hardware_id)
@@ -705,48 +697,36 @@ static bool xds_set_tck_delay(uint32_t delay)
{
uint8_t *delay_pntr = &xds110.write_payload[XDS_OUT_LEN + 0]; /* 32-bits */
- bool success;
-
xds110.write_payload[0] = XDS_SET_TCK;
xds110_set_u32(delay_pntr, delay);
- success = xds_execute(XDS_OUT_LEN + 4, XDS_IN_LEN, DEFAULT_ATTEMPTS,
+ return xds_execute(XDS_OUT_LEN + 4, XDS_IN_LEN, DEFAULT_ATTEMPTS,
DEFAULT_TIMEOUT);
-
- return success;
}
static bool xds_set_trst(uint8_t trst)
{
uint8_t *trst_pntr = &xds110.write_payload[XDS_OUT_LEN + 0]; /* 8-bits */
- bool success;
-
xds110.write_payload[0] = XDS_SET_TRST;
*trst_pntr = trst;
- success = xds_execute(XDS_OUT_LEN + 1, XDS_IN_LEN, DEFAULT_ATTEMPTS,
+ return xds_execute(XDS_OUT_LEN + 1, XDS_IN_LEN, DEFAULT_ATTEMPTS,
DEFAULT_TIMEOUT);
-
- return success;
}
static bool xds_cycle_tck(uint32_t count)
{
uint8_t *count_pntr = &xds110.write_payload[XDS_OUT_LEN + 0]; /* 32-bits */
- bool success;
-
xds110.write_payload[0] = XDS_CYCLE_TCK;
xds110_set_u32(count_pntr, count);
- success = xds_execute(XDS_OUT_LEN + 4, XDS_IN_LEN, DEFAULT_ATTEMPTS,
+ return xds_execute(XDS_OUT_LEN + 4, XDS_IN_LEN, DEFAULT_ATTEMPTS,
DEFAULT_TIMEOUT);
-
- return success;
}
static bool xds_goto_state(uint32_t state)
@@ -754,17 +734,13 @@ static bool xds_goto_state(uint32_t state)
uint8_t *state_pntr = &xds110.write_payload[XDS_OUT_LEN + 0]; /* 32-bits */
uint8_t *transit_pntr = &xds110.write_payload[XDS_OUT_LEN+4]; /* 32-bits */
- bool success;
-
xds110.write_payload[0] = XDS_GOTO_STATE;
xds110_set_u32(state_pntr, state);
xds110_set_u32(transit_pntr, XDS_JTAG_TRANSIT_QUICKEST);
- success = xds_execute(XDS_OUT_LEN+8, XDS_IN_LEN, DEFAULT_ATTEMPTS,
+ return xds_execute(XDS_OUT_LEN + 8, XDS_IN_LEN, DEFAULT_ATTEMPTS,
DEFAULT_TIMEOUT);
-
- return success;
}
static bool xds_jtag_scan(uint32_t shift_state, uint16_t shift_bits,
@@ -817,16 +793,12 @@ static bool xds_set_srst(uint8_t srst)
{
uint8_t *srst_pntr = &xds110.write_payload[XDS_OUT_LEN + 0]; /* 8-bits */
- bool success;
-
xds110.write_payload[0] = XDS_SET_SRST;
*srst_pntr = srst;
- success = xds_execute(XDS_OUT_LEN + 1, XDS_IN_LEN, DEFAULT_ATTEMPTS,
+ return xds_execute(XDS_OUT_LEN + 1, XDS_IN_LEN, DEFAULT_ATTEMPTS,
DEFAULT_TIMEOUT);
-
- return success;
}
static bool cmapi_connect(uint32_t *idcode)
@@ -850,38 +822,26 @@ static bool cmapi_connect(uint32_t *idcode)
static bool cmapi_disconnect(void)
{
- bool success;
-
xds110.write_payload[0] = CMAPI_DISCONNECT;
- success = xds_execute(XDS_OUT_LEN, XDS_IN_LEN, DEFAULT_ATTEMPTS,
+ return xds_execute(XDS_OUT_LEN, XDS_IN_LEN, DEFAULT_ATTEMPTS,
DEFAULT_TIMEOUT);
-
- return success;
}
static bool cmapi_acquire(void)
{
- bool success;
-
xds110.write_payload[0] = CMAPI_ACQUIRE;
- success = xds_execute(XDS_OUT_LEN, XDS_IN_LEN, DEFAULT_ATTEMPTS,
+ return xds_execute(XDS_OUT_LEN, XDS_IN_LEN, DEFAULT_ATTEMPTS,
DEFAULT_TIMEOUT);
-
- return success;
}
static bool cmapi_release(void)
{
- bool success;
-
xds110.write_payload[0] = CMAPI_RELEASE;
- success = xds_execute(XDS_OUT_LEN, XDS_IN_LEN, DEFAULT_ATTEMPTS,
+ return xds_execute(XDS_OUT_LEN, XDS_IN_LEN, DEFAULT_ATTEMPTS,
DEFAULT_TIMEOUT);
-
- return success;
}
static bool cmapi_read_dap_reg(uint32_t type, uint32_t ap_num,
@@ -919,8 +879,6 @@ static bool cmapi_write_dap_reg(uint32_t type, uint32_t ap_num,
uint8_t *address_pntr = &xds110.write_payload[XDS_OUT_LEN + 2]; /* 8-bits */
uint8_t *value_pntr = &xds110.write_payload[XDS_OUT_LEN + 3]; /* 32-bits */
- bool success;
-
if (!value)
return false;
@@ -931,62 +889,44 @@ static bool cmapi_write_dap_reg(uint32_t type, uint32_t ap_num,
*address_pntr = (uint8_t)(address & 0xff);
xds110_set_u32(value_pntr, *value);
- success = xds_execute(XDS_OUT_LEN + 7, XDS_IN_LEN, DEFAULT_ATTEMPTS,
+ return xds_execute(XDS_OUT_LEN + 7, XDS_IN_LEN, DEFAULT_ATTEMPTS,
DEFAULT_TIMEOUT);
-
- return success;
}
static bool swd_connect(void)
{
- bool success;
-
xds110.write_payload[0] = SWD_CONNECT;
- success = xds_execute(XDS_OUT_LEN, XDS_IN_LEN, DEFAULT_ATTEMPTS,
+ return xds_execute(XDS_OUT_LEN, XDS_IN_LEN, DEFAULT_ATTEMPTS,
DEFAULT_TIMEOUT);
-
- return success;
}
static bool swd_disconnect(void)
{
- bool success;
-
xds110.write_payload[0] = SWD_DISCONNECT;
- success = xds_execute(XDS_OUT_LEN, XDS_IN_LEN, DEFAULT_ATTEMPTS,
+ return xds_execute(XDS_OUT_LEN, XDS_IN_LEN, DEFAULT_ATTEMPTS,
DEFAULT_TIMEOUT);
-
- return success;
}
static bool cjtag_connect(uint32_t format)
{
uint8_t *format_pntr = &xds110.write_payload[XDS_OUT_LEN + 0]; /* 32-bits */
- bool success;
-
xds110.write_payload[0] = CJTAG_CONNECT;
xds110_set_u32(format_pntr, format);
- success = xds_execute(XDS_OUT_LEN + 4, XDS_IN_LEN, DEFAULT_ATTEMPTS,
+ return xds_execute(XDS_OUT_LEN + 4, XDS_IN_LEN, DEFAULT_ATTEMPTS,
DEFAULT_TIMEOUT);
-
- return success;
}
static bool cjtag_disconnect(void)
{
- bool success;
-
xds110.write_payload[0] = CJTAG_DISCONNECT;
- success = xds_execute(XDS_OUT_LEN, XDS_IN_LEN, DEFAULT_ATTEMPTS,
+ return xds_execute(XDS_OUT_LEN, XDS_IN_LEN, DEFAULT_ATTEMPTS,
DEFAULT_TIMEOUT);
-
- return success;
}
static bool xds_set_supply(uint32_t voltage)
@@ -994,17 +934,13 @@ static bool xds_set_supply(uint32_t voltage)
uint8_t *volts_pntr = &xds110.write_payload[XDS_OUT_LEN + 0]; /* 32-bits */
uint8_t *source_pntr = &xds110.write_payload[XDS_OUT_LEN + 4]; /* 8-bits */
- bool success;
-
xds110.write_payload[0] = XDS_SET_SUPPLY;
xds110_set_u32(volts_pntr, voltage);
*source_pntr = (uint8_t)(voltage != 0 ? 1 : 0);
- success = xds_execute(XDS_OUT_LEN + 5, XDS_IN_LEN, DEFAULT_ATTEMPTS,
+ return xds_execute(XDS_OUT_LEN + 5, XDS_IN_LEN, DEFAULT_ATTEMPTS,
DEFAULT_TIMEOUT);
-
- return success;
}
static bool ocd_dap_request(uint8_t *dap_requests, uint32_t request_size,
@@ -1062,8 +998,6 @@ static bool ocd_pathmove(uint32_t num_states, uint8_t *path)
uint8_t *num_pntr = &xds110.write_payload[XDS_OUT_LEN + 0]; /* 32-bits */
uint8_t *path_pntr = &xds110.write_payload[XDS_OUT_LEN + 4];
- bool success;
-
if (!path)
return false;
@@ -1073,10 +1007,8 @@ static bool ocd_pathmove(uint32_t num_states, uint8_t *path)
memcpy((void *)path_pntr, (void *)path, num_states);
- success = xds_execute(XDS_OUT_LEN + 4 + num_states, XDS_IN_LEN,
+ return xds_execute(XDS_OUT_LEN + 4 + num_states, XDS_IN_LEN,
DEFAULT_ATTEMPTS, DEFAULT_TIMEOUT);
-
- return success;
}
/***************************************************************************
diff --git a/src/pld/efinix.c b/src/pld/efinix.c
index eff62c62b..6df24a7b8 100644
--- a/src/pld/efinix.c
+++ b/src/pld/efinix.c
@@ -200,9 +200,7 @@ static int efinix_load(struct pld_device *pld_device, const char *filename)
/* entering RUN/TEST for 100 cycles */
jtag_add_runtest(RUNTEST_FINISH_CYCLES, TAP_IDLE);
- retval = jtag_execute_queue();
-
- return retval;
+ return jtag_execute_queue();
}
static int efinix_get_ipdbg_hub(int user_num, struct pld_device *pld_device, struct pld_ipdbg_hub *hub)
diff --git a/src/pld/gowin.c b/src/pld/gowin.c
index 939e61060..9a6709b98 100644
--- a/src/pld/gowin.c
+++ b/src/pld/gowin.c
@@ -421,9 +421,7 @@ static int gowin_load_to_sram(struct pld_device *pld_device, const char *filenam
if (retval != ERROR_OK)
return retval;
- retval = jtag_execute_queue();
-
- return retval;
+ return jtag_execute_queue();
}
static int gowin_read_register_command(struct pld_device *pld_device, uint32_t cmd, uint32_t *value)
diff --git a/src/rtos/linux.c b/src/rtos/linux.c
index 5f59dc883..625e84740 100644
--- a/src/rtos/linux.c
+++ b/src/rtos/linux.c
@@ -147,10 +147,7 @@ static int fill_buffer(struct target *target, uint32_t addr, uint8_t *buffer)
static uint32_t get_buffer(struct target *target, const uint8_t *buffer)
{
- uint32_t value = 0;
- const uint8_t *value_ptr = buffer;
- value = target_buffer_get_u32(target, value_ptr);
- return value;
+ return target_buffer_get_u32(target, buffer);
}
static int linux_os_thread_reg_list(struct rtos *rtos,
diff --git a/src/server/ipdbg.c b/src/server/ipdbg.c
index 466717c46..bc04a571b 100644
--- a/src/server/ipdbg.c
+++ b/src/server/ipdbg.c
@@ -381,9 +381,7 @@ static int ipdbg_shift_vir(struct ipdbg_hub *hub)
ipdbg_init_scan_field(hub->scratch_memory.fields, NULL,
hub->virtual_ir->length, hub->scratch_memory.vir_out_val);
jtag_add_dr_scan(tap, 1, hub->scratch_memory.fields, TAP_IDLE);
- retval = jtag_execute_queue();
-
- return retval;
+ return jtag_execute_queue();
}
static int ipdbg_shift_data(struct ipdbg_hub *hub, uint32_t dn_data, uint32_t *up_data)
diff --git a/src/target/aarch64.c b/src/target/aarch64.c
index 5d874ad62..3f1355af9 100644
--- a/src/target/aarch64.c
+++ b/src/target/aarch64.c
@@ -282,12 +282,9 @@ static int aarch64_dap_write_memap_register_u32(struct target *target,
target_addr_t address,
uint32_t value)
{
- int retval;
struct armv8_common *armv8 = target_to_armv8(target);
- retval = mem_ap_write_atomic_u32(armv8->debug_ap, address, value);
-
- return retval;
+ return mem_ap_write_atomic_u32(armv8->debug_ap, address, value);
}
static int aarch64_dpm_setup(struct aarch64_common *a8, uint64_t debug)
diff --git a/src/target/arm720t.c b/src/target/arm720t.c
index 3f7686fb7..7d25e5168 100644
--- a/src/target/arm720t.c
+++ b/src/target/arm720t.c
@@ -157,8 +157,7 @@ static int arm720t_disable_mmu_caches(struct target *target,
if (d_u_cache || i_cache)
cp15_control &= ~0x4U;
- retval = arm720t_write_cp15(target, 0xee010f10, cp15_control);
- return retval;
+ return arm720t_write_cp15(target, 0xee010f10, cp15_control);
}
static int arm720t_enable_mmu_caches(struct target *target,
@@ -181,8 +180,7 @@ static int arm720t_enable_mmu_caches(struct target *target,
if (d_u_cache || i_cache)
cp15_control |= 0x4U;
- retval = arm720t_write_cp15(target, 0xee010f10, cp15_control);
- return retval;
+ return arm720t_write_cp15(target, 0xee010f10, cp15_control);
}
static int arm720t_post_debug_entry(struct target *target)
@@ -211,8 +209,7 @@ static int arm720t_post_debug_entry(struct target *target)
retval = arm720t_read_cp15(target, 0xee160f10, &arm720t->far_reg);
if (retval != ERROR_OK)
return retval;
- retval = jtag_execute_queue();
- return retval;
+ return jtag_execute_queue();
}
static void arm720t_pre_restore_context(struct target *target)
diff --git a/src/target/arm920t.c b/src/target/arm920t.c
index 441e42305..291b7bc49 100644
--- a/src/target/arm920t.c
+++ b/src/target/arm920t.c
@@ -363,8 +363,7 @@ int arm920t_disable_mmu_caches(struct target *target, int mmu,
if (i_cache)
cp15_control &= ~0x1000U;
- retval = arm920t_write_cp15_physical(target, CP15PHYS_CTRL, cp15_control);
- return retval;
+ return arm920t_write_cp15_physical(target, CP15PHYS_CTRL, cp15_control);
}
/* EXPORTED to FA256 */
@@ -391,8 +390,7 @@ int arm920t_enable_mmu_caches(struct target *target, int mmu,
if (i_cache)
cp15_control |= 0x1000U;
- retval = arm920t_write_cp15_physical(target, CP15PHYS_CTRL, cp15_control);
- return retval;
+ return arm920t_write_cp15_physical(target, CP15PHYS_CTRL, cp15_control);
}
/* EXPORTED to FA256 */
@@ -556,11 +554,7 @@ static int arm920_virt2phys(struct target *target,
int arm920t_read_memory(struct target *target, target_addr_t address,
uint32_t size, uint32_t count, uint8_t *buffer)
{
- int retval;
-
- retval = arm7_9_read_memory(target, address, size, count, buffer);
-
- return retval;
+ return arm7_9_read_memory(target, address, size, count, buffer);
}
diff --git a/src/target/arm926ejs.c b/src/target/arm926ejs.c
index 98fe6bf68..4d0a44406 100644
--- a/src/target/arm926ejs.c
+++ b/src/target/arm926ejs.c
@@ -383,8 +383,7 @@ static int arm926ejs_disable_mmu_caches(struct target *target, int mmu,
cp15_control &= ~0x1000U;
}
- retval = arm926ejs->write_cp15(target, 0, 0, 1, 0, cp15_control);
- return retval;
+ return arm926ejs->write_cp15(target, 0, 0, 1, 0, cp15_control);
}
static int arm926ejs_enable_mmu_caches(struct target *target, int mmu,
@@ -411,8 +410,7 @@ static int arm926ejs_enable_mmu_caches(struct target *target, int mmu,
if (i_cache)
cp15_control |= 0x1000U;
- retval = arm926ejs->write_cp15(target, 0, 0, 1, 0, cp15_control);
- return retval;
+ return arm926ejs->write_cp15(target, 0, 0, 1, 0, cp15_control);
}
static int arm926ejs_post_debug_entry(struct target *target)
@@ -469,8 +467,7 @@ static int arm926ejs_post_debug_entry(struct target *target)
if (retval != ERROR_OK)
return retval;
cache_dbg_ctrl |= 0x7;
- retval = arm926ejs->write_cp15(target, 7, 0, 15, 0, cache_dbg_ctrl);
- return retval;
+ return arm926ejs->write_cp15(target, 7, 0, 15, 0, cache_dbg_ctrl);
}
static void arm926ejs_pre_restore_context(struct target *target)
diff --git a/src/target/armv7a_cache.c b/src/target/armv7a_cache.c
index 5eb31d8c0..12967ea46 100644
--- a/src/target/armv7a_cache.c
+++ b/src/target/armv7a_cache.c
@@ -108,8 +108,7 @@ static int armv7a_l1_d_cache_clean_inval_all(struct target *target)
armv7a_l1_d_cache_flush_level(dpm, &cache->arch[cl].d_u_size, cl);
}
- retval = dpm->finish(dpm);
- return retval;
+ return dpm->finish(dpm);
done:
LOG_ERROR("clean invalidate failed");
diff --git a/src/target/armv7m.c b/src/target/armv7m.c
index 07f1f6fc9..6db735530 100644
--- a/src/target/armv7m.c
+++ b/src/target/armv7m.c
@@ -243,7 +243,6 @@ const char *armv7m_exception_string(int number)
static int armv7m_get_core_reg(struct reg *reg)
{
- int retval;
struct arm_reg *armv7m_reg = reg->arch_info;
struct target *target = armv7m_reg->target;
struct arm *arm = target_to_arm(target);
@@ -251,9 +250,7 @@ static int armv7m_get_core_reg(struct reg *reg)
if (target->state != TARGET_HALTED)
return ERROR_TARGET_NOT_HALTED;
- retval = arm->read_core_reg(target, reg, reg->number, arm->core_mode);
-
- return retval;
+ return arm->read_core_reg(target, reg, reg->number, arm->core_mode);
}
static int armv7m_set_core_reg(struct reg *reg, uint8_t *buf)
@@ -651,9 +648,7 @@ int armv7m_start_algorithm(struct target *target,
/* save previous core mode */
armv7m_algorithm_info->core_mode = core_mode;
- retval = target_resume(target, false, entry_point, true, true);
-
- return retval;
+ return target_resume(target, false, entry_point, true, true);
}
/** Waits for an algorithm in the target. */
diff --git a/src/target/armv8.c b/src/target/armv8.c
index a369a3041..fca6b8bce 100644
--- a/src/target/armv8.c
+++ b/src/target/armv8.c
@@ -1923,13 +1923,10 @@ struct reg_cache *armv8_build_reg_cache(struct target *target)
struct reg *armv8_reg_current(struct arm *arm, unsigned int regnum)
{
- struct reg *r;
-
if (regnum > (ARMV8_LAST_REG - 1))
return NULL;
- r = arm->core_cache->reg_list + regnum;
- return r;
+ return arm->core_cache->reg_list + regnum;
}
static void armv8_free_cache(struct reg_cache *cache, bool regs32)
@@ -2073,7 +2070,6 @@ int armv8_set_dbgreg_bits(struct armv8_common *armv8, unsigned int reg, unsigned
tmp |= value & mask;
/* write new value */
- retval = mem_ap_write_atomic_u32(armv8->debug_ap,
+ return mem_ap_write_atomic_u32(armv8->debug_ap,
armv8->debug_base + reg, tmp);
- return retval;
}
diff --git a/src/target/armv8_cache.c b/src/target/armv8_cache.c
index 7bf4dcd47..c6bd77935 100644
--- a/src/target/armv8_cache.c
+++ b/src/target/armv8_cache.c
@@ -92,8 +92,7 @@ static int armv8_cache_d_inner_clean_inval_all(struct armv8_common *armv8)
armv8_cache_d_inner_flush_level(armv8, &cache->arch[cl].d_u_size, cl);
}
- retval = dpm->finish(dpm);
- return retval;
+ return dpm->finish(dpm);
done:
LOG_ERROR("clean invalidate failed");
diff --git a/src/target/avr32_ap7k.c b/src/target/avr32_ap7k.c
index 543764ec5..a016a1cce 100644
--- a/src/target/avr32_ap7k.c
+++ b/src/target/avr32_ap7k.c
@@ -126,16 +126,13 @@ static int avr32_write_core_reg(struct target *target, int num)
static int avr32_get_core_reg(struct reg *reg)
{
- int retval;
struct avr32_core_reg *avr32_reg = reg->arch_info;
struct target *target = avr32_reg->target;
if (target->state != TARGET_HALTED)
return ERROR_TARGET_NOT_HALTED;
- retval = avr32_read_core_reg(target, avr32_reg->num);
-
- return retval;
+ return avr32_read_core_reg(target, avr32_reg->num);
}
static int avr32_set_core_reg(struct reg *reg, uint8_t *buf)
diff --git a/src/target/avr32_regs.c b/src/target/avr32_regs.c
index d6fd0e002..4070e2570 100644
--- a/src/target/avr32_regs.c
+++ b/src/target/avr32_regs.c
@@ -31,10 +31,7 @@ static int avr32_jtag_read_reg(struct avr32_jtag *jtag_info, int reg,
return retval;
} while (!(dcsr & OCDREG_DCSR_CPUD));
- retval = avr32_jtag_nexus_read(jtag_info,
- AVR32_OCDREG_DCCPU, val);
-
- return retval;
+ return avr32_jtag_nexus_read(jtag_info, AVR32_OCDREG_DCCPU, val);
}
static int avr32_jtag_write_reg(struct avr32_jtag *jtag_info, int reg,
@@ -75,9 +72,7 @@ int avr32_jtag_read_regs(struct avr32_jtag *jtag_info, uint32_t *regs)
if (retval != ERROR_OK)
return retval;
- retval = avr32_jtag_read_reg(jtag_info, 0, regs + AVR32_REG_SR);
-
- return retval;
+ return avr32_jtag_read_reg(jtag_info, 0, regs + AVR32_REG_SR);
}
int avr32_jtag_write_regs(struct avr32_jtag *jtag_info, uint32_t *regs)
diff --git a/src/target/cortex_a.c b/src/target/cortex_a.c
index 028c46404..7e860afc1 100644
--- a/src/target/cortex_a.c
+++ b/src/target/cortex_a.c
@@ -452,12 +452,8 @@ static int cortex_a_instr_write_data_r0(struct arm_dpm *dpm,
return retval;
/* then the opcode, taking data from R0 */
- retval = cortex_a_exec_opcode(
- a->armv7a_common.arm.target,
- opcode,
- &dscr);
-
- return retval;
+ return cortex_a_exec_opcode(a->armv7a_common.arm.target, opcode,
+ &dscr);
}
static int cortex_a_instr_write_data_r0_r1(struct arm_dpm *dpm,
@@ -476,10 +472,8 @@ static int cortex_a_instr_write_data_r0_r1(struct arm_dpm *dpm,
return retval;
/* then the opcode, taking data from R0, R1 */
- retval = cortex_a_exec_opcode(a->armv7a_common.arm.target,
- opcode,
- &dscr);
- return retval;
+ return cortex_a_exec_opcode(a->armv7a_common.arm.target, opcode,
+ &dscr);
}
static int cortex_a_instr_cpsr_sync(struct arm_dpm *dpm)
@@ -603,9 +597,7 @@ static int cortex_a_bpwp_enable(struct arm_dpm *dpm, unsigned int index_t,
vr, addr);
if (retval != ERROR_OK)
return retval;
- retval = mem_ap_write_atomic_u32(a->armv7a_common.debug_ap,
- cr, control);
- return retval;
+ return mem_ap_write_atomic_u32(a->armv7a_common.debug_ap, cr, control);
}
static int cortex_a_bpwp_disable(struct arm_dpm *dpm, unsigned int index_t)
@@ -1185,9 +1177,8 @@ static int cortex_a_set_dscr_bits(struct target *target,
dscr |= value & bit_mask;
/* write new DSCR */
- retval = mem_ap_write_atomic_u32(armv7a->debug_ap,
- armv7a->debug_base + CPUDBG_DSCR, dscr);
- return retval;
+ return mem_ap_write_atomic_u32(armv7a->debug_ap,
+ armv7a->debug_base + CPUDBG_DSCR, dscr);
}
/*
diff --git a/src/target/dsp563xx.c b/src/target/dsp563xx.c
index 5b87da26e..33d8aa7f3 100644
--- a/src/target/dsp563xx.c
+++ b/src/target/dsp563xx.c
@@ -1996,7 +1996,6 @@ static int dsp563xx_remove_custom_watchpoint(struct target *target)
COMMAND_HANDLER(dsp563xx_add_watchpoint_command)
{
- int err = ERROR_OK;
struct target *target = get_current_target(CMD_CTX);
uint32_t mem_type = 0;
@@ -2054,9 +2053,7 @@ COMMAND_HANDLER(dsp563xx_add_watchpoint_command)
return ERROR_COMMAND_SYNTAX_ERROR;
}
- err = dsp563xx_add_custom_watchpoint(target, address, mem_type, rw, cond);
-
- return err;
+ return dsp563xx_add_custom_watchpoint(target, address, mem_type, rw, cond);
}
/* Adding a breakpoint using the once breakpoint logic.
diff --git a/src/target/mips32.c b/src/target/mips32.c
index 0071a6a5b..831477471 100644
--- a/src/target/mips32.c
+++ b/src/target/mips32.c
@@ -238,7 +238,6 @@ static const struct {
static int mips32_get_core_reg(struct reg *reg)
{
- int retval;
struct mips32_core_reg *mips32_reg = reg->arch_info;
struct target *target = mips32_reg->target;
struct mips32_common *mips32_target = target_to_mips32(target);
@@ -246,9 +245,7 @@ static int mips32_get_core_reg(struct reg *reg)
if (target->state != TARGET_HALTED)
return ERROR_TARGET_NOT_HALTED;
- retval = mips32_target->read_core_reg(target, mips32_reg->num);
-
- return retval;
+ return mips32_target->read_core_reg(target, mips32_reg->num);
}
static int mips32_set_core_reg(struct reg *reg, uint8_t *buf)
@@ -768,8 +765,7 @@ static int mips32_configure_ibs(struct target *target)
(ejtag_info->ejtag_iba_step_size * i);
/* clear IBIS reg */
- retval = target_write_u32(target, ejtag_info->ejtag_ibs_addr, 0);
- return retval;
+ return target_write_u32(target, ejtag_info->ejtag_ibs_addr, 0);
}
static int mips32_configure_dbs(struct target *target)
@@ -795,8 +791,7 @@ static int mips32_configure_dbs(struct target *target)
(ejtag_info->ejtag_dba_step_size * i);
/* clear DBIS reg */
- retval = target_write_u32(target, ejtag_info->ejtag_dbs_addr, 0);
- return retval;
+ return target_write_u32(target, ejtag_info->ejtag_dbs_addr, 0);
}
int mips32_configure_break_unit(struct target *target)
diff --git a/src/target/mips64.c b/src/target/mips64.c
index 515f8a7f5..3051f95c4 100644
--- a/src/target/mips64.c
+++ b/src/target/mips64.c
@@ -224,7 +224,6 @@ static int reg_type2size(enum reg_type type)
static int mips64_get_core_reg(struct reg *reg)
{
- int retval;
struct mips64_core_reg *mips64_reg = reg->arch_info;
struct target *target = mips64_reg->target;
struct mips64_common *mips64_target = target->arch_info;
@@ -232,9 +231,7 @@ static int mips64_get_core_reg(struct reg *reg)
if (target->state != TARGET_HALTED)
return ERROR_TARGET_NOT_HALTED;
- retval = mips64_target->read_core_reg(target, mips64_reg->num);
-
- return retval;
+ return mips64_target->read_core_reg(target, mips64_reg->num);
}
static int mips64_set_core_reg(struct reg *reg, uint8_t *buf)
diff --git a/src/target/openrisc/or1k_du_adv.c b/src/target/openrisc/or1k_du_adv.c
index f401ea9fb..1b5ce9618 100644
--- a/src/target/openrisc/or1k_du_adv.c
+++ b/src/target/openrisc/or1k_du_adv.c
@@ -686,8 +686,7 @@ retry_full_write:
bus_error_retries++;
if (bus_error_retries > MAX_BUS_ERRORS) {
LOG_ERROR("Max WB bus errors reached during burst read");
- retval = ERROR_FAIL;
- return retval;
+ return ERROR_FAIL;
}
/* Don't call retry_do(), a JTAG reset won't help a WB bus error */
diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c
index 50e0f83dd..23485d34f 100644
--- a/src/target/riscv/riscv-013.c
+++ b/src/target/riscv/riscv-013.c
@@ -447,9 +447,7 @@ static int increase_dmi_busy_delay(struct target *target)
if (res != ERROR_OK)
return res;
- res = riscv_scan_increase_delay(&info->learned_delays,
- RISCV_DELAY_BASE);
- return res;
+ return riscv_scan_increase_delay(&info->learned_delays, RISCV_DELAY_BASE);
}
static void reset_learned_delays(struct target *target)
diff --git a/src/target/stm8.c b/src/target/stm8.c
index 91687f86c..6f261c9cd 100644
--- a/src/target/stm8.c
+++ b/src/target/stm8.c
@@ -584,7 +584,6 @@ static int stm8_write_regs(struct target *target, uint32_t regs[])
static int stm8_get_core_reg(struct reg *reg)
{
- int retval;
struct stm8_core_reg *stm8_reg = reg->arch_info;
struct target *target = stm8_reg->target;
struct stm8_common *stm8 = target_to_stm8(target);
@@ -592,9 +591,7 @@ static int stm8_get_core_reg(struct reg *reg)
if (target->state != TARGET_HALTED)
return ERROR_TARGET_NOT_HALTED;
- retval = stm8->read_core_reg(target, stm8_reg->num);
-
- return retval;
+ return stm8->read_core_reg(target, stm8_reg->num);
}
static int stm8_set_core_reg(struct reg *reg, uint8_t *buf)
diff --git a/src/target/target.c b/src/target/target.c
index 22243722c..6a21280fc 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -2286,7 +2286,6 @@ void target_quit(void)
int target_arch_state(struct target *target)
{
- int retval;
if (!target) {
LOG_WARNING("No target has been configured");
return ERROR_OK;
@@ -2295,8 +2294,7 @@ int target_arch_state(struct target *target)
if (target->state != TARGET_HALTED)
return ERROR_OK;
- retval = target->type->arch_state(target);
- return retval;
+ return target->type->arch_state(target);
}
static int target_get_gdb_fileio_info_default(struct target *target,
diff --git a/src/target/xscale.c b/src/target/xscale.c
index 712db4ee2..fb901a3a4 100644
--- a/src/target/xscale.c
+++ b/src/target/xscale.c
@@ -2027,8 +2027,7 @@ static int xscale_disable_mmu_caches(struct target *target, int mmu,
return retval;
/* execute cpwait to ensure outstanding operations complete */
- retval = xscale_send_u32(target, 0x53);
- return retval;
+ return xscale_send_u32(target, 0x53);
}
static int xscale_enable_mmu_caches(struct target *target, int mmu,
@@ -2059,8 +2058,7 @@ static int xscale_enable_mmu_caches(struct target *target, int mmu,
return retval;
/* execute cpwait to ensure outstanding operations complete */
- retval = xscale_send_u32(target, 0x53);
- return retval;
+ return xscale_send_u32(target, 0x53);
}
static int xscale_set_breakpoint(struct target *target,
-----------------------------------------------------------------------
Summary of changes:
src/flash/nand/arm_io.c | 8 +--
src/flash/nand/at91sam9.c | 14 ++----
src/flash/nand/lpc3180.c | 5 +-
src/flash/nand/lpc32xx.c | 5 +-
src/flash/nor/at91sam3.c | 5 +-
src/flash/nor/at91sam4.c | 5 +-
src/flash/nor/at91sam4l.c | 8 +--
src/flash/nor/atsamv.c | 8 +--
src/flash/nor/fm3.c | 16 +++---
src/flash/nor/kinetis.c | 7 +--
src/flash/nor/lpcspifi.c | 16 +++---
src/flash/nor/msp432.c | 8 +--
src/flash/nor/niietcm4.c | 6 +--
src/flash/nor/nrf5.c | 7 ++-
src/flash/nor/psoc5lp.c | 6 +--
src/flash/nor/psoc6.c | 4 +-
src/flash/nor/stm32l4x.c | 3 +-
src/flash/nor/stm32lx.c | 4 +-
src/flash/nor/stmqspi.c | 4 +-
src/flash/nor/str9xpec.c | 11 +---
src/flash/nor/swm050.c | 3 +-
src/flash/nor/xmc4xxx.c | 19 ++-----
src/jtag/drivers/buspirate.c | 4 +-
src/jtag/drivers/dmem.c | 6 +--
src/jtag/drivers/rlink.c | 13 ++---
src/jtag/drivers/stlink_usb.c | 23 +++------
src/jtag/drivers/ulink.c | 6 +--
src/jtag/drivers/xds110.c | 102 +++++++-------------------------------
src/pld/efinix.c | 4 +-
src/pld/gowin.c | 4 +-
src/rtos/linux.c | 32 +++++-------
src/server/ipdbg.c | 4 +-
src/target/aarch64.c | 5 +-
src/target/arm720t.c | 9 ++--
src/target/arm920t.c | 12 ++---
src/target/arm926ejs.c | 9 ++--
src/target/armv7a_cache.c | 3 +-
src/target/armv7m.c | 9 +---
src/target/armv8.c | 8 +--
src/target/armv8_cache.c | 3 +-
src/target/avr32_ap7k.c | 5 +-
src/target/avr32_regs.c | 9 +---
src/target/cortex_a.c | 23 +++------
src/target/dsp563xx.c | 5 +-
src/target/mips32.c | 11 ++--
src/target/mips64.c | 5 +-
src/target/openrisc/or1k_du_adv.c | 3 +-
src/target/riscv/riscv-013.c | 4 +-
src/target/stm8.c | 5 +-
src/target/target.c | 4 +-
src/target/xscale.c | 6 +--
51 files changed, 130 insertions(+), 378 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-05-08 17: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 f9212ff31137ee8656cdf99ccac9d74cbd7164d6 (commit)
from 4133550fa2f7fab98980ac914be23298c8d71651 (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 f9212ff31137ee8656cdf99ccac9d74cbd7164d6
Author: Frederic Boyer <fre...@mi...>
Date: Mon May 4 15:00:18 2026 +0200
tcl/interface: add Microchip DV22S07A OpenOCD Debug Probe
Add interface configuration for the Microchip DV22S07A OpenOCD
Debug Probe.
JTAG only (no SWD support).
3.3V logic only, no level shifters.
USB-powered via USB 2.0 Type-C (connector J4).
Link: https://www.microchip.com/en-us/development-tool/DV22S07A
Change-Id: I739f054b90abc724d8e82cf30c7c3015f426107e
Signed-off-by: Frederic Boyer <fre...@mi...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9528
Reviewed-by: zapb <de...@za...>
Tested-by: jenkins
diff --git a/tcl/interface/microchip/dv22s07a.cfg b/tcl/interface/microchip/dv22s07a.cfg
new file mode 100644
index 000000000..aceb0c89b
--- /dev/null
+++ b/tcl/interface/microchip/dv22s07a.cfg
@@ -0,0 +1,22 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# Microchip DV22S07A OpenOCD Debug Probe
+#
+# https://www.microchip.com/en-us/development-tool/DV22S07A
+#
+# FT4232HQ-based JTAG debug probe.
+# Channel A is dedicated to JTAG (2x10 IDC connector J2).
+# 3.3V JTAG logic only (no level shifters).
+#
+# On Windows, the FT4232HQ Channel A interface requires a
+# libusb-compatible driver (WinUSB, libusbK) to be used with
+# OpenOCD. See the product page for installation instructions:
+# https://www.microchip.com/en-us/development-tool/DV22S07A
+#
+
+adapter driver ftdi
+adapter usb vid_pid 0x0403 0x6011
+ftdi channel 0
+ftdi layout_init 0x0038 0x003b
+ftdi layout_signal nTRST -data 0x0010 -oe 0x0010
+ftdi layout_signal nSRST -data 0x0020 -oe 0x0020
-----------------------------------------------------------------------
Summary of changes:
tcl/interface/microchip/dv22s07a.cfg | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
create mode 100644 tcl/interface/microchip/dv22s07a.cfg
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-05-08 17:14: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 4133550fa2f7fab98980ac914be23298c8d71651 (commit)
via 3227d73110989b95451b31d317fe1c9c45caf05f (commit)
from 3a7ec5c9e53c33ad5c73a15728c5ae4f9f0cd49d (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 4133550fa2f7fab98980ac914be23298c8d71651
Author: Marc Schink <de...@za...>
Date: Mon Feb 16 10:16:34 2026 +0000
tcl/board/silabs: Add config for EFR32FG23 Dev Kit
Tested on EFR32FG23 868-915 MHz +14 dBm Dev Kit.
Change-Id: Ieedad7d33af26600c7ae8b6b09aa7159aa22887c
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9467
Reviewed-by: Jérôme Pouiller <jer...@si...>
Tested-by: jenkins
Reviewed-by: Tomas Vanek <va...@fb...>
diff --git a/tcl/board/silabs/fg23-dk2600a.cfg b/tcl/board/silabs/fg23-dk2600a.cfg
new file mode 100644
index 000000000..572756c9c
--- /dev/null
+++ b/tcl/board/silabs/fg23-dk2600a.cfg
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+# EFR32FG23 868-915 MHz +14 dBm Dev Kit
+# https://www.silabs.com/development-tools/wireless/proprietary/efr32fg23-868-915-mhz-14-dbm-dev-kit
+
+source [find interface/jlink.cfg]
+
+transport select swd
+
+source [find target/silabs/xg23.cfg]
commit 3227d73110989b95451b31d317fe1c9c45caf05f
Author: Marc Schink <de...@za...>
Date: Mon Feb 16 10:15:47 2026 +0000
tcl/board/silabs: Add config for EFR32xG24 Explorer Kit
Tested on EFR32xG24 Explorer Kit.
Change-Id: Ib121eb8a728f353622df232a6f8433f6ceec2bbf
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9466
Reviewed-by: Tomas Vanek <va...@fb...>
Tested-by: jenkins
Reviewed-by: Jérôme Pouiller <jer...@si...>
diff --git a/tcl/board/silabs/xg24-ek2703a.cfg b/tcl/board/silabs/xg24-ek2703a.cfg
new file mode 100644
index 000000000..16260c808
--- /dev/null
+++ b/tcl/board/silabs/xg24-ek2703a.cfg
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+# EFR32xG24 Explorer Kit
+# https://www.silabs.com/development-tools/wireless/efr32xg24-explorer-kit
+
+source [find interface/jlink.cfg]
+
+transport select swd
+
+source [find target/silabs/xg24.cfg]
-----------------------------------------------------------------------
Summary of changes:
tcl/board/silabs/fg23-dk2600a.cfg | 10 ++++++++++
tcl/board/silabs/xg24-ek2703a.cfg | 10 ++++++++++
2 files changed, 20 insertions(+)
create mode 100644 tcl/board/silabs/fg23-dk2600a.cfg
create mode 100644 tcl/board/silabs/xg24-ek2703a.cfg
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-05-08 17:14: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 3a7ec5c9e53c33ad5c73a15728c5ae4f9f0cd49d (commit)
via fac7e0dca4f4f9814f0c6278992a4ee348e0cc94 (commit)
from b9735335e50456d80bfe0f4875dbb8df377ddecd (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 3a7ec5c9e53c33ad5c73a15728c5ae4f9f0cd49d
Author: Marc Schink <de...@za...>
Date: Mon Feb 16 10:14:47 2026 +0000
tcl/board/silabs: Add config for EFM32PG23 Pro Kit
Tested on EFM32PG23 Pro Kit.
Change-Id: Id6312bae3e582bb18c1e45cddaed84720f33f9ab
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9465
Reviewed-by: Jérôme Pouiller <jer...@si...>
Reviewed-by: Tomas Vanek <va...@fb...>
Tested-by: jenkins
diff --git a/tcl/board/silabs/pg23-pk2504a.cfg b/tcl/board/silabs/pg23-pk2504a.cfg
new file mode 100644
index 000000000..240ab5de5
--- /dev/null
+++ b/tcl/board/silabs/pg23-pk2504a.cfg
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+# EFM32PG23 Pro Kit
+# https://www.silabs.com/development-tools/mcu/32-bit/efm32pg23-pro-kit
+
+source [find interface/jlink.cfg]
+
+transport select swd
+
+source [find target/silabs/xg23.cfg]
commit fac7e0dca4f4f9814f0c6278992a4ee348e0cc94
Author: Marc Schink <de...@za...>
Date: Mon Feb 16 10:14:11 2026 +0000
tcl/board/silabs: Add config for EFM32PG28 Pro Kit
Tested on EFM32PG28 Pro Kit.
Change-Id: I082d5e064a6969df697cf22808d805e25b56eece
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9464
Reviewed-by: Jérôme Pouiller <jer...@si...>
Tested-by: jenkins
Reviewed-by: Tomas Vanek <va...@fb...>
diff --git a/tcl/board/silabs/pg28-pk2506a.cfg b/tcl/board/silabs/pg28-pk2506a.cfg
new file mode 100644
index 000000000..13f6f767d
--- /dev/null
+++ b/tcl/board/silabs/pg28-pk2506a.cfg
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+# EFM32PG28 Pro Kit
+# https://www.silabs.com/development-tools/mcu/32-bit/efm32pg28-pro-kit
+
+source [find interface/jlink.cfg]
+
+transport select swd
+
+source [find target/silabs/xg28.cfg]
-----------------------------------------------------------------------
Summary of changes:
tcl/board/silabs/pg23-pk2504a.cfg | 10 ++++++++++
tcl/board/silabs/pg28-pk2506a.cfg | 10 ++++++++++
2 files changed, 20 insertions(+)
create mode 100644 tcl/board/silabs/pg23-pk2504a.cfg
create mode 100644 tcl/board/silabs/pg28-pk2506a.cfg
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-05-08 17:11:07
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via b9735335e50456d80bfe0f4875dbb8df377ddecd (commit)
via a28990fdb4dd3b9a6e776007aedf9e1f315781b9 (commit)
from eec70f407f9b3219fb578d4b0f6de3e1154244ec (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 b9735335e50456d80bfe0f4875dbb8df377ddecd
Author: Antonio Borneo <bor...@gm...>
Date: Fri May 1 21:48:34 2026 +0200
adapters/xvc: doc: point to xvc-gpiod project
The project xvc-gpiod can be used to test the xvc driver.
Add the link to the documentation.
Change-Id: I4e303d17d0702b1b0532f8818a9f560ddf7641ff
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9607
Tested-by: jenkins
Reviewed-by: zapb <de...@za...>
diff --git a/doc/openocd.texi b/doc/openocd.texi
index aee1e4c5e..2b70054f8 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -3872,6 +3872,10 @@ This implementation is XVC protocol 1.0/1.1 compatible. However, 'mrd' and 'mwr'
extensions introduced in version 1.1 are not supported. Refer to:
@url{https://github.com/Xilinx/XilinxVirtualCable} for protocol specification.
+An implementation of XVC server to gpiod is available in
+@url{https://pypi.org/project/xvc-gpiod}
+and is suitable for testing this driver.
+
Example configuration:
@example
commit a28990fdb4dd3b9a6e776007aedf9e1f315781b9
Author: Marc Schink <de...@za...>
Date: Sun Apr 19 12:01:14 2026 +0200
adapters/xvc: Remove noisy debug output
The current debug output clutters the logs while adding little useful
information. Move them as LOG_DEBUG_IO().
Change-Id: I4b6261520e471194be7807e4205cd1ba05df15bc
Signed-off-by: Marc Schink <de...@za...>
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9583
Tested-by: jenkins
diff --git a/src/jtag/drivers/xvc.c b/src/jtag/drivers/xvc.c
index d5a5810f3..6e875e481 100644
--- a/src/jtag/drivers/xvc.c
+++ b/src/jtag/drivers/xvc.c
@@ -125,7 +125,7 @@ static int xvc_flush(void)
if (!xvc_used_bits) {
// Nothing to send, so we don't expect any bit back either.
last_used_bits = 0;
- LOG_DEBUG("XVC flush: no bits to flush");
+ LOG_DEBUG_IO("XVC flush: no bits to flush");
return ERROR_OK;
}
@@ -149,8 +149,8 @@ static int xvc_flush(void)
memcpy(xvc_send_buf + cp_offset, xvc_tdi_buf, number_of_bytes);
cp_offset += number_of_bytes;
// Updates the number of bytes used.
- LOG_DEBUG("XVC flush: cp_offset: %zu", cp_offset);
- LOG_DEBUG("XVC flush: used_bits: %d", xvc_used_bits);
+ LOG_DEBUG_IO("XVC flush: cp_offset: %zu", cp_offset);
+ LOG_DEBUG_IO("XVC flush: used_bits: %d", xvc_used_bits);
int written = write_socket(xvc_fd, xvc_send_buf, cp_offset);
if (written != (int)cp_offset) {
-----------------------------------------------------------------------
Summary of changes:
doc/openocd.texi | 4 ++++
src/jtag/drivers/xvc.c | 6 +++---
2 files changed, 7 insertions(+), 3 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-05-08 17:10: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 eec70f407f9b3219fb578d4b0f6de3e1154244ec (commit)
from ea528c7198207be6a89852ab50e2988f2f133e5c (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 eec70f407f9b3219fb578d4b0f6de3e1154244ec
Author: Mark O'Donovan <sh...@po...>
Date: Mon Apr 27 22:08:20 2026 +0100
Fix target usage text (underscore -> dash)
Fixed this issue in multiple places.
Change-Id: I44853774ea6b5dbbf57e7db73f896211b8eec655
Signed-off-by: Mark O'Donovan <sh...@po...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9600
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/jtag/hla/hla_transport.c b/src/jtag/hla/hla_transport.c
index d8ece0776..50d2d3e21 100644
--- a/src/jtag/hla/hla_transport.c
+++ b/src/jtag/hla/hla_transport.c
@@ -41,7 +41,7 @@ static const struct command_registration hl_swd_transport_subcommand_handlers[]
.help = "declare a new SWD DAP",
.usage = "basename dap_type ['-irlen' count] "
"['-enable'|'-disable'] "
- "['-expected_id' number] "
+ "['-expected-id' number] "
"['-ignore-version'] "
"['-ignore-bypass'] "
"['-ircapture' number] "
@@ -71,7 +71,7 @@ static const struct command_registration hl_transport_jtag_subcommand_handlers[]
"and appends it to the scan chain.",
.usage = "basename tap_type '-irlen' count "
"['-enable'|'-disable'] "
- "['-expected_id' number] "
+ "['-expected-id' number] "
"['-ignore-version'] "
"['-ignore-bypass'] "
"['-ircapture' number] "
diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c
index 9cffd6b5d..90d6799ab 100644
--- a/src/jtag/tcl.c
+++ b/src/jtag/tcl.c
@@ -719,7 +719,7 @@ static const struct command_registration jtag_subcommand_handlers[] = {
"and appends it to the scan chain.",
.usage = "basename tap_type '-irlen' count "
"['-enable'|'-disable'] "
- "['-expected_id' number] "
+ "['-expected-id' number] "
"['-ignore-version'] "
"['-ignore-bypass'] "
"['-ircapture' number] "
diff --git a/src/target/adi_v5_dapdirect.c b/src/target/adi_v5_dapdirect.c
index 07ea313d1..12d1a6881 100644
--- a/src/target/adi_v5_dapdirect.c
+++ b/src/target/adi_v5_dapdirect.c
@@ -62,7 +62,7 @@ static const struct command_registration dapdirect_jtag_subcommand_handlers[] =
.help = "declare a new TAP",
.usage = "basename tap_type '-irlen' count "
"['-enable'|'-disable'] "
- "['-expected_id' number] "
+ "['-expected-id' number] "
"['-ignore-version'] "
"['-ignore-bypass'] "
"['-ircapture' number] "
@@ -154,7 +154,7 @@ static const struct command_registration dapdirect_swd_subcommand_handlers[] = {
.help = "declare a new SWD DAP",
.usage = "basename dap_type ['-irlen' count] "
"['-enable'|'-disable'] "
- "['-expected_id' number] "
+ "['-expected-id' number] "
"['-ignore-version'] "
"['-ignore-bypass'] "
"['-ircapture' number] "
diff --git a/src/target/adi_v5_swd.c b/src/target/adi_v5_swd.c
index 57d2d5929..3c27224f5 100644
--- a/src/target/adi_v5_swd.c
+++ b/src/target/adi_v5_swd.c
@@ -700,7 +700,7 @@ static const struct command_registration swd_commands[] = {
.help = "declare a new SWD DAP",
.usage = "basename dap_type ['-irlen' count] "
"['-enable'|'-disable'] "
- "['-expected_id' number] "
+ "['-expected-id' number] "
"['-ignore-version'] "
"['-ignore-bypass'] "
"['-ircapture' number] "
-----------------------------------------------------------------------
Summary of changes:
src/jtag/hla/hla_transport.c | 4 ++--
src/jtag/tcl.c | 2 +-
src/target/adi_v5_dapdirect.c | 4 ++--
src/target/adi_v5_swd.c | 2 +-
4 files changed, 6 insertions(+), 6 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-05-08 17:09: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 ea528c7198207be6a89852ab50e2988f2f133e5c (commit)
from cd8cf385eab0e7388bd043f37484d8b1adffc2e2 (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 ea528c7198207be6a89852ab50e2988f2f133e5c
Author: Marc Schink <de...@za...>
Date: Sun Apr 26 10:30:52 2026 +0200
adapter/usb-blaster: Delegate USB VID/PID parsing to adapter core
Use the USB VID/PIDs provided by the adapter core instead of parsing
them in the driver code.
Keep the legacy 'usb_blaster vid_pid' command for backwards compatibility,
but mark it as deprecated.
Change-Id: I3f16e50100c9ce80fa5d06884631fb4575fce465
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9598
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/doc/openocd.texi b/doc/openocd.texi
index 06bda892a..aee1e4c5e 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -2996,22 +2996,25 @@ remote_bitbang host mysocket
@deffn {Interface Driver} {usb_blaster}
USB JTAG/USB-Blaster compatibles over one of the userspace libraries
-for FTDI chips. These interfaces have several commands, used to
-configure the driver before initializing the JTAG scan chain:
+for FTDI chips.
-@deffn {Config Command} {usb_blaster vid_pid} vid pid
-The vendor ID and product ID of the FTDI FT245 device. If not specified,
-default values are used.
-Currently, only one @var{vid}, @var{pid} pair may be given, e.g. for
-Altera USB-Blaster (default):
+Use @command{adapter usb vid_pid} to specify the vendor and product ID of the
+FT245 device. If not specified, default values are used.
+
+For example, Altera USB-Blaster (default):
@example
-usb_blaster vid_pid 0x09FB 0x6001
+adapter usb vid_pid 0x09FB 0x6001
@end example
The following VID/PID is for Kolja Waschk's USB JTAG:
@example
-usb_blaster vid_pid 0x16C0 0x06AD
+adapter usb vid_pid 0x16C0 0x06AD
@end example
-@end deffn
+
+Note that the second VID/PID pair passed to @command{adapter usb vid_pid} is
+used to detect uninitialized devices.
+
+This driver has several commands, used for configuration before initializing the
+JTAG scan chain:
@deffn {Command} {usb_blaster pin} (@option{pin6}|@option{pin8}) (@option{0}|@option{1}|@option{s}|@option{t})
Sets the state or function of the unused GPIO pins on USB-Blasters
diff --git a/src/jtag/drivers/usb_blaster/usb_blaster.c b/src/jtag/drivers/usb_blaster/usb_blaster.c
index 81344664e..b95273277 100644
--- a/src/jtag/drivers/usb_blaster/usb_blaster.c
+++ b/src/jtag/drivers/usb_blaster/usb_blaster.c
@@ -63,6 +63,7 @@
#endif
/* project specific includes */
+#include <jtag/adapter.h>
#include <jtag/interface.h>
#include <jtag/commands.h>
#include <helper/time_support.h>
@@ -825,9 +826,9 @@ static int ublast_execute_queue(struct jtag_command *cmd_queue)
*/
static int ublast_init(void)
{
- int ret, i;
+ int ret;
- for (i = 0; lowlevel_drivers_map[i].name; i++) {
+ for (unsigned int i = 0; lowlevel_drivers_map[i].name; i++) {
if (info.lowlevel_name) {
if (!strcmp(lowlevel_drivers_map[i].name, info.lowlevel_name)) {
info.drv = lowlevel_drivers_map[i].drv_register();
@@ -853,6 +854,24 @@ static int ublast_init(void)
return ERROR_JTAG_DEVICE_ERROR;
}
+ unsigned int num_vid_pid_pairs = 0;
+
+ for (unsigned int i = 0; adapter_usb_get_vids()[i]; i++)
+ num_vid_pid_pairs++;
+
+ if (num_vid_pid_pairs > 0) {
+ info.ublast_vid = adapter_usb_get_vids()[0];
+ info.ublast_pid = adapter_usb_get_pids()[0];
+ }
+
+ if (num_vid_pid_pairs > 1) {
+ info.ublast_vid_uninit = adapter_usb_get_vids()[1];
+ info.ublast_pid_uninit = adapter_usb_get_pids()[1];
+ }
+
+ if (num_vid_pid_pairs > 2)
+ LOG_WARNING("ignoring extra IDs in adapter usb vid_pid (maximum is 2 pairs)");
+
/*
* Register the lowlevel driver
*/
@@ -893,31 +912,6 @@ static int ublast_quit(void)
return info.drv->close(info.drv);
}
-COMMAND_HANDLER(ublast_handle_vid_pid_command)
-{
- if (CMD_ARGC > 4) {
- LOG_WARNING("ignoring extra IDs in ublast_vid_pid "
- "(maximum is 2 pairs)");
- CMD_ARGC = 4;
- }
-
- if (CMD_ARGC >= 2) {
- COMMAND_PARSE_NUMBER(u16, CMD_ARGV[0], info.ublast_vid);
- COMMAND_PARSE_NUMBER(u16, CMD_ARGV[1], info.ublast_pid);
- } else {
- LOG_WARNING("incomplete ublast_vid_pid configuration");
- }
-
- if (CMD_ARGC == 4) {
- COMMAND_PARSE_NUMBER(u16, CMD_ARGV[2], info.ublast_vid_uninit);
- COMMAND_PARSE_NUMBER(u16, CMD_ARGV[3], info.ublast_pid_uninit);
- } else {
- LOG_WARNING("incomplete ublast_vid_pid configuration");
- }
-
- return ERROR_OK;
-}
-
COMMAND_HANDLER(ublast_handle_pin_command)
{
uint8_t out_value;
@@ -1006,15 +1000,6 @@ COMMAND_HANDLER(ublast_firmware_command)
static const struct command_registration ublast_subcommand_handlers[] = {
- {
- .name = "vid_pid",
- .handler = ublast_handle_vid_pid_command,
- .mode = COMMAND_CONFIG,
- .help = "the vendor ID and product ID of the USB-Blaster and "
- "vendor ID and product ID of the uninitialized device "
- "for USB-Blaster II",
- .usage = "vid pid vid_uninit pid_uninit",
- },
{
.name = "lowlevel_driver",
.handler = ublast_handle_lowlevel_drv_command,
diff --git a/src/jtag/startup.tcl b/src/jtag/startup.tcl
index 730f4d262..995a289b0 100644
--- a/src/jtag/startup.tcl
+++ b/src/jtag/startup.tcl
@@ -823,8 +823,14 @@ proc usb_blaster_device_desc args {
lappend _telnet_autocomplete_skip usb_blaster_vid_pid
proc usb_blaster_vid_pid args {
- echo "DEPRECATED! use 'usb_blaster vid_pid' not 'usb_blaster_vid_pid'"
- eval usb_blaster vid_pid $args
+ echo "DEPRECATED! use 'adapter usb vid_pid' not 'usb_blaster_vid_pid'"
+ eval adapter usb vid_pid $args
+}
+
+lappend _telnet_autocomplete_skip "usb_blaster vid_pid"
+proc "usb_blaster vid_pid" args {
+ echo "DEPRECATED! use 'adapter usb vid_pid' not 'usb_blaster vid_pid'"
+ eval adapter usb vid_pid $args
}
lappend _telnet_autocomplete_skip usb_blaster_lowlevel_driver
diff --git a/tcl/board/altera_sockit.cfg b/tcl/board/altera_sockit.cfg
index bbd87d646..3df6f8742 100644
--- a/tcl/board/altera_sockit.cfg
+++ b/tcl/board/altera_sockit.cfg
@@ -14,7 +14,7 @@ adapter driver usb_blaster
source [find target/altera_fpgasoc.cfg]
# If the USB Blaster II were supported, these settings would be needed
-#usb_blaster vid_pid 0x09fb 0x6810
+#adapter usb vid_pid 0x09fb 0x6810
#usb_blaster device_desc "USB-Blaster II"
adapter speed 100
diff --git a/tcl/interface/altera-usb-blaster.cfg b/tcl/interface/altera-usb-blaster.cfg
index cc6057b51..c9a56b268 100644
--- a/tcl/interface/altera-usb-blaster.cfg
+++ b/tcl/interface/altera-usb-blaster.cfg
@@ -9,5 +9,5 @@
adapter driver usb_blaster
usb_blaster lowlevel_driver ftdi
# These are already the defaults.
-# usb_blaster vid_pid 0x09FB 0x6001
+# adapter usb vid_pid 0x09FB 0x6001
# usb_blaster device_desc "USB-Blaster"
diff --git a/tcl/interface/altera-usb-blaster2.cfg b/tcl/interface/altera-usb-blaster2.cfg
index 93f9809b0..95927676b 100644
--- a/tcl/interface/altera-usb-blaster2.cfg
+++ b/tcl/interface/altera-usb-blaster2.cfg
@@ -5,6 +5,6 @@
#
adapter driver usb_blaster
-usb_blaster vid_pid 0x09fb 0x6010 0x09fb 0x6810
+adapter usb vid_pid 0x09fb 0x6010 0x09fb 0x6810
usb_blaster lowlevel_driver ublast2
usb_blaster firmware /path/to/quartus/blaster_6810.hex
diff --git a/tcl/interface/usb-jtag.cfg b/tcl/interface/usb-jtag.cfg
index 039c748b3..c7f3d60c2 100644
--- a/tcl/interface/usb-jtag.cfg
+++ b/tcl/interface/usb-jtag.cfg
@@ -32,7 +32,7 @@
# driver but ixo-usb-jtag requires the ftdi driver.
adapter driver usb_blaster
-usb_blaster vid_pid 0x16C0 0x06AD
+adapter usb vid_pid 0x16C0 0x06AD
usb_blaster device_desc "Van Ooijen Technische Informatica"
# ixo-usb-jtag is only compatible with the ublast1 protocol implemented via the
# ftdi modes, using ublast2 will cause openocd to hang.
-----------------------------------------------------------------------
Summary of changes:
doc/openocd.texi | 23 ++++++------
src/jtag/drivers/usb_blaster/usb_blaster.c | 57 +++++++++++-------------------
src/jtag/startup.tcl | 10 ++++--
tcl/board/altera_sockit.cfg | 2 +-
tcl/interface/altera-usb-blaster.cfg | 2 +-
tcl/interface/altera-usb-blaster2.cfg | 2 +-
tcl/interface/usb-jtag.cfg | 2 +-
7 files changed, 46 insertions(+), 52 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-05-08 17:09:07
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via cd8cf385eab0e7388bd043f37484d8b1adffc2e2 (commit)
via 7d937ed3635d859021bb4c24a98aea1e2b279668 (commit)
from ead2fa8c2e11ff90463e911a8ced04a68ba01d3b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit cd8cf385eab0e7388bd043f37484d8b1adffc2e2
Author: Marc Schink <de...@za...>
Date: Tue Apr 28 08:55:32 2026 +0200
adapter/hla: Delegate USB VID/PID parsing to adapter core
Use the USB VID/PIDs provided by the adapter core instead of parsing
them in the driver code.
Keep the legacy 'hla_vid_pid' command for backwards compatibility, but
mark it as deprecated.
Change-Id: Ie3dc8333f5fb863ff68537b803a0b6e96cf35b09
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9597
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/doc/openocd.texi b/doc/openocd.texi
index 5a46fe258..06bda892a 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -3330,10 +3330,6 @@ Currently Not Supported.
Specifies the adapter layout to use.
@end deffn
-@deffn {Config Command} {hla vid_pid} [vid pid]+
-Pairs of vendor IDs and product IDs of the device.
-@end deffn
-
@deffn {Config Command} {hla stlink_backend} (usb | tcp [port])
@emph{ST-Link only:} Choose between 'exclusive' USB communication (the default backend) or
'shared' mode using ST-Link TCP server (the default port is 7184).
diff --git a/src/jtag/drivers/nulink_usb.c b/src/jtag/drivers/nulink_usb.c
index 66cf25a6d..df140ba58 100644
--- a/src/jtag/drivers/nulink_usb.c
+++ b/src/jtag/drivers/nulink_usb.c
@@ -1030,7 +1030,7 @@ static int nulink_usb_open(struct hl_interface_param *param, void **fd)
if (param->transport != HL_TRANSPORT_SWD)
return TARGET_UNKNOWN;
- if (!param->vid[0] && !param->pid[0]) {
+ if (!adapter_usb_get_vids()[0] && !adapter_usb_get_pids()[0]) {
LOG_ERROR("Missing vid/pid");
return ERROR_FAIL;
}
@@ -1068,8 +1068,9 @@ static int nulink_usb_open(struct hl_interface_param *param, void **fd)
while (cur_dev) {
bool found = false;
- for (unsigned int i = 0; param->vid[i] || param->pid[i]; i++) {
- if (param->vid[i] == cur_dev->vendor_id && param->pid[i] == cur_dev->product_id) {
+ for (unsigned int i = 0; adapter_usb_get_vids()[i] != 0; i++) {
+ if (cur_dev->vendor_id == adapter_usb_get_vids()[i] &&
+ cur_dev->product_id == adapter_usb_get_pids()[i]) {
found = true;
break;
}
diff --git a/src/jtag/drivers/stlink_usb.c b/src/jtag/drivers/stlink_usb.c
index bac9c26cb..c64e149cb 100644
--- a/src/jtag/drivers/stlink_usb.c
+++ b/src/jtag/drivers/stlink_usb.c
@@ -3642,8 +3642,9 @@ static int stlink_tcp_open(void *handle, struct hl_interface_param *param)
stlink_used = h->tcp_backend_priv.recv_buf[44];
/* check the vid:pid */
- for (int i = 0; param->vid[i]; i++) {
- if (param->vid[i] == h->vid && param->pid[i] == h->pid) {
+ for (unsigned int i = 0; adapter_usb_get_vids()[i]; i++) {
+ if (h->vid == adapter_usb_get_vids()[i] &&
+ h->pid == adapter_usb_get_pids()[i]) {
stlink_id_matched = true;
break;
}
diff --git a/src/jtag/drivers/ti_icdi_usb.c b/src/jtag/drivers/ti_icdi_usb.c
index 5bac659c4..cd740b296 100644
--- a/src/jtag/drivers/ti_icdi_usb.c
+++ b/src/jtag/drivers/ti_icdi_usb.c
@@ -665,13 +665,14 @@ static int icdi_usb_open(struct hl_interface_param *param, void **fd)
return ERROR_FAIL;
}
- for (uint8_t i = 0; param->vid[i] && param->pid[i]; ++i)
- LOG_DEBUG("transport: %d vid: 0x%04x pid: 0x%04x serial: %s", param->transport,
- param->vid[i], param->pid[i], adapter_get_required_serial() ? adapter_get_required_serial() : "");
+ for (unsigned int i = 0; adapter_usb_get_vids()[i]; ++i)
+ LOG_DEBUG("transport: %d vid: 0x%04x pid: 0x%04x serial: %s",
+ param->transport, adapter_usb_get_vids()[i], adapter_usb_get_pids()[i],
+ adapter_get_required_serial() ? adapter_get_required_serial() : "");
/* TI (Stellaris) ICDI provides its serial number in the USB descriptor;
no need to provide a callback here. */
- jtag_libusb_open(param->vid, param->pid, NULL, &h->usb_dev, NULL);
+ jtag_libusb_open(adapter_usb_get_vids(), adapter_usb_get_pids(), NULL, &h->usb_dev, NULL);
if (!h->usb_dev) {
LOG_ERROR("open failed");
diff --git a/src/jtag/hla/hla_interface.c b/src/jtag/hla/hla_interface.c
index a9d196cce..9fa1df92c 100644
--- a/src/jtag/hla/hla_interface.c
+++ b/src/jtag/hla/hla_interface.c
@@ -26,8 +26,6 @@
static struct hl_interface hl_if = {
.param = {
.device_desc = NULL,
- .vid = { 0 },
- .pid = { 0 },
.transport = HL_TRANSPORT_UNKNOWN,
.connect_under_reset = false,
.use_stlink_tcp = false,
@@ -248,33 +246,6 @@ COMMAND_HANDLER(hl_interface_handle_layout_command)
return ERROR_FAIL;
}
-COMMAND_HANDLER(hl_interface_handle_vid_pid_command)
-{
- if (CMD_ARGC > HLA_MAX_USB_IDS * 2) {
- LOG_WARNING("ignoring extra IDs in hla_vid_pid "
- "(maximum is %d pairs)", HLA_MAX_USB_IDS);
- CMD_ARGC = HLA_MAX_USB_IDS * 2;
- }
- if (CMD_ARGC < 2 || (CMD_ARGC & 1)) {
- LOG_WARNING("incomplete hla_vid_pid configuration directive");
- return ERROR_COMMAND_SYNTAX_ERROR;
- }
-
- unsigned int i;
- for (i = 0; i < CMD_ARGC; i += 2) {
- COMMAND_PARSE_NUMBER(u16, CMD_ARGV[i], hl_if.param.vid[i / 2]);
- COMMAND_PARSE_NUMBER(u16, CMD_ARGV[i + 1], hl_if.param.pid[i / 2]);
- }
-
- /*
- * Explicitly terminate, in case there are multiple instances of
- * hla_vid_pid.
- */
- hl_if.param.vid[i / 2] = hl_if.param.pid[i / 2] = 0;
-
- return ERROR_OK;
-}
-
COMMAND_HANDLER(hl_interface_handle_stlink_backend_command)
{
/* default values */
@@ -330,13 +301,6 @@ static const struct command_registration hl_interface_subcommand_handlers[] = {
.help = "set the layout of the adapter",
.usage = "layout_name",
},
- {
- .name = "vid_pid",
- .handler = &hl_interface_handle_vid_pid_command,
- .mode = COMMAND_CONFIG,
- .help = "the vendor and product ID of the adapter",
- .usage = "(vid pid)*",
- },
{
.name = "stlink_backend",
.handler = &hl_interface_handle_stlink_backend_command,
diff --git a/src/jtag/hla/hla_interface.h b/src/jtag/hla/hla_interface.h
index c0ee05498..8701c033a 100644
--- a/src/jtag/hla/hla_interface.h
+++ b/src/jtag/hla/hla_interface.h
@@ -21,10 +21,6 @@ enum e_hl_transports;
struct hl_interface_param {
/** */
const char *device_desc;
- /** List of recognised VIDs */
- uint16_t vid[HLA_MAX_USB_IDS + 1];
- /** List of recognised PIDs */
- uint16_t pid[HLA_MAX_USB_IDS + 1];
/** */
enum hl_transports transport;
/** */
diff --git a/src/jtag/startup.tcl b/src/jtag/startup.tcl
index 53482d60a..730f4d262 100644
--- a/src/jtag/startup.tcl
+++ b/src/jtag/startup.tcl
@@ -1186,8 +1186,8 @@ proc "hla_device_desc" {desc} {
lappend _telnet_autocomplete_skip "hla_vid_pid"
proc "hla_vid_pid" {args} {
- echo "DEPRECATED! use 'hla vid_pid', not 'hla_vid_pid'"
- eval hla vid_pid $args
+ echo "DEPRECATED! use 'adapter usb vid_pid', not 'hla_vid_pid'"
+ eval adapter usb vid_pid $args
}
lappend _telnet_autocomplete_skip "hla_command"
diff --git a/tcl/interface/nulink.cfg b/tcl/interface/nulink.cfg
index be68347e7..86b0a421a 100644
--- a/tcl/interface/nulink.cfg
+++ b/tcl/interface/nulink.cfg
@@ -7,7 +7,7 @@
adapter driver hla
hla layout nulink
hla device_desc "Nu-Link"
-hla vid_pid 0x0416 0x511b 0x0416 0x511c 0x0416 0x511d 0x0416 0x5200 0x0416 0x5201
+adapter usb vid_pid 0x0416 0x511b 0x0416 0x511c 0x0416 0x511d 0x0416 0x5200 0x0416 0x5201
# Only swd is supported
transport select swd
diff --git a/tcl/interface/stlink-hla.cfg b/tcl/interface/stlink-hla.cfg
index 5c4adb897..adbfda8e2 100644
--- a/tcl/interface/stlink-hla.cfg
+++ b/tcl/interface/stlink-hla.cfg
@@ -11,7 +11,9 @@ echo "Consider updating your ST-Link firmware to a version >= V2J24 (2015)"
adapter driver hla
hla layout stlink
hla device_desc "ST-LINK"
-hla vid_pid 0x0483 0x3744 0x0483 0x3748 0x0483 0x374b 0x0483 0x374d 0x0483 0x374e 0x0483 0x374f 0x0483 0x3752 0x0483 0x3753 0x0483 0x3754 0x0483 0x3755 0x0483 0x3757
+adapter usb vid_pid 0x0483 0x3744 0x0483 0x3748 0x0483 0x374b 0x0483 0x374d \
+ 0x0483 0x374e 0x0483 0x374f 0x0483 0x3752 0x0483 0x3753 \
+ 0x0483 0x3754 0x0483 0x3755 0x0483 0x3757
# Optionally specify the serial number of ST-LINK/V2 usb device. ST-LINK/V2
# devices seem to have serial numbers with unreadable characters. ST-LINK/V2
diff --git a/tcl/interface/ti-icdi.cfg b/tcl/interface/ti-icdi.cfg
index c13d27e8b..fdd879a7e 100644
--- a/tcl/interface/ti-icdi.cfg
+++ b/tcl/interface/ti-icdi.cfg
@@ -11,7 +11,7 @@
adapter driver hla
hla layout ti-icdi
-hla vid_pid 0x1cbe 0x00fd
+adapter usb vid_pid 0x1cbe 0x00fd
# Optionally specify the serial number of TI-ICDI devices, for when using
# multiple devices. Serial numbers can be obtained using lsusb -v
commit 7d937ed3635d859021bb4c24a98aea1e2b279668
Author: Marc Schink <de...@za...>
Date: Thu Apr 23 21:43:55 2026 +0200
adapter/esp-usb-jtag: Delegate USB VID/PID parsing to adapter core
Use the USB VID/PIDs provided by the adapter core instead of parsing
them in the driver code.
Keep the legacy 'espusbjtag vid_pid' command for backwards compatibility,
but mark it as deprecated.
Change-Id: Ib02795607ab44d4d4da04068a16eb508892c42ad
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9596
Reviewed-by: Antonio Borneo <bor...@gm...>
Tested-by: jenkins
diff --git a/doc/openocd.texi b/doc/openocd.texi
index 18eb6da92..5a46fe258 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -3779,13 +3779,6 @@ espusbjtag setio 0 1 0 1 0
@end example
@end deffn
-@deffn {Config Command} {espusbjtag vid_pid} vid_pid
-Set vendor ID and product ID for the ESP usb jtag driver
-@example
-espusbjtag vid_pid 0x303a 0x1001
-@end example
-@end deffn
-
@deffn {Config Command} {espusbjtag caps_descriptor} caps_descriptor
Set the jtag descriptor to read capabilities of ESP usb jtag driver
@example
diff --git a/src/jtag/drivers/esp_usb_jtag.c b/src/jtag/drivers/esp_usb_jtag.c
index a13303511..20794e9ef 100644
--- a/src/jtag/drivers/esp_usb_jtag.c
+++ b/src/jtag/drivers/esp_usb_jtag.c
@@ -218,8 +218,6 @@ struct esp_usb_jtag {
static struct esp_usb_jtag esp_usb_jtag_priv;
static struct esp_usb_jtag *priv = &esp_usb_jtag_priv;
-static int esp_usb_vid;
-static int esp_usb_pid;
static int esp_usb_jtag_caps;
static int esp_usb_target_chip_id;
@@ -476,9 +474,6 @@ static int esp_usb_jtag_init(void)
{
memset(priv, 0, sizeof(struct esp_usb_jtag));
- const uint16_t vids[] = { esp_usb_vid, 0 }; /* must be null terminated */
- const uint16_t pids[] = { esp_usb_pid, 0 }; /* must be null terminated */
-
bitq_interface = &priv->bitq_interface;
bitq_interface->out = esp_usb_jtag_out;
bitq_interface->flush = esp_usb_jtag_flush;
@@ -487,7 +482,8 @@ static int esp_usb_jtag_init(void)
bitq_interface->in_rdy = esp_usb_jtag_in_rdy;
bitq_interface->in = esp_usb_jtag_in;
- int r = jtag_libusb_open(vids, pids, NULL, &priv->usb_device, NULL);
+ int r = jtag_libusb_open(adapter_usb_get_vids(), adapter_usb_get_pids(),
+ NULL, &priv->usb_device, NULL);
if (r != ERROR_OK) {
LOG_ERROR("esp_usb_jtag: could not find or open device!");
goto out;
@@ -693,18 +689,6 @@ COMMAND_HANDLER(esp_usb_jtag_setio_cmd)
return ERROR_OK;
}
-COMMAND_HANDLER(esp_usb_jtag_vid_pid)
-{
- if (CMD_ARGC != 2)
- return ERROR_COMMAND_SYNTAX_ERROR;
-
- COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], esp_usb_vid);
- COMMAND_PARSE_NUMBER(int, CMD_ARGV[1], esp_usb_pid);
- LOG_INFO("esp_usb_jtag: VID set to 0x%x and PID to 0x%x", esp_usb_vid, esp_usb_pid);
-
- return ERROR_OK;
-}
-
COMMAND_HANDLER(esp_usb_jtag_caps_descriptor)
{
if (CMD_ARGC != 1)
@@ -742,13 +726,6 @@ static const struct command_registration esp_usb_jtag_subcommands[] = {
.help = "Manually set the status of the output lines",
.usage = "tdi tms tck trst srst"
},
- {
- .name = "vid_pid",
- .handler = &esp_usb_jtag_vid_pid,
- .mode = COMMAND_CONFIG,
- .help = "set vendor ID and product ID for ESP usb jtag driver",
- .usage = "vid pid",
- },
{
.name = "caps_descriptor",
.handler = &esp_usb_jtag_caps_descriptor,
diff --git a/src/jtag/startup.tcl b/src/jtag/startup.tcl
index 5b44eb447..53482d60a 100644
--- a/src/jtag/startup.tcl
+++ b/src/jtag/startup.tcl
@@ -241,6 +241,13 @@ proc interface_list args {
eval adapter list $args
}
+lappend _telnet_autocomplete_skip "espusbjtag vid_pid"
+proc "espusbjtag vid_pid" args {
+ echo "DEPRECATED! use 'adapter usb vid_pid' not 'espusbjtag vid_pid'"
+ eval adapter usb vid_pid $args
+}
+
+
lappend _telnet_autocomplete_skip ftdi_location
proc ftdi_location args {
echo "DEPRECATED! use 'adapter usb location' not 'ftdi_location'"
diff --git a/tcl/interface/esp_usb_bridge.cfg b/tcl/interface/esp_usb_bridge.cfg
index 9342239e7..9354855ba 100644
--- a/tcl/interface/esp_usb_bridge.cfg
+++ b/tcl/interface/esp_usb_bridge.cfg
@@ -5,5 +5,5 @@
adapter driver esp_usb_jtag
-espusbjtag vid_pid 0x303a 0x1002
+adapter usb vid_pid 0x303a 0x1002
espusbjtag caps_descriptor 0x030A # string descriptor index:10
diff --git a/tcl/interface/esp_usb_jtag.cfg b/tcl/interface/esp_usb_jtag.cfg
index 583a92d6a..eff1224a8 100644
--- a/tcl/interface/esp_usb_jtag.cfg
+++ b/tcl/interface/esp_usb_jtag.cfg
@@ -5,7 +5,7 @@
adapter driver esp_usb_jtag
-espusbjtag vid_pid 0x303a 0x1001
+adapter usb vid_pid 0x303a 0x1001
espusbjtag caps_descriptor 0x2000
transport select jtag
-----------------------------------------------------------------------
Summary of changes:
doc/openocd.texi | 11 -----------
src/jtag/drivers/esp_usb_jtag.c | 27 ++-------------------------
src/jtag/drivers/nulink_usb.c | 7 ++++---
src/jtag/drivers/stlink_usb.c | 5 +++--
src/jtag/drivers/ti_icdi_usb.c | 9 +++++----
src/jtag/hla/hla_interface.c | 36 ------------------------------------
src/jtag/hla/hla_interface.h | 4 ----
src/jtag/startup.tcl | 11 +++++++++--
tcl/interface/esp_usb_bridge.cfg | 2 +-
tcl/interface/esp_usb_jtag.cfg | 2 +-
tcl/interface/nulink.cfg | 2 +-
tcl/interface/stlink-hla.cfg | 4 +++-
tcl/interface/ti-icdi.cfg | 2 +-
13 files changed, 30 insertions(+), 92 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|