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
(14) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: openocd-gerrit <ope...@us...> - 2026-04-06 16:50: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 b80f554fd982b65bd3b45bb151655abe634e938b (commit)
from 3d83e9546e1f5050a7079eeca0a18d4259cd4949 (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 b80f554fd982b65bd3b45bb151655abe634e938b
Author: Marc Schink <de...@za...>
Date: Thu Feb 26 15:48:43 2026 +0100
helper/log: Fix build issue on MSYS2 and Cygwin
On MSYS2 (native) and Cygwin, the mallinfo struct uses 'size_t' instead
of 'int', which leads to a compile-time error with the current code.
Update the preprocessor logic so that Cygwin and MSYS2 builds use
the 'size_t' format specifier.
Checkpatch-ignore: COMMIT_LOG_LONG_LINE
Build error on MSYS2:
../src/helper/log.c: In function 'get_free_memory_space':
../src/helper/log.c:78:45: error: format '%d' expects argument of type 'int', but argument 4 has type 'size_t' {aka 'long unsigned int'} [-Werror=format=]
78 | snprintf(s, MEM_STR_LEN, " %d", info.fordblks);
| ~^ ~~~~~~~~~~~~~
| | |
| int size_t {aka long unsigned int}
| %ld
Change-Id: I18d772facba6426ab627fb45a6d50bfc19ec9c05
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9479
Reviewed-by: Antonio Borneo <bor...@gm...>
Tested-by: jenkins
diff --git a/src/helper/log.c b/src/helper/log.c
index afba0d172..ce21a907d 100644
--- a/src/helper/log.c
+++ b/src/helper/log.c
@@ -75,7 +75,11 @@ static void get_free_memory_space(char *s)
#elif defined(HAVE_MALLINFO)
if (LOG_LEVEL_IS(LOG_LVL_DEBUG_MALLOC)) {
struct mallinfo info = mallinfo();
+#if IS_CYGWIN
+ snprintf(s, MEM_STR_LEN, " %zu", info.fordblks);
+#else
snprintf(s, MEM_STR_LEN, " %d", info.fordblks);
+#endif
return;
}
#endif
-----------------------------------------------------------------------
Summary of changes:
src/helper/log.c | 4 ++++
1 file changed, 4 insertions(+)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-04-06 16:49:33
|
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 3d83e9546e1f5050a7079eeca0a18d4259cd4949 (commit)
from 232cd0b0f1dfe08177ea2d584913433d23fdd9cf (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 3d83e9546e1f5050a7079eeca0a18d4259cd4949
Author: Marc Schink <de...@za...>
Date: Fri Mar 13 13:14:18 2026 +0100
flash/nor/fm4: Fix build on MSYS2 with Clang
The to{upper,lower} macros on MSYS2 (native) and Cygwin are implemented
as table lookups and expect values representable as 'unsigned char'.
Passing a signed char can lead to negative array indices and compile-time
errors (-Werror=char-subscripts).
Add explicit casts to 'unsigned char' to all affected is* calls, as
recommended by the TOUPPER(3) manual page.
Checkpatch-ignore: COMMIT_LOG_LONG_LINE
../src/flash/nor/fm4.c:608:28: error: array subscript is of type 'char' [-Werror,-Wchar-subscripts]
608 | if (pattern[i] != 'x' && tolower(s[i]) != tolower(pattern[i]))
| ^~~~~~~~~~~~~
/usr/include/ctype.h:172:25: note: expanded from macro 'tolower'
172 | (void) __CTYPE_PTR[__x]; (tolower) (__x);})
| ^~~~
../src/flash/nor/fm4.c:608:45: error: array subscript is of type 'char' [-Werror,-Wchar-subscripts]
608 | if (pattern[i] != 'x' && tolower(s[i]) != tolower(pattern[i]))
| ^~~~~~~~~~~~~~~~~~~
/usr/include/ctype.h:172:25: note: expanded from macro 'tolower'
172 | (void) __CTYPE_PTR[__x]; (tolower) (__x);})
| ^~~~
Change-Id: If9cca0a252d091bf01774ad33224904d807ee16c
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9539
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/flash/nor/fm4.c b/src/flash/nor/fm4.c
index 2db79ef50..4c8f14c9a 100644
--- a/src/flash/nor/fm4.c
+++ b/src/flash/nor/fm4.c
@@ -605,7 +605,7 @@ static bool fm4_name_match(const char *s, const char *pattern)
if (!pattern[i])
return true;
/* Use x as wildcard */
- if (pattern[i] != 'x' && tolower(s[i]) != tolower(pattern[i]))
+ if (pattern[i] != 'x' && tolower((unsigned char)s[i]) != tolower((unsigned char)pattern[i]))
return false;
i++;
}
-----------------------------------------------------------------------
Summary of changes:
src/flash/nor/fm4.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-04-06 16:48: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 232cd0b0f1dfe08177ea2d584913433d23fdd9cf (commit)
from a22e4331e7c9a7377e63dcd3de151e82f9b5ddbf (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 232cd0b0f1dfe08177ea2d584913433d23fdd9cf
Author: Marc Schink <de...@za...>
Date: Thu Feb 26 05:56:57 2026 -0800
Fix build issue on MSYS2 and Cygwin
The is* macros on MSYS2 (native) and Cygwin are implemented as table
lookups and expect values representable as 'unsigned char'. Passing a
signed char can lead to negative array indices and compile-time
errors (-Werror=char-subscripts).
Add explicit casts to 'unsigned char' to all affected is* calls, as
recommended by the ISALPHA(3) manual page.
Example error message on Cygwin:
../src/helper/log.c: In function âfind_nonprint_charâ:
../src/helper/log.c:525:33: error: array subscript has type âcharâ [-Werror=char-subscripts]
525 | if (!isprint(buf[i]))
Change-Id: I9c7a5cc1085e15fed0f3f974ec943abad44e68a0
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9478
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/helper/log.c b/src/helper/log.c
index 0976f4e0f..afba0d172 100644
--- a/src/helper/log.c
+++ b/src/helper/log.c
@@ -526,7 +526,7 @@ void log_socket_error(const char *socket_desc)
const char *find_nonprint_char(const char *buf, unsigned int buf_len)
{
for (unsigned int i = 0; i < buf_len; i++) {
- if (!isprint(buf[i]))
+ if (!isprint((unsigned char)buf[i]))
return buf + i;
}
return NULL;
diff --git a/src/jtag/adapter.c b/src/jtag/adapter.c
index 3f94ffec7..7bf049cd8 100644
--- a/src/jtag/adapter.c
+++ b/src/jtag/adapter.c
@@ -970,7 +970,7 @@ COMMAND_HANDLER(adapter_gpio_config_handler)
while (i < CMD_ARGC) {
LOG_DEBUG("Processing %s", CMD_ARGV[i]);
- if (isdigit(*CMD_ARGV[i])) {
+ if (isdigit((unsigned char)*CMD_ARGV[i])) {
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[i], gpio_config->gpio_num);
++i;
continue;
diff --git a/src/pld/efinix.c b/src/pld/efinix.c
index b6e5f9e47..eff62c62b 100644
--- a/src/pld/efinix.c
+++ b/src/pld/efinix.c
@@ -82,7 +82,8 @@ static int efinix_read_bit_file(struct raw_bit_file *bit_file, const char *filen
return ERROR_PLD_FILE_LOAD_FAILED;
}
- if (!isxdigit(buffer[0]) || !isxdigit(buffer[1])) {
+ if (!isxdigit((unsigned char)buffer[0]) ||
+ !isxdigit((unsigned char)buffer[1])) {
fclose(input_file);
free(bit_file->data);
bit_file->data = NULL;
diff --git a/src/pld/gatemate.c b/src/pld/gatemate.c
index 479f6d183..11b6ae76e 100644
--- a/src/pld/gatemate.c
+++ b/src/pld/gatemate.c
@@ -57,7 +57,8 @@ static int gatemate_read_cfg_line(struct gatemate_bit_file *bit_file, const char
} else if (line_buffer[idx] == 0) {
break;
} else if (idx + 1 < nread) {
- if (isxdigit(line_buffer[idx]) && isxdigit(line_buffer[idx + 1])) {
+ if (isxdigit((unsigned char)line_buffer[idx]) &&
+ isxdigit((unsigned char)line_buffer[idx + 1])) {
uint8_t byte;
unhexify(&byte, line_buffer + idx, 2);
int retval = gatemate_add_byte_to_bitfile(bit_file, byte);
diff --git a/src/server/telnet_server.c b/src/server/telnet_server.c
index ea7f38fb8..83d50c2d0 100644
--- a/src/server/telnet_server.c
+++ b/src/server/telnet_server.c
@@ -602,7 +602,8 @@ static void telnet_auto_complete(struct connection *connection)
/* user command position in the line, ignore leading spaces */
size_t usr_cmd_pos = seq_start;
- while ((usr_cmd_pos < t_con->line_cursor) && isspace(t_con->line[usr_cmd_pos]))
+ while ((usr_cmd_pos < t_con->line_cursor) &&
+ isspace((unsigned char)t_con->line[usr_cmd_pos]))
usr_cmd_pos++;
/* check user command length */
@@ -616,9 +617,10 @@ static void telnet_auto_complete(struct connection *connection)
* because info commands does not tolerate multiple spaces */
size_t optimized_spaces = 0;
char query[usr_cmd_len + 1];
+
for (size_t i = 0; i < usr_cmd_len; i++) {
- if ((i < usr_cmd_len - 1) && isspace(t_con->line[usr_cmd_pos + i])
- && isspace(t_con->line[usr_cmd_pos + i + 1])) {
+ if ((i < usr_cmd_len - 1) && isspace((unsigned char)t_con->line[usr_cmd_pos + i])
+ && isspace((unsigned char)t_con->line[usr_cmd_pos + i + 1])) {
optimized_spaces++;
continue;
}
diff --git a/src/target/riscv/riscv.c b/src/target/riscv/riscv.c
index 8054a1c9b..3dffce50e 100644
--- a/src/target/riscv/riscv.c
+++ b/src/target/riscv/riscv.c
@@ -4380,7 +4380,7 @@ static bool parse_csr_address(const char *reg_address_str, unsigned int *reg_add
{
*reg_addr = -1;
/* skip initial spaces */
- while (isspace(reg_address_str[0]))
+ while (isspace((unsigned char)reg_address_str[0]))
++reg_address_str;
/* try to detect if string starts with 0x or 0X */
bool is_hex_address = strncmp(reg_address_str, "0x", 2) == 0 ||
-----------------------------------------------------------------------
Summary of changes:
src/helper/log.c | 2 +-
src/jtag/adapter.c | 2 +-
src/pld/efinix.c | 3 ++-
src/pld/gatemate.c | 3 ++-
src/server/telnet_server.c | 8 +++++---
src/target/riscv/riscv.c | 2 +-
6 files changed, 12 insertions(+), 8 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-04-06 16:45:42
|
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 a22e4331e7c9a7377e63dcd3de151e82f9b5ddbf (commit)
from faab1de8b1129b35f129e81d76b43e9813d0ceef (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 a22e4331e7c9a7377e63dcd3de151e82f9b5ddbf
Author: Marc Schink <de...@za...>
Date: Wed Mar 11 12:55:25 2026 +0100
configure: Rework HAVE_CAPSTONE #define
Autotools and the current build system define HAVE_* macros only when
the corresponding feature is available, leaving them undefined otherwise.
HAVE_CAPSTONE is an exception, align it with this convention to make the
build system more consistent and slightly simpler.
Change-Id: I0b71743a687802b905e3fe1e17cad815a7febb14
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9540
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/configure.ac b/configure.ac
index 39f5e074e..0d5f0eb35 100644
--- a/configure.ac
+++ b/configure.ac
@@ -527,10 +527,6 @@ AS_IF([test "x$enable_capstone" != xno], [
])
])
-AS_IF([test "x$enable_capstone" == xno], [
- AC_DEFINE([HAVE_CAPSTONE], [0], [0 if you don't have Capstone disassembly framework.])
-])
-
for hidapi_lib in hidapi hidapi-hidraw hidapi-libusb; do
PKG_CHECK_MODULES([HIDAPI],[$hidapi_lib],[
use_hidapi=yes
diff --git a/src/target/a64_disassembler.c b/src/target/a64_disassembler.c
index ca3d3ea7a..3ae5d9c27 100644
--- a/src/target/a64_disassembler.c
+++ b/src/target/a64_disassembler.c
@@ -13,7 +13,7 @@
#include "target.h"
#include "a64_disassembler.h"
-#if HAVE_CAPSTONE
+#ifdef HAVE_CAPSTONE
#include <capstone.h>
diff --git a/src/target/arm_disassembler.c b/src/target/arm_disassembler.c
index 6dea19f93..e07843afd 100644
--- a/src/target/arm_disassembler.c
+++ b/src/target/arm_disassembler.c
@@ -15,7 +15,7 @@
#include "arm_disassembler.h"
#include <helper/log.h>
-#if HAVE_CAPSTONE
+#ifdef HAVE_CAPSTONE
#include <capstone.h>
#endif
@@ -3019,7 +3019,7 @@ int arm_access_size(struct arm_instruction *instruction)
}
}
-#if HAVE_CAPSTONE
+#ifdef HAVE_CAPSTONE
static void print_opcode(struct command_invocation *cmd, const cs_insn *insn)
{
uint32_t opcode = 0;
diff --git a/src/target/arm_disassembler.h b/src/target/arm_disassembler.h
index 8317da997..34df0f1f0 100644
--- a/src/target/arm_disassembler.h
+++ b/src/target/arm_disassembler.h
@@ -187,7 +187,7 @@ int arm_evaluate_opcode(uint32_t opcode, uint32_t address,
int thumb_evaluate_opcode(uint16_t opcode, uint32_t address,
struct arm_instruction *instruction);
int arm_access_size(struct arm_instruction *instruction);
-#if HAVE_CAPSTONE
+#ifdef HAVE_CAPSTONE
int arm_disassemble(struct command_invocation *cmd, struct target *target,
target_addr_t address, size_t count, bool thumb_mode);
#endif
diff --git a/src/target/armv4_5.c b/src/target/armv4_5.c
index 4f61c58e2..d9816d033 100644
--- a/src/target/armv4_5.c
+++ b/src/target/armv4_5.c
@@ -952,7 +952,7 @@ COMMAND_HANDLER(handle_arm_core_state_command)
COMMAND_HANDLER(handle_arm_disassemble_command)
{
-#if HAVE_CAPSTONE
+#ifdef HAVE_CAPSTONE
struct target *target = get_current_target(CMD_CTX);
if (!target) {
-----------------------------------------------------------------------
Summary of changes:
configure.ac | 4 ----
src/target/a64_disassembler.c | 2 +-
src/target/arm_disassembler.c | 4 ++--
src/target/arm_disassembler.h | 2 +-
src/target/armv4_5.c | 2 +-
5 files changed, 5 insertions(+), 9 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-04-06 16:27:24
|
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 faab1de8b1129b35f129e81d76b43e9813d0ceef (commit)
from 944fb35b70ad575b8fcd86e53039269bcdc0f366 (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 faab1de8b1129b35f129e81d76b43e9813d0ceef
Author: Samuel Obuch <sam...@es...>
Date: Tue Mar 17 21:44:59 2026 +0100
jtag: adapter: move adapter_driver extern declaration to header file
Prevents sparse warning:
"symbol 'adapter_driver' was not declared. Should it be static?"
Change-Id: I2a650ae09e250373132bdfa18f7b2942b970b98e
Signed-off-by: Samuel Obuch <sam...@es...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9534
Reviewed-by: Antonio Borneo <bor...@gm...>
Tested-by: jenkins
diff --git a/src/jtag/adapter.h b/src/jtag/adapter.h
index d76ea5e32..6e957cbdc 100644
--- a/src/jtag/adapter.h
+++ b/src/jtag/adapter.h
@@ -129,6 +129,8 @@ const char *adapter_gpio_get_name(enum adapter_gpio_config_index idx);
*/
const struct adapter_gpio_config *adapter_gpio_get_config(void);
+extern struct adapter_driver *adapter_driver;
+
#define ADAPTER_GPIO_NOT_SET UINT_MAX
#endif /* OPENOCD_JTAG_ADAPTER_H */
diff --git a/src/jtag/core.c b/src/jtag/core.c
index 3261e6079..941d9f3b4 100644
--- a/src/jtag/core.c
+++ b/src/jtag/core.c
@@ -115,8 +115,6 @@ struct jtag_event_callback {
/* callbacks to inform high-level handlers about JTAG state changes */
static struct jtag_event_callback *jtag_event_callbacks;
-extern struct adapter_driver *adapter_driver;
-
void jtag_set_flush_queue_sleep(int ms)
{
jtag_flush_queue_sleep = ms;
diff --git a/src/jtag/swim.c b/src/jtag/swim.c
index 004a9fd4f..43d655c4c 100644
--- a/src/jtag/swim.c
+++ b/src/jtag/swim.c
@@ -12,13 +12,12 @@
#include "config.h"
#endif
+#include "adapter.h"
#include "interface.h"
#include "swim.h"
#include <helper/command.h>
#include <transport/transport.h>
-extern struct adapter_driver *adapter_driver;
-
int swim_system_reset(void)
{
assert(adapter_driver->swim_ops);
diff --git a/src/target/adi_v5_swd.c b/src/target/adi_v5_swd.c
index 2d286136a..57d2d5929 100644
--- a/src/target/adi_v5_swd.c
+++ b/src/target/adi_v5_swd.c
@@ -39,6 +39,7 @@
#include <helper/time_support.h>
#include <transport/transport.h>
+#include <jtag/adapter.h>
#include <jtag/interface.h>
#include <jtag/swd.h>
@@ -722,8 +723,6 @@ static const struct command_registration swd_handlers[] = {
static int swd_select(struct command_context *ctx)
{
- /* FIXME: only place where global 'adapter_driver' is still needed */
- extern struct adapter_driver *adapter_driver;
const struct swd_driver *swd = adapter_driver->swd_ops;
int retval;
diff --git a/src/target/arm_dap.c b/src/target/arm_dap.c
index 532f192b7..07b695623 100644
--- a/src/target/arm_dap.c
+++ b/src/target/arm_dap.c
@@ -16,12 +16,11 @@
#include "helper/list.h"
#include "helper/command.h"
#include "transport/transport.h"
+#include "jtag/adapter.h"
#include "jtag/interface.h"
static OOCD_LIST_HEAD(all_dap);
-extern struct adapter_driver *adapter_driver;
-
/* DAP command support */
struct arm_dap_object {
struct list_head lh;
diff --git a/src/target/stm8.c b/src/target/stm8.c
index 3b5d83ff4..d44dd7f08 100644
--- a/src/target/stm8.c
+++ b/src/target/stm8.c
@@ -13,6 +13,7 @@
#include <helper/log.h>
#include "target.h"
#include "target_type.h"
+#include "jtag/adapter.h"
#include "jtag/interface.h"
#include "jtag/jtag.h"
#include "jtag/swim.h"
@@ -33,7 +34,6 @@ static void stm8_enable_watchpoints(struct target *target);
static int stm8_unset_watchpoint(struct target *target,
struct watchpoint *watchpoint);
static int (*adapter_speed)(int speed);
-extern struct adapter_driver *adapter_driver;
static const struct {
unsigned int id;
-----------------------------------------------------------------------
Summary of changes:
src/jtag/adapter.h | 2 ++
src/jtag/core.c | 2 --
src/jtag/swim.c | 3 +--
src/target/adi_v5_swd.c | 3 +--
src/target/arm_dap.c | 3 +--
src/target/stm8.c | 2 +-
6 files changed, 6 insertions(+), 9 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-04-06 16:26:02
|
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 944fb35b70ad575b8fcd86e53039269bcdc0f366 (commit)
from ea07cc74ce7c712fe64ea9f7251af3f02114a149 (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 944fb35b70ad575b8fcd86e53039269bcdc0f366
Author: Mark O'Donovan <sh...@po...>
Date: Sun Mar 29 21:55:54 2026 +0100
target/dsp5680xx: cleanup retval usage
Reduce unnecessary assignment to retval.
Change-Id: I98aad2d4c09c81e41a3efb639b0470cc663f5bd8
Signed-off-by: Mark O'Donovan <sh...@po...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9550
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/target/dsp5680xx.c b/src/target/dsp5680xx.c
index 09e9a1c96..30eca91a5 100644
--- a/src/target/dsp5680xx.c
+++ b/src/target/dsp5680xx.c
@@ -25,8 +25,7 @@ static struct dsp5680xx_common dsp5680xx_context;
static int dsp5680xx_execute_queue(void)
{
- int retval = jtag_execute_queue();
- return retval;
+ return jtag_execute_queue();
}
/**
@@ -46,8 +45,7 @@ static int reset_jtag(void)
if (retval != ERROR_OK)
return retval;
jtag_add_pathmove(0, states + 1);
- retval = jtag_execute_queue();
- return retval;
+ return jtag_execute_queue();
}
static int dsp5680xx_drscan(struct target *target, uint8_t *d_in,
@@ -64,8 +62,6 @@ static int dsp5680xx_drscan(struct target *target, uint8_t *d_in,
*
*-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
*/
- int retval = ERROR_OK;
-
if (!target->tap) {
err_log(DSP5680XX_ERROR_JTAG_INVALID_TAP, "Invalid tap");
return ERROR_FAIL;
@@ -80,7 +76,7 @@ static int dsp5680xx_drscan(struct target *target, uint8_t *d_in,
/* is the casting necessary? */
jtag_add_plain_dr_scan(len, d_in, d_out, TAP_IDLE);
if (dsp5680xx_context.flush) {
- retval = dsp5680xx_execute_queue();
+ int retval = dsp5680xx_execute_queue();
if (retval != ERROR_OK) {
err_log(DSP5680XX_ERROR_JTAG_DRSCAN, "drscan failed!");
return retval;
@@ -90,7 +86,7 @@ static int dsp5680xx_drscan(struct target *target, uint8_t *d_in,
LOG_DEBUG("Data read (%d bits): 0x%04X", len, *d_out);
else
LOG_DEBUG("Data read was discarded.");
- return retval;
+ return ERROR_OK;
}
/**
@@ -105,8 +101,6 @@ static int dsp5680xx_drscan(struct target *target, uint8_t *d_in,
static int dsp5680xx_irscan(struct target *target, uint32_t *d_in,
uint32_t *d_out, uint8_t ir_len)
{
- int retval = ERROR_OK;
-
uint16_t tap_ir_len = DSP5680XX_JTAG_MASTER_TAP_IRLEN;
if (!target || !target->tap) {
@@ -130,13 +124,13 @@ static int dsp5680xx_irscan(struct target *target, uint32_t *d_in,
jtag_add_plain_ir_scan(ir_len, (uint8_t *) d_in, (uint8_t *) d_out,
TAP_IDLE);
if (dsp5680xx_context.flush) {
- retval = dsp5680xx_execute_queue();
+ int retval = dsp5680xx_execute_queue();
if (retval != ERROR_OK) {
err_log(DSP5680XX_ERROR_JTAG_IRSCAN, "irscan failed!");
return retval;
}
}
- return retval;
+ return ERROR_OK;
}
static int dsp5680xx_jtag_status(struct target *target, uint8_t *status)
@@ -184,7 +178,7 @@ static int jtag_data_write(struct target *target, uint32_t instr, int num_bits,
return retval;
if (data_read)
*data_read = data_read_dummy;
- return retval;
+ return ERROR_OK;
}
#define jtag_data_write8(target, instr, data_read) jtag_data_write(target, instr, 8, data_read)
@@ -217,7 +211,7 @@ static int eonce_instruction_exec_single(struct target *target, uint8_t instr,
return retval;
if (eonce_status)
*eonce_status = (uint8_t) dr_out_tmp;
- return retval;
+ return ERROR_OK;
}
/* wrappers for multi opcode instructions */
@@ -232,8 +226,7 @@ static int dsp5680xx_exe1(struct target *target, uint16_t opcode)
int retval = eonce_instruction_exec_single(target, 0x04, 0, 1, 0, NULL);
if (retval != ERROR_OK)
return retval;
- retval = jtag_data_write16(target, opcode, NULL);
- return retval;
+ return jtag_data_write16(target, opcode, NULL);
}
/* Executes two word DSP instruction */
@@ -249,8 +242,7 @@ static int dsp5680xx_exe2(struct target *target, uint16_t opcode1,
retval = eonce_instruction_exec_single(target, 0x04, 0, 1, 0, NULL);
if (retval != ERROR_OK)
return retval;
- retval = jtag_data_write16(target, opcode2, NULL);
- return retval;
+ return jtag_data_write16(target, opcode2, NULL);
}
/* Executes three word DSP instruction */
@@ -272,8 +264,7 @@ static int dsp5680xx_exe3(struct target *target, uint16_t opcode1,
retval = eonce_instruction_exec_single(target, 0x04, 0, 1, 0, NULL);
if (retval != ERROR_OK)
return retval;
- retval = jtag_data_write16(target, opcode3, NULL);
- return retval;
+ return jtag_data_write16(target, opcode3, NULL);
}
/*
@@ -297,8 +288,7 @@ static int core_tx_upper_data(struct target *target, uint16_t data,
NULL);
if (retval != ERROR_OK)
return retval;
- retval = jtag_data_write16(target, data, eonce_status_low);
- return retval;
+ return jtag_data_write16(target, data, eonce_status_low);
}
/* writes data into lower ORx register of the target */
@@ -319,8 +309,7 @@ static int core_rx_upper_data(struct target *target, uint8_t *data_read)
NULL);
if (retval != ERROR_OK)
return retval;
- retval = jtag_data_read16(target, data_read);
- return retval;
+ return jtag_data_read16(target, data_read);
}
/**
@@ -336,8 +325,7 @@ static int core_rx_lower_data(struct target *target, uint8_t *data_read)
NULL);
if (retval != ERROR_OK)
return retval;
- retval = jtag_data_read16(target, data_read);
- return retval;
+ return jtag_data_read16(target, data_read);
}
/*
@@ -470,28 +458,22 @@ static int core_move_value_to_pc(struct target *target, uint32_t value)
return ERROR_FAIL;
}
- int retval =
- dsp5680xx_exe_generic(target, 3, 0xE71E, value & 0xffff,
+ return dsp5680xx_exe_generic(target, 3, 0xE71E, value & 0xffff,
value >> 16);
- return retval;
}
static int eonce_load_tx_rx_to_r0(struct target *target)
{
- int retval =
- core_move_long_to_r0(target,
+ return core_move_long_to_r0(target,
((MC568013_EONCE_TX_RX_ADDR) +
(MC568013_EONCE_OBASE_ADDR << 16)));
- return retval;
}
static int core_load_tx_rx_high_addr_to_r0(struct target *target)
{
- int retval =
- core_move_long_to_r0(target,
+ return core_move_long_to_r0(target,
((MC568013_EONCE_TX1_RX1_HIGH_ADDR) +
(MC568013_EONCE_OBASE_ADDR << 16)));
- return retval;
}
static int dsp5680xx_read_core_reg(struct target *target, uint8_t reg_addr,
@@ -509,13 +491,12 @@ static int dsp5680xx_read_core_reg(struct target *target, uint8_t reg_addr,
if (retval != ERROR_OK)
return retval;
LOG_DEBUG("Reg. data: 0x%02X.", *data_read);
- return retval;
+ return ERROR_OK;
}
static int eonce_read_status_reg(struct target *target, uint16_t *data)
{
- int retval = dsp5680xx_read_core_reg(target, DSP5680XX_ONCE_OSR, data);
- return retval;
+ return dsp5680xx_read_core_reg(target, DSP5680XX_ONCE_OSR, data);
}
/**
@@ -528,9 +509,7 @@ static int eonce_read_status_reg(struct target *target, uint16_t *data)
*/
static int eonce_exit_debug_mode(struct target *target, uint8_t *eonce_status)
{
- int retval =
- eonce_instruction_exec_single(target, 0x1F, 0, 0, 1, eonce_status);
- return retval;
+ return eonce_instruction_exec_single(target, 0x1F, 0, 0, 1, eonce_status);
}
static int switch_tap(struct target *target, struct jtag_tap *master_tap,
@@ -597,7 +576,7 @@ static int switch_tap(struct target *target, struct jtag_tap *master_tap,
core_tap->enabled = false;
master_tap->enabled = true;
}
- return retval;
+ return ERROR_OK;
}
/**
@@ -655,7 +634,6 @@ static int eonce_enter_debug_mode_without_reset(struct target *target,
if ((data_read_from_dr & 0x30) == 0x30) {
LOG_DEBUG("EOnCE successfully entered debug mode.");
dsp5680xx_context.debug_mode_enabled = true;
- retval = ERROR_OK;
} else {
dsp5680xx_context.debug_mode_enabled = false;
/**
@@ -665,7 +643,7 @@ static int eonce_enter_debug_mode_without_reset(struct target *target,
}
if (eonce_status)
*eonce_status = data_read_from_dr;
- return retval;
+ return ERROR_OK;
}
/**
@@ -796,7 +774,6 @@ static int eonce_enter_debug_mode(struct target *target,
if ((data_read_from_dr & 0x30) == 0x30) {
LOG_DEBUG("EOnCE successfully entered debug mode.");
dsp5680xx_context.debug_mode_enabled = true;
- retval = ERROR_OK;
} else {
const char *msg = "Failed to set EOnCE module to debug mode";
@@ -805,7 +782,7 @@ static int eonce_enter_debug_mode(struct target *target,
}
if (eonce_status)
*eonce_status = data_read_from_dr;
- return retval;
+ return ERROR_OK;
}
/**
@@ -1102,7 +1079,7 @@ static int dsp5680xx_read_16_single(struct target *t, uint32_t a,
return retval;
LOG_DEBUG("%s:Data read from 0x%06" PRIX32 ": 0x%02X%02X", __func__, address,
data_read[1], data_read[0]);
- return retval;
+ return ERROR_OK;
}
static int dsp5680xx_read_32_single(struct target *t, uint32_t a,
@@ -1147,8 +1124,7 @@ static int dsp5680xx_read_32_single(struct target *t, uint32_t a,
retval = core_rx_lower_data(target, data_read);
if (retval != ERROR_OK)
return retval;
- retval = core_rx_upper_data(target, data_read + 2);
- return retval;
+ return core_rx_upper_data(target, data_read + 2);
}
static int dsp5680xx_read(struct target *t, target_addr_t a, uint32_t size,
@@ -1211,9 +1187,7 @@ static int dsp5680xx_read(struct target *t, target_addr_t a, uint32_t size,
}
dsp5680xx_context.flush = 1;
- retval = dsp5680xx_execute_queue();
-
- return retval;
+ return dsp5680xx_execute_queue();
}
static int dsp5680xx_write_16_single(struct target *t, uint32_t a,
@@ -1231,12 +1205,8 @@ static int dsp5680xx_write_16_single(struct target *t, uint32_t a,
if (retval != ERROR_OK)
return retval;
retval = core_move_y0_at_pr0_inc(target);
- if (retval != ERROR_OK)
- return retval;
} else {
retval = core_move_value_at_r0(target, data);
- if (retval != ERROR_OK)
- return retval;
}
return retval;
}
@@ -1338,8 +1308,6 @@ static int dsp5680xx_write_16(struct target *t, uint32_t a, uint32_t c,
const uint8_t *data = d;
- int retval = ERROR_OK;
-
uint32_t iter;
int counter = FLUSH_COUNT_READ_WRITE;
@@ -1349,7 +1317,7 @@ static int dsp5680xx_write_16(struct target *t, uint32_t a, uint32_t c,
dsp5680xx_context.flush = 1;
counter = FLUSH_COUNT_READ_WRITE;
}
- retval =
+ int retval =
dsp5680xx_write_16_single(target, address + iter,
data[iter], pmem);
if (retval != ERROR_OK) {
@@ -1361,7 +1329,7 @@ static int dsp5680xx_write_16(struct target *t, uint32_t a, uint32_t c,
dsp5680xx_context.flush = 0;
}
dsp5680xx_context.flush = 1;
- return retval;
+ return ERROR_OK;
}
static int dsp5680xx_write_32(struct target *t, uint32_t a, uint32_t c,
@@ -1375,8 +1343,6 @@ static int dsp5680xx_write_32(struct target *t, uint32_t a, uint32_t c,
const uint8_t *data = d;
- int retval = ERROR_OK;
-
uint32_t iter;
int counter = FLUSH_COUNT_READ_WRITE;
@@ -1386,7 +1352,7 @@ static int dsp5680xx_write_32(struct target *t, uint32_t a, uint32_t c,
dsp5680xx_context.flush = 1;
counter = FLUSH_COUNT_READ_WRITE;
}
- retval =
+ int retval =
dsp5680xx_write_32_single(target, address + (iter << 1),
data[iter], pmem);
if (retval != ERROR_OK) {
@@ -1398,7 +1364,7 @@ static int dsp5680xx_write_32(struct target *t, uint32_t a, uint32_t c,
dsp5680xx_context.flush = 0;
}
dsp5680xx_context.flush = 1;
- return retval;
+ return ERROR_OK;
}
/**
@@ -1561,21 +1527,14 @@ static int perl_crc(const uint8_t *buff8, uint32_t word_count)
*/
static int dsp5680xx_f_sim_reset(struct target *target)
{
- int retval = ERROR_OK;
-
uint16_t sim_cmd = SIM_CMD_RESET;
- uint32_t sim_addr;
-
if (strcmp(target->tap->chip, "dsp568013") == 0) {
- sim_addr = MC568013_SIM_BASE_ADDR + S_FILE_DATA_OFFSET;
- retval =
- dsp5680xx_write(target, sim_addr, 1, 2,
+ uint32_t sim_addr = MC568013_SIM_BASE_ADDR + S_FILE_DATA_OFFSET;
+ return dsp5680xx_write(target, sim_addr, 1, 2,
(const uint8_t *)&sim_cmd);
- if (retval != ERROR_OK)
- return retval;
}
- return retval;
+ return ERROR_OK;
}
/**
@@ -1591,8 +1550,7 @@ static int dsp5680xx_soft_reset_halt(struct target *target)
int retval = dsp5680xx_halt(target);
if (retval != ERROR_OK)
return retval;
- retval = dsp5680xx_f_sim_reset(target);
- return retval;
+ return dsp5680xx_f_sim_reset(target);
}
int dsp5680xx_f_protect_check(struct target *target, uint16_t *protected)
@@ -1611,10 +1569,8 @@ int dsp5680xx_f_protect_check(struct target *target, uint16_t *protected)
err_log(DSP5680XX_ERROR_PROTECT_CHECK_INVALID_ARGS, msg);
return ERROR_FAIL;
}
- int retval =
- dsp5680xx_read_16_single(target, HFM_BASE_ADDR | HFM_PROT,
+ return dsp5680xx_read_16_single(target, HFM_BASE_ADDR | HFM_PROT,
(uint8_t *) protected, 0);
- return retval;
}
/**
@@ -1847,10 +1803,8 @@ static int dsp5680xx_f_signature(struct target *target, uint32_t address, uint32
&hfm_ustat, 1);
if (retval != ERROR_OK)
return retval;
- retval =
- dsp5680xx_read_16_single(target, HFM_BASE_ADDR | HFM_DATA,
+ return dsp5680xx_read_16_single(target, HFM_BASE_ADDR | HFM_DATA,
(uint8_t *) signature, 0);
- return retval;
}
int dsp5680xx_f_erase_check(struct target *target, uint8_t *erased,
@@ -1880,7 +1834,7 @@ int dsp5680xx_f_erase_check(struct target *target, uint8_t *erased,
return retval;
if (erased)
*erased = (uint8_t) (hfm_ustat & HFM_USTAT_MASK_BLANK);
- return retval;
+ return ERROR_OK;
}
/**
@@ -1896,8 +1850,7 @@ static int erase_sector(struct target *target, int sector, uint16_t *hfm_ustat)
{
uint32_t tmp = HFM_FLASH_BASE_ADDR + sector * HFM_SECTOR_SIZE / 2;
- int retval = dsp5680xx_f_ex(target, HFM_PAGE_ERASE, tmp, 0, hfm_ustat, 1);
- return retval;
+ return dsp5680xx_f_ex(target, HFM_PAGE_ERASE, tmp, 0, hfm_ustat, 1);
}
/**
@@ -1910,8 +1863,7 @@ static int erase_sector(struct target *target, int sector, uint16_t *hfm_ustat)
*/
static int mass_erase(struct target *target, uint16_t *hfm_ustat)
{
- int retval = dsp5680xx_f_ex(target, HFM_MASS_ERASE, 0, 0, hfm_ustat, 1);
- return retval;
+ return dsp5680xx_f_ex(target, HFM_MASS_ERASE, 0, 0, hfm_ustat, 1);
}
int dsp5680xx_f_erase(struct target *target, int first, int last)
@@ -2272,7 +2224,7 @@ int dsp5680xx_f_unlock(struct target *target)
tap_chp->enabled = false;
target->state = TARGET_RUNNING;
dsp5680xx_context.debug_mode_enabled = false;
- return retval;
+ return ERROR_OK;
}
int dsp5680xx_f_lock(struct target *target)
@@ -2311,8 +2263,7 @@ int dsp5680xx_f_lock(struct target *target)
dsp5680xx_context.debug_mode_enabled = false;
tap_cpu->enabled = false;
tap_chp->enabled = true;
- retval = switch_tap(target, tap_chp, tap_cpu);
- return retval;
+ return switch_tap(target, tap_chp, tap_cpu);
}
static int dsp5680xx_step(struct target *target, bool current, target_addr_t address,
-----------------------------------------------------------------------
Summary of changes:
src/target/dsp5680xx.c | 131 ++++++++++++++++---------------------------------
1 file changed, 41 insertions(+), 90 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-04-06 16:25:49
|
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 ea07cc74ce7c712fe64ea9f7251af3f02114a149 (commit)
via 607a16f20c38779ec62336cb8ad77640a8c2160a (commit)
from 4894527eec68f43bd030779b1620cb1c64f187a0 (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 ea07cc74ce7c712fe64ea9f7251af3f02114a149
Author: Mark O'Donovan <sh...@po...>
Date: Sun Mar 29 14:43:11 2026 +0100
target/dsp5680xx: add missing retval assignment
retval was being checked without being assigned.
Change-Id: I3a87abb00159414c869e7ad558566f5c062252b3
Signed-off-by: Mark O'Donovan <sh...@po...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9549
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/target/dsp5680xx.c b/src/target/dsp5680xx.c
index 0f0206ffc..09e9a1c96 100644
--- a/src/target/dsp5680xx.c
+++ b/src/target/dsp5680xx.c
@@ -2068,7 +2068,7 @@ int dsp5680xx_f_wr(struct target *t, const uint8_t *b, uint32_t a, uint32_t coun
retval = core_move_long_to_r3(target, address); /* Destination address to r3 */
if (retval != ERROR_OK)
return retval;
- core_load_tx_rx_high_addr_to_r0(target); /* TX/RX reg address to r0 */
+ retval = core_load_tx_rx_high_addr_to_r0(target); /* TX/RX reg address to r0 */
if (retval != ERROR_OK)
return retval;
retval = core_move_long_to_r2(target, HFM_BASE_ADDR); /* FM base address to r2 */
commit 607a16f20c38779ec62336cb8ad77640a8c2160a
Author: Mark O'Donovan <sh...@po...>
Date: Sun Mar 29 14:28:19 2026 +0100
target/dsp5680xx: declare vars at first use
Declare vars at point of first use as mentioned in C Style Guide.
Change-Id: I51c4ab29c4a958a721661e371a39bdf9f0c2a5e4
Signed-off-by: Mark O'Donovan <sh...@po...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9548
Reviewed-by: Antonio Borneo <bor...@gm...>
Tested-by: jenkins
diff --git a/src/target/dsp5680xx.c b/src/target/dsp5680xx.c
index 74de3c2d3..0f0206ffc 100644
--- a/src/target/dsp5680xx.c
+++ b/src/target/dsp5680xx.c
@@ -25,9 +25,7 @@ static struct dsp5680xx_common dsp5680xx_context;
static int dsp5680xx_execute_queue(void)
{
- int retval;
-
- retval = jtag_execute_queue();
+ int retval = jtag_execute_queue();
return retval;
}
@@ -36,14 +34,12 @@ static int dsp5680xx_execute_queue(void)
*/
static int reset_jtag(void)
{
- int retval;
-
enum tap_state states[2];
const char *cp = "RESET";
states[0] = tap_state_by_name(cp);
- retval = jtag_add_statemove(states[0]);
+ int retval = jtag_add_statemove(states[0]);
if (retval != ERROR_OK)
return retval;
retval = jtag_execute_queue();
@@ -147,12 +143,9 @@ static int dsp5680xx_jtag_status(struct target *target, uint8_t *status)
{
uint32_t read_from_ir;
- uint32_t instr;
-
- int retval;
+ uint32_t instr = JTAG_INSTR_ENABLE_ONCE;
- instr = JTAG_INSTR_ENABLE_ONCE;
- retval =
+ int retval =
dsp5680xx_irscan(target, &instr, &read_from_ir,
DSP5680XX_JTAG_CORE_TAP_IRLEN);
if (retval != ERROR_OK)
@@ -184,9 +177,7 @@ static uint32_t data_read_dummy;
static int jtag_data_write(struct target *target, uint32_t instr, int num_bits,
uint32_t *data_read)
{
- int retval;
-
- retval =
+ int retval =
dsp5680xx_drscan(target, (uint8_t *) &instr,
(uint8_t *) &data_read_dummy, num_bits);
if (retval != ERROR_OK)
@@ -217,13 +208,11 @@ static int eonce_instruction_exec_single(struct target *target, uint8_t instr,
uint8_t rw, uint8_t go, uint8_t ex,
uint8_t *eonce_status)
{
- int retval;
-
uint32_t dr_out_tmp;
uint8_t instr_with_flags = instr | (rw << 7) | (go << 6) | (ex << 5);
- retval = jtag_data_write(target, instr_with_flags, 8, &dr_out_tmp);
+ int retval = jtag_data_write(target, instr_with_flags, 8, &dr_out_tmp);
if (retval != ERROR_OK)
return retval;
if (eonce_status)
@@ -240,9 +229,7 @@ static int eonce_instruction_exec_single(struct target *target, uint8_t instr,
/* Executes one word DSP instruction */
static int dsp5680xx_exe1(struct target *target, uint16_t opcode)
{
- int retval;
-
- retval = eonce_instruction_exec_single(target, 0x04, 0, 1, 0, NULL);
+ int retval = eonce_instruction_exec_single(target, 0x04, 0, 1, 0, NULL);
if (retval != ERROR_OK)
return retval;
retval = jtag_data_write16(target, opcode, NULL);
@@ -253,9 +240,7 @@ static int dsp5680xx_exe1(struct target *target, uint16_t opcode)
static int dsp5680xx_exe2(struct target *target, uint16_t opcode1,
uint16_t opcode2)
{
- int retval;
-
- retval = eonce_instruction_exec_single(target, 0x04, 0, 0, 0, NULL);
+ int retval = eonce_instruction_exec_single(target, 0x04, 0, 0, 0, NULL);
if (retval != ERROR_OK)
return retval;
retval = jtag_data_write16(target, opcode1, NULL);
@@ -272,9 +257,7 @@ static int dsp5680xx_exe2(struct target *target, uint16_t opcode1,
static int dsp5680xx_exe3(struct target *target, uint16_t opcode1,
uint16_t opcode2, uint16_t opcode3)
{
- int retval;
-
- retval = eonce_instruction_exec_single(target, 0x04, 0, 0, 0, NULL);
+ int retval = eonce_instruction_exec_single(target, 0x04, 0, 0, 0, NULL);
if (retval != ERROR_OK)
return retval;
retval = jtag_data_write16(target, opcode1, NULL);
@@ -309,9 +292,7 @@ static int dsp5680xx_exe3(struct target *target, uint16_t opcode1,
static int core_tx_upper_data(struct target *target, uint16_t data,
uint32_t *eonce_status_low)
{
- int retval;
-
- retval =
+ int retval =
eonce_instruction_exec_single(target, DSP5680XX_ONCE_ORX1, 0, 0, 0,
NULL);
if (retval != ERROR_OK)
@@ -333,9 +314,7 @@ static int core_tx_upper_data(struct target *target, uint16_t data,
*/
static int core_rx_upper_data(struct target *target, uint8_t *data_read)
{
- int retval;
-
- retval =
+ int retval =
eonce_instruction_exec_single(target, DSP5680XX_ONCE_OTX1, 1, 0, 0,
NULL);
if (retval != ERROR_OK)
@@ -352,9 +331,7 @@ static int core_rx_upper_data(struct target *target, uint8_t *data_read)
*/
static int core_rx_lower_data(struct target *target, uint8_t *data_read)
{
- int retval;
-
- retval =
+ int retval =
eonce_instruction_exec_single(target, DSP5680XX_ONCE_OTX, 1, 0, 0,
NULL);
if (retval != ERROR_OK)
@@ -492,9 +469,8 @@ static int core_move_value_to_pc(struct target *target, uint32_t value)
err_log(DSP5680XX_ERROR_NOT_IN_DEBUG, DEBUG_MSG);
return ERROR_FAIL;
}
- int retval;
- retval =
+ int retval =
dsp5680xx_exe_generic(target, 3, 0xE71E, value & 0xffff,
value >> 16);
return retval;
@@ -502,9 +478,7 @@ static int core_move_value_to_pc(struct target *target, uint32_t value)
static int eonce_load_tx_rx_to_r0(struct target *target)
{
- int retval;
-
- retval =
+ int retval =
core_move_long_to_r0(target,
((MC568013_EONCE_TX_RX_ADDR) +
(MC568013_EONCE_OBASE_ADDR << 16)));
@@ -513,9 +487,7 @@ static int eonce_load_tx_rx_to_r0(struct target *target)
static int core_load_tx_rx_high_addr_to_r0(struct target *target)
{
- int retval = 0;
-
- retval =
+ int retval =
core_move_long_to_r0(target,
((MC568013_EONCE_TX1_RX1_HIGH_ADDR) +
(MC568013_EONCE_OBASE_ADDR << 16)));
@@ -526,11 +498,9 @@ static int dsp5680xx_read_core_reg(struct target *target, uint8_t reg_addr,
uint16_t *data_read)
{
/* TODO implement a general version of this which matches what openocd uses. */
- int retval;
-
uint32_t dummy_data_to_shift_into_dr;
- retval = eonce_instruction_exec_single(target, reg_addr, 1, 0, 0, NULL);
+ int retval = eonce_instruction_exec_single(target, reg_addr, 1, 0, 0, NULL);
if (retval != ERROR_OK)
return retval;
retval =
@@ -544,9 +514,7 @@ static int dsp5680xx_read_core_reg(struct target *target, uint8_t reg_addr,
static int eonce_read_status_reg(struct target *target, uint16_t *data)
{
- int retval;
-
- retval = dsp5680xx_read_core_reg(target, DSP5680XX_ONCE_OSR, data);
+ int retval = dsp5680xx_read_core_reg(target, DSP5680XX_ONCE_OSR, data);
return retval;
}
@@ -560,9 +528,7 @@ static int eonce_read_status_reg(struct target *target, uint16_t *data)
*/
static int eonce_exit_debug_mode(struct target *target, uint8_t *eonce_status)
{
- int retval;
-
- retval =
+ int retval =
eonce_instruction_exec_single(target, 0x1F, 0, 0, 1, eonce_status);
return retval;
}
@@ -651,14 +617,12 @@ static int switch_tap(struct target *target, struct jtag_tap *master_tap,
static int eonce_enter_debug_mode_without_reset(struct target *target,
uint16_t *eonce_status)
{
- int retval;
-
uint32_t instr = JTAG_INSTR_DEBUG_REQUEST;
uint32_t ir_out; /* not used, just to make jtag happy.*/
/* Debug request #1 */
- retval =
+ int retval =
dsp5680xx_irscan(target, &instr, &ir_out,
DSP5680XX_JTAG_CORE_TAP_IRLEN);
if (retval != ERROR_OK)
@@ -715,8 +679,6 @@ static int eonce_enter_debug_mode_without_reset(struct target *target,
static int eonce_enter_debug_mode(struct target *target,
uint16_t *eonce_status)
{
- int retval = ERROR_OK;
-
uint32_t instr = JTAG_INSTR_DEBUG_REQUEST;
uint32_t ir_out; /* not used, just to make jtag happy. */
@@ -726,21 +688,17 @@ static int eonce_enter_debug_mode(struct target *target,
uint16_t read_16;
/* First try the easy way */
- retval = eonce_enter_debug_mode_without_reset(target, eonce_status);
+ int retval = eonce_enter_debug_mode_without_reset(target, eonce_status);
if (retval == ERROR_OK)
return retval;
- struct jtag_tap *tap_chp;
-
- struct jtag_tap *tap_cpu;
-
- tap_chp = jtag_tap_by_string("dsp568013.chp");
+ struct jtag_tap *tap_chp = jtag_tap_by_string("dsp568013.chp");
if (!tap_chp) {
err_log(DSP5680XX_ERROR_JTAG_TAP_FIND_MASTER,
"Failed to get master tap.");
return ERROR_FAIL;
}
- tap_cpu = jtag_tap_by_string("dsp568013.cpu");
+ struct jtag_tap *tap_cpu = jtag_tap_by_string("dsp568013.cpu");
if (!tap_cpu) {
err_log(DSP5680XX_ERROR_JTAG_TAP_FIND_CORE,
"Failed to get master tap.");
@@ -861,9 +819,7 @@ static int eonce_pc_store(struct target *target)
{
uint8_t tmp[2];
- int retval;
-
- retval = core_move_pc_to_r4(target);
+ int retval = core_move_pc_to_r4(target);
if (retval != ERROR_OK)
return retval;
retval = core_move_r4_to_y(target);
@@ -923,8 +879,6 @@ static int dsp5680xx_deassert_reset(struct target *target)
static int dsp5680xx_halt(struct target *target)
{
- int retval;
-
uint16_t eonce_status = 0xbeef;
if ((target->state == TARGET_HALTED)
@@ -936,7 +890,7 @@ static int dsp5680xx_halt(struct target *target)
LOG_USER
("Target already halted, re attempting to enter debug mode.");
}
- retval = eonce_enter_debug_mode(target, &eonce_status);
+ int retval = eonce_enter_debug_mode(target, &eonce_status);
if (retval != ERROR_OK)
return retval;
retval = eonce_pc_store(target);
@@ -950,15 +904,13 @@ static int dsp5680xx_halt(struct target *target)
static int dsp5680xx_poll(struct target *target)
{
- int retval;
-
uint8_t jtag_status;
uint8_t eonce_status;
uint16_t read_tmp;
- retval = dsp5680xx_jtag_status(target, &jtag_status);
+ int retval = dsp5680xx_jtag_status(target, &jtag_status);
if (retval != ERROR_OK)
return retval;
if (jtag_status == JTAG_STATUS_DEBUG)
@@ -1129,9 +1081,7 @@ static int dsp5680xx_read_16_single(struct target *t, uint32_t a,
uint32_t address = a;
- int retval;
-
- retval = core_move_long_to_r0(target, address);
+ int retval = core_move_long_to_r0(target, address);
if (retval != ERROR_OK)
return retval;
if (r_pmem)
@@ -1162,11 +1112,9 @@ static int dsp5680xx_read_32_single(struct target *t, uint32_t a,
uint32_t address = a;
- int retval;
-
address = (address & 0xFFFFF);
/* Get data to an intermediate register */
- retval = core_move_long_to_r0(target, address);
+ int retval = core_move_long_to_r0(target, address);
if (retval != ERROR_OK)
return retval;
if (r_pmem) {
@@ -1221,11 +1169,9 @@ static int dsp5680xx_read(struct target *t, target_addr_t a, uint32_t size,
return ERROR_FAIL;
}
- int retval = ERROR_OK;
-
int pmem = 1;
- retval = dsp5680xx_convert_address(&address, &pmem);
+ int retval = dsp5680xx_convert_address(&address, &pmem);
if (retval != ERROR_OK)
return retval;
@@ -1277,9 +1223,7 @@ static int dsp5680xx_write_16_single(struct target *t, uint32_t a,
uint32_t address = a;
- int retval = 0;
-
- retval = core_move_long_to_r0(target, address);
+ int retval = core_move_long_to_r0(target, address);
if (retval != ERROR_OK)
return retval;
if (w_pmem) {
@@ -1304,9 +1248,7 @@ static int dsp5680xx_write_32_single(struct target *t, uint32_t a,
uint32_t address = a;
- int retval = ERROR_OK;
-
- retval = core_move_long_to_r0(target, address);
+ int retval = core_move_long_to_r0(target, address);
if (retval != ERROR_OK)
return retval;
retval = core_move_long_to_y(target, data);
@@ -1489,11 +1431,9 @@ static int dsp5680xx_write(struct target *target, target_addr_t a, uint32_t size
return ERROR_FAIL;
}
- int retval = 0;
-
int p_mem = 1;
- retval = dsp5680xx_convert_address(&address, &p_mem);
+ int retval = dsp5680xx_convert_address(&address, &p_mem);
if (retval != ERROR_OK)
return retval;
@@ -1648,9 +1588,7 @@ static int dsp5680xx_f_sim_reset(struct target *target)
static int dsp5680xx_soft_reset_halt(struct target *target)
{
/* TODO is this what this function is expected to do...? */
- int retval;
-
- retval = dsp5680xx_halt(target);
+ int retval = dsp5680xx_halt(target);
if (retval != ERROR_OK)
return retval;
retval = dsp5680xx_f_sim_reset(target);
@@ -1659,8 +1597,6 @@ static int dsp5680xx_soft_reset_halt(struct target *target)
int dsp5680xx_f_protect_check(struct target *target, uint16_t *protected)
{
- int retval;
-
if (target->state != TARGET_HALTED) {
err_log(DSP5680XX_ERROR_TARGET_RUNNING, HALT_MSG);
return ERROR_FAIL;
@@ -1675,7 +1611,7 @@ int dsp5680xx_f_protect_check(struct target *target, uint16_t *protected)
err_log(DSP5680XX_ERROR_PROTECT_CHECK_INVALID_ARGS, msg);
return ERROR_FAIL;
}
- retval =
+ int retval =
dsp5680xx_read_16_single(target, HFM_BASE_ADDR | HFM_PROT,
(uint8_t *) protected, 0);
return retval;
@@ -1698,9 +1634,8 @@ static int dsp5680xx_f_ex(struct target *target, uint16_t c, uint32_t address, u
uint16_t *hfm_ustat, int pmem)
{
uint32_t command = c;
- int retval;
- retval = core_load_tx_rx_high_addr_to_r0(target);
+ int retval = core_load_tx_rx_high_addr_to_r0(target);
if (retval != ERROR_OK)
return retval;
retval = core_move_long_to_r2(target, HFM_BASE_ADDR);
@@ -1825,9 +1760,7 @@ static int set_fm_ck_div(struct target *target)
{
uint8_t i[2];
- int retval;
-
- retval = core_move_long_to_r2(target, HFM_BASE_ADDR);
+ int retval = core_move_long_to_r2(target, HFM_BASE_ADDR);
if (retval != ERROR_OK)
return retval;
retval = core_load_tx_rx_high_addr_to_r0(target);
@@ -1961,11 +1894,9 @@ int dsp5680xx_f_erase_check(struct target *target, uint8_t *erased,
*/
static int erase_sector(struct target *target, int sector, uint16_t *hfm_ustat)
{
- int retval;
-
uint32_t tmp = HFM_FLASH_BASE_ADDR + sector * HFM_SECTOR_SIZE / 2;
- retval = dsp5680xx_f_ex(target, HFM_PAGE_ERASE, tmp, 0, hfm_ustat, 1);
+ int retval = dsp5680xx_f_ex(target, HFM_PAGE_ERASE, tmp, 0, hfm_ustat, 1);
return retval;
}
@@ -1979,9 +1910,7 @@ static int erase_sector(struct target *target, int sector, uint16_t *hfm_ustat)
*/
static int mass_erase(struct target *target, uint16_t *hfm_ustat)
{
- int retval;
-
- retval = dsp5680xx_f_ex(target, HFM_MASS_ERASE, 0, 0, hfm_ustat, 1);
+ int retval = dsp5680xx_f_ex(target, HFM_MASS_ERASE, 0, 0, hfm_ustat, 1);
return retval;
}
@@ -2241,32 +2170,24 @@ int dsp5680xx_f_wr(struct target *t, const uint8_t *b, uint32_t a, uint32_t coun
int dsp5680xx_f_unlock(struct target *target)
{
- int retval = ERROR_OK;
-
uint16_t eonce_status;
- uint32_t instr;
-
uint32_t ir_out;
- struct jtag_tap *tap_chp;
-
- struct jtag_tap *tap_cpu;
-
- tap_chp = jtag_tap_by_string("dsp568013.chp");
+ struct jtag_tap *tap_chp = jtag_tap_by_string("dsp568013.chp");
if (!tap_chp) {
err_log(DSP5680XX_ERROR_JTAG_TAP_ENABLE_MASTER,
"Failed to get master tap.");
return ERROR_FAIL;
}
- tap_cpu = jtag_tap_by_string("dsp568013.cpu");
+ struct jtag_tap *tap_cpu = jtag_tap_by_string("dsp568013.cpu");
if (!tap_cpu) {
err_log(DSP5680XX_ERROR_JTAG_TAP_ENABLE_CORE,
"Failed to get master tap.");
return ERROR_FAIL;
}
- retval = eonce_enter_debug_mode_without_reset(target, &eonce_status);
+ int retval = eonce_enter_debug_mode_without_reset(target, &eonce_status);
if (retval == ERROR_OK)
LOG_WARNING("Memory was not locked.");
@@ -2287,7 +2208,7 @@ int dsp5680xx_f_unlock(struct target *target)
if (retval != ERROR_OK)
return retval;
- instr = JTAG_INSTR_DEBUG_REQUEST;
+ uint32_t instr = JTAG_INSTR_DEBUG_REQUEST;
retval =
dsp5680xx_irscan(target, &instr, &ir_out,
DSP5680XX_JTAG_CORE_TAP_IRLEN);
@@ -2356,13 +2277,8 @@ int dsp5680xx_f_unlock(struct target *target)
int dsp5680xx_f_lock(struct target *target)
{
- int retval;
-
- struct jtag_tap *tap_chp;
-
- struct jtag_tap *tap_cpu;
uint16_t lock_word = HFM_LOCK_FLASH;
- retval = dsp5680xx_f_wr(target, (uint8_t *)&lock_word, HFM_LOCK_ADDR_L, 2, 1);
+ int retval = dsp5680xx_f_wr(target, (uint8_t *)&lock_word, HFM_LOCK_ADDR_L, 2, 1);
if (retval != ERROR_OK)
return retval;
@@ -2379,13 +2295,13 @@ int dsp5680xx_f_lock(struct target *target)
jtag_add_reset(0, 0);
jtag_add_sleep(TIME_DIV_FREESCALE * 300 * 1000);
- tap_chp = jtag_tap_by_string("dsp568013.chp");
+ struct jtag_tap *tap_chp = jtag_tap_by_string("dsp568013.chp");
if (!tap_chp) {
err_log(DSP5680XX_ERROR_JTAG_TAP_ENABLE_MASTER,
"Failed to get master tap.");
return ERROR_FAIL;
}
- tap_cpu = jtag_tap_by_string("dsp568013.cpu");
+ struct jtag_tap *tap_cpu = jtag_tap_by_string("dsp568013.cpu");
if (!tap_cpu) {
err_log(DSP5680XX_ERROR_JTAG_TAP_ENABLE_CORE,
"Failed to get master tap.");
-----------------------------------------------------------------------
Summary of changes:
src/target/dsp5680xx.c | 174 +++++++++++++------------------------------------
1 file changed, 45 insertions(+), 129 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-04-06 16:25: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 4894527eec68f43bd030779b1620cb1c64f187a0 (commit)
from 4c072f0d0a3a308e0f8f1e596814838cd32cbdc3 (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 4894527eec68f43bd030779b1620cb1c64f187a0
Author: Mark O'Donovan <sh...@po...>
Date: Sun Mar 29 12:47:17 2026 +0100
target/dsp5680xx: remove err_check()
Improve readability by dropping macros containing `return`
Change-Id: Iccba4196d1d40405b596957aa53f18c106db1dc7
Signed-off-by: Mark O'Donovan <sh...@po...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9547
Reviewed-by: Antonio Borneo <bor...@gm...>
Tested-by: jenkins
diff --git a/src/target/dsp5680xx.c b/src/target/dsp5680xx.c
index 0088b3c3b..74de3c2d3 100644
--- a/src/target/dsp5680xx.c
+++ b/src/target/dsp5680xx.c
@@ -20,7 +20,6 @@ static struct dsp5680xx_common dsp5680xx_context;
#define _E "DSP5680XX_ERROR:%d\nAt:%s:%d:%s"
#define err_log(c, m) LOG_ERROR(_E, c, __func__, __LINE__, m)
-#define err_check(r, c, m) if (r != ERROR_OK) {LOG_ERROR(_E, c, __func__, __LINE__, m); return r; }
#define DEBUG_MSG "Debug mode be enabled to read mem."
#define HALT_MSG "Target must be halted."
@@ -72,14 +71,13 @@ static int dsp5680xx_drscan(struct target *target, uint8_t *d_in,
int retval = ERROR_OK;
if (!target->tap) {
- retval = ERROR_FAIL;
- err_check(retval, DSP5680XX_ERROR_JTAG_INVALID_TAP,
- "Invalid tap");
+ err_log(DSP5680XX_ERROR_JTAG_INVALID_TAP, "Invalid tap");
+ return ERROR_FAIL;
}
if (len > 32) {
- retval = ERROR_FAIL;
- err_check(retval, DSP5680XX_ERROR_JTAG_DR_LEN_OVERFLOW,
+ err_log(DSP5680XX_ERROR_JTAG_DR_LEN_OVERFLOW,
"dr_len overflow, maximum is 32");
+ return ERROR_FAIL;
}
/* TODO what values of len are valid for jtag_add_plain_dr_scan? */
/* can i send as many bits as i want? */
@@ -87,8 +85,10 @@ static int dsp5680xx_drscan(struct target *target, uint8_t *d_in,
jtag_add_plain_dr_scan(len, d_in, d_out, TAP_IDLE);
if (dsp5680xx_context.flush) {
retval = dsp5680xx_execute_queue();
- err_check(retval, DSP5680XX_ERROR_JTAG_DRSCAN,
- "drscan failed!");
+ if (retval != ERROR_OK) {
+ err_log(DSP5680XX_ERROR_JTAG_DRSCAN, "drscan failed!");
+ return retval;
+ }
}
if (d_out)
LOG_DEBUG("Data read (%d bits): 0x%04X", len, *d_out);
@@ -119,18 +119,15 @@ static int dsp5680xx_irscan(struct target *target, uint32_t *d_in,
}
if (ir_len != target->tap->ir_length) {
if (target->tap->enabled) {
- retval = ERROR_FAIL;
- err_check(retval, DSP5680XX_ERROR_INVALID_IR_LEN,
- "Invalid irlen");
+ err_log(DSP5680XX_ERROR_INVALID_IR_LEN, "Invalid irlen");
+ return ERROR_FAIL;
} else {
struct jtag_tap *t =
jtag_tap_by_string("dsp568013.chp");
if ((!t)
|| ((t->enabled) && (ir_len != tap_ir_len))) {
- retval = ERROR_FAIL;
- err_check(retval,
- DSP5680XX_ERROR_INVALID_IR_LEN,
- "Invalid irlen");
+ err_log(DSP5680XX_ERROR_INVALID_IR_LEN, "Invalid irlen");
+ return ERROR_FAIL;
}
}
}
@@ -138,8 +135,10 @@ static int dsp5680xx_irscan(struct target *target, uint32_t *d_in,
TAP_IDLE);
if (dsp5680xx_context.flush) {
retval = dsp5680xx_execute_queue();
- err_check(retval, DSP5680XX_ERROR_JTAG_IRSCAN,
- "irscan failed!");
+ if (retval != ERROR_OK) {
+ err_log(DSP5680XX_ERROR_JTAG_IRSCAN, "irscan failed!");
+ return retval;
+ }
}
return retval;
}
@@ -485,10 +484,14 @@ static int core_rx_lower_data(struct target *target, uint8_t *data_read)
static int core_move_value_to_pc(struct target *target, uint32_t value)
{
- if (target->state != TARGET_HALTED)
- err_check(ERROR_FAIL, DSP5680XX_ERROR_TARGET_RUNNING, HALT_MSG)
- if (!dsp5680xx_context.debug_mode_enabled)
- err_check(ERROR_FAIL, DSP5680XX_ERROR_NOT_IN_DEBUG, DEBUG_MSG)
+ if (target->state != TARGET_HALTED) {
+ err_log(DSP5680XX_ERROR_TARGET_RUNNING, HALT_MSG);
+ return ERROR_FAIL;
+ }
+ if (!dsp5680xx_context.debug_mode_enabled) {
+ err_log(DSP5680XX_ERROR_NOT_IN_DEBUG, DEBUG_MSG);
+ return ERROR_FAIL;
+ }
int retval;
retval =
@@ -576,11 +579,10 @@ static int switch_tap(struct target *target, struct jtag_tap *master_tap,
if (!master_tap) {
master_tap = jtag_tap_by_string("dsp568013.chp");
if (!master_tap) {
- retval = ERROR_FAIL;
const char *msg = "Failed to get master tap.";
- err_check(retval, DSP5680XX_ERROR_JTAG_TAP_FIND_MASTER,
- msg);
+ err_log(DSP5680XX_ERROR_JTAG_TAP_FIND_MASTER, msg);
+ return ERROR_FAIL;
}
}
if (!core_tap) {
@@ -734,9 +736,9 @@ static int eonce_enter_debug_mode(struct target *target,
tap_chp = jtag_tap_by_string("dsp568013.chp");
if (!tap_chp) {
- retval = ERROR_FAIL;
- err_check(retval, DSP5680XX_ERROR_JTAG_TAP_FIND_MASTER,
+ err_log(DSP5680XX_ERROR_JTAG_TAP_FIND_MASTER,
"Failed to get master tap.");
+ return ERROR_FAIL;
}
tap_cpu = jtag_tap_by_string("dsp568013.cpu");
if (!tap_cpu) {
@@ -814,9 +816,8 @@ static int eonce_enter_debug_mode(struct target *target,
if ((ir_out & JTAG_STATUS_MASK) == JTAG_STATUS_DEBUG)
target->state = TARGET_HALTED;
else {
- retval = ERROR_FAIL;
- err_check(retval, DSP5680XX_ERROR_HALT,
- "Failed to halt target.");
+ err_log(DSP5680XX_ERROR_HALT, "Failed to halt target.");
+ return ERROR_FAIL;
}
for (int i = 0; i < 3; i++) {
@@ -841,8 +842,8 @@ static int eonce_enter_debug_mode(struct target *target,
} else {
const char *msg = "Failed to set EOnCE module to debug mode";
- retval = ERROR_TARGET_FAILURE;
- err_check(retval, DSP5680XX_ERROR_ENTER_DEBUG_MODE, msg);
+ err_log(DSP5680XX_ERROR_ENTER_DEBUG_MODE, msg);
+ return ERROR_TARGET_FAILURE;
}
if (eonce_status)
*eonce_status = data_read_from_dr;
@@ -1056,9 +1057,9 @@ static int dsp5680xx_resume(struct target *target, bool current,
break;
}
if (retry == 0) {
- retval = ERROR_TARGET_FAILURE;
- err_check(retval, DSP5680XX_ERROR_EXIT_DEBUG_MODE,
+ err_log(DSP5680XX_ERROR_EXIT_DEBUG_MODE,
"Failed to exit debug mode...");
+ return ERROR_TARGET_FAILURE;
} else {
target->state = TARGET_RUNNING;
dsp5680xx_context.debug_mode_enabled = false;
@@ -1074,8 +1075,11 @@ static int dsp5680xx_resume(struct target *target, bool current,
jtag_add_sleep(TIME_DIV_FREESCALE * 200 * 1000);
retval = reset_jtag();
- err_check(retval, DSP5680XX_ERROR_JTAG_RESET,
- "Failed to reset JTAG state machine");
+ if (retval != ERROR_OK) {
+ err_log(DSP5680XX_ERROR_JTAG_RESET,
+ "Failed to reset JTAG state machine");
+ return retval;
+ }
jtag_add_sleep(TIME_DIV_FREESCALE * 100 * 1000);
jtag_add_reset(0, 0);
jtag_add_sleep(TIME_DIV_FREESCALE * 300 * 1000);
@@ -1086,9 +1090,8 @@ static int dsp5680xx_resume(struct target *target, bool current,
target->state = TARGET_RUNNING;
dsp5680xx_context.debug_mode_enabled = false;
} else {
- retval = ERROR_TARGET_FAILURE;
- err_check(retval, DSP5680XX_ERROR_RESUME,
- "Failed to resume target");
+ err_log(DSP5680XX_ERROR_RESUME, "Failed to resume target");
+ return ERROR_TARGET_FAILURE;
}
}
return ERROR_OK;
@@ -1209,10 +1212,14 @@ static int dsp5680xx_read(struct target *t, target_addr_t a, uint32_t size,
uint8_t *buffer = buf;
- if (target->state != TARGET_HALTED)
- err_check(ERROR_FAIL, DSP5680XX_ERROR_TARGET_RUNNING, HALT_MSG)
- if (!dsp5680xx_context.debug_mode_enabled)
- err_check(ERROR_FAIL, DSP5680XX_ERROR_NOT_IN_DEBUG, DEBUG_MSG)
+ if (target->state != TARGET_HALTED) {
+ err_log(DSP5680XX_ERROR_TARGET_RUNNING, HALT_MSG);
+ return ERROR_FAIL;
+ }
+ if (!dsp5680xx_context.debug_mode_enabled) {
+ err_log(DSP5680XX_ERROR_NOT_IN_DEBUG, DEBUG_MSG);
+ return ERROR_FAIL;
+ }
int retval = ERROR_OK;
@@ -1473,10 +1480,14 @@ static int dsp5680xx_write(struct target *target, target_addr_t a, uint32_t size
uint8_t const *buffer = b;
- if (target->state != TARGET_HALTED)
- err_check(ERROR_FAIL, DSP5680XX_ERROR_TARGET_RUNNING, HALT_MSG)
- if (!dsp5680xx_context.debug_mode_enabled)
- err_check(ERROR_FAIL, DSP5680XX_ERROR_NOT_IN_DEBUG, DEBUG_MSG)
+ if (target->state != TARGET_HALTED) {
+ err_log(DSP5680XX_ERROR_TARGET_RUNNING, HALT_MSG);
+ return ERROR_FAIL;
+ }
+ if (!dsp5680xx_context.debug_mode_enabled) {
+ err_log(DSP5680XX_ERROR_NOT_IN_DEBUG, DEBUG_MSG);
+ return ERROR_FAIL;
+ }
int retval = 0;
@@ -1500,10 +1511,8 @@ static int dsp5680xx_write(struct target *target, target_addr_t a, uint32_t size
dsp5680xx_write_32(target, address, count, buffer, p_mem);
break;
default:
- retval = ERROR_TARGET_DATA_ABORT;
- err_check(retval, DSP5680XX_ERROR_INVALID_DATA_SIZE_UNIT,
- "Invalid data size.");
- break;
+ err_log(DSP5680XX_ERROR_INVALID_DATA_SIZE_UNIT, "Invalid data size.");
+ return ERROR_TARGET_DATA_ABORT;
}
return retval;
}
@@ -1511,10 +1520,14 @@ static int dsp5680xx_write(struct target *target, target_addr_t a, uint32_t size
static int dsp5680xx_write_buffer(struct target *t, target_addr_t a, uint32_t size,
const uint8_t *b)
{
- if (t->state != TARGET_HALTED)
- err_check(ERROR_FAIL, DSP5680XX_ERROR_TARGET_RUNNING, HALT_MSG)
- if (!dsp5680xx_context.debug_mode_enabled)
- err_check(ERROR_FAIL, DSP5680XX_ERROR_NOT_IN_DEBUG, DEBUG_MSG)
+ if (t->state != TARGET_HALTED) {
+ err_log(DSP5680XX_ERROR_TARGET_RUNNING, HALT_MSG);
+ return ERROR_FAIL;
+ }
+ if (!dsp5680xx_context.debug_mode_enabled) {
+ err_log(DSP5680XX_ERROR_NOT_IN_DEBUG, DEBUG_MSG);
+ return ERROR_FAIL;
+ }
return dsp5680xx_write(t, a, 1, size, b);
}
@@ -1531,10 +1544,14 @@ static int dsp5680xx_write_buffer(struct target *t, target_addr_t a, uint32_t si
static int dsp5680xx_read_buffer(struct target *target, target_addr_t address, uint32_t size,
uint8_t *buffer)
{
- if (target->state != TARGET_HALTED)
- err_check(ERROR_FAIL, DSP5680XX_ERROR_TARGET_RUNNING, HALT_MSG)
- if (!dsp5680xx_context.debug_mode_enabled)
- err_check(ERROR_FAIL, DSP5680XX_ERROR_NOT_IN_DEBUG, DEBUG_MSG)
+ if (target->state != TARGET_HALTED) {
+ err_log(DSP5680XX_ERROR_TARGET_RUNNING, HALT_MSG);
+ return ERROR_FAIL;
+ }
+ if (!dsp5680xx_context.debug_mode_enabled) {
+ err_log(DSP5680XX_ERROR_NOT_IN_DEBUG, DEBUG_MSG);
+ return ERROR_FAIL;
+ }
/* The "/2" solves the byte/word addressing issue.*/
return dsp5680xx_read(target, address, 2, size / 2, buffer);
@@ -1644,15 +1661,19 @@ int dsp5680xx_f_protect_check(struct target *target, uint16_t *protected)
{
int retval;
- if (target->state != TARGET_HALTED)
- err_check(ERROR_FAIL, DSP5680XX_ERROR_TARGET_RUNNING, HALT_MSG)
- if (!dsp5680xx_context.debug_mode_enabled)
- err_check(ERROR_FAIL, DSP5680XX_ERROR_NOT_IN_DEBUG, DEBUG_MSG)
+ if (target->state != TARGET_HALTED) {
+ err_log(DSP5680XX_ERROR_TARGET_RUNNING, HALT_MSG);
+ return ERROR_FAIL;
+ }
+ if (!dsp5680xx_context.debug_mode_enabled) {
+ err_log(DSP5680XX_ERROR_NOT_IN_DEBUG, DEBUG_MSG);
+ return ERROR_FAIL;
+ }
if (!protected) {
const char *msg = "NULL pointer not valid.";
- err_check(ERROR_FAIL,
- DSP5680XX_ERROR_PROTECT_CHECK_INVALID_ARGS, msg);
+ err_log(DSP5680XX_ERROR_PROTECT_CHECK_INVALID_ARGS, msg);
+ return ERROR_FAIL;
}
retval =
dsp5680xx_read_16_single(target, HFM_BASE_ADDR | HFM_PROT,
@@ -1700,10 +1721,10 @@ static int dsp5680xx_f_ex(struct target *target, uint16_t c, uint32_t address, u
if (retval != ERROR_OK)
return retval;
if ((watchdog--) == 1) {
- retval = ERROR_TARGET_FAILURE;
const char *msg =
"Timed out waiting for FM to finish old command.";
- err_check(retval, DSP5680XX_ERROR_FM_BUSY, msg);
+ err_log(DSP5680XX_ERROR_FM_BUSY, msg);
+ return ERROR_TARGET_FAILURE;
}
} while (!(i[0] & 0x40)); /* wait until current command is complete */
@@ -1773,17 +1794,17 @@ static int dsp5680xx_f_ex(struct target *target, uint16_t c, uint32_t address, u
if (retval != ERROR_OK)
return retval;
if ((watchdog--) == 1) {
- retval = ERROR_TARGET_FAILURE;
- err_check(retval, DSP5680XX_ERROR_FM_CMD_TIMED_OUT,
+ err_log(DSP5680XX_ERROR_FM_CMD_TIMED_OUT,
"FM execution did not finish.");
+ return ERROR_TARGET_FAILURE;
}
} while (!(i[0] & 0x40)); /* wait until the command is complete */
*hfm_ustat = ((i[0] << 8) | (i[1]));
if (i[0] & HFM_USTAT_MASK_PVIOL_ACCER) {
- retval = ERROR_TARGET_FAILURE;
const char *msg =
"pviol and/or accer bits set. HFM command execution error";
- err_check(retval, DSP5680XX_ERROR_FM_EXEC, msg);
+ err_log(DSP5680XX_ERROR_FM_EXEC, msg);
+ return ERROR_TARGET_FAILURE;
}
return ERROR_OK;
}
@@ -1849,9 +1870,8 @@ static int set_fm_ck_div(struct target *target)
if (retval != ERROR_OK)
return retval;
if (i[0] != (0x80 | (HFM_CLK_DEFAULT & 0x7f))) {
- retval = ERROR_TARGET_FAILURE;
- err_check(retval, DSP5680XX_ERROR_FM_SET_CLK,
- "Unable to set HFM CLK divisor.");
+ err_log(DSP5680XX_ERROR_FM_SET_CLK, "Unable to set HFM CLK divisor.");
+ return ERROR_TARGET_FAILURE;
}
if (hfm_at_wrong_value)
LOG_DEBUG("HFM CLK divisor set to 0x%02x.", i[0] & 0x7f);
@@ -1884,8 +1904,10 @@ static int dsp5680xx_f_signature(struct target *target, uint32_t address, uint32
/*
* Generate error here, since it is not done in eonce_enter_debug_mode_without_reset
*/
- err_check(retval, DSP5680XX_ERROR_HALT,
- "Failed to halt target.");
+ if (retval != ERROR_OK) {
+ err_log(DSP5680XX_ERROR_HALT, "Failed to halt target.");
+ return retval;
+ }
}
retval =
dsp5680xx_f_ex(target, HFM_CALCULATE_DATA_SIGNATURE, address, words,
@@ -2152,11 +2174,10 @@ int dsp5680xx_f_wr(struct target *t, const uint8_t *b, uint32_t a, uint32_t coun
return retval;
if (count % 2) {
/* TODO implement handling of odd number of words. */
- retval = ERROR_FAIL;
const char *msg = "Cannot handle odd number of words.";
- err_check(retval, DSP5680XX_ERROR_FLASHING_INVALID_WORD_COUNT,
- msg);
+ err_log(DSP5680XX_ERROR_FLASHING_INVALID_WORD_COUNT, msg);
+ return ERROR_FAIL;
}
dsp5680xx_context.flush = 1;
@@ -2209,10 +2230,10 @@ int dsp5680xx_f_wr(struct target *t, const uint8_t *b, uint32_t a, uint32_t coun
return retval;
pc_crc = perl_crc(buffer, i);
if (pc_crc != signature) {
- retval = ERROR_FAIL;
const char *msg =
"Flashed data failed CRC check, flash again!";
- err_check(retval, DSP5680XX_ERROR_FLASHING_CRC, msg);
+ err_log(DSP5680XX_ERROR_FLASHING_CRC, msg);
+ return ERROR_FAIL;
}
}
return retval;
@@ -2234,15 +2255,15 @@ int dsp5680xx_f_unlock(struct target *target)
tap_chp = jtag_tap_by_string("dsp568013.chp");
if (!tap_chp) {
- retval = ERROR_FAIL;
- err_check(retval, DSP5680XX_ERROR_JTAG_TAP_ENABLE_MASTER,
+ err_log(DSP5680XX_ERROR_JTAG_TAP_ENABLE_MASTER,
"Failed to get master tap.");
+ return ERROR_FAIL;
}
tap_cpu = jtag_tap_by_string("dsp568013.cpu");
if (!tap_cpu) {
- retval = ERROR_FAIL;
- err_check(retval, DSP5680XX_ERROR_JTAG_TAP_ENABLE_CORE,
+ err_log(DSP5680XX_ERROR_JTAG_TAP_ENABLE_CORE,
"Failed to get master tap.");
+ return ERROR_FAIL;
}
retval = eonce_enter_debug_mode_without_reset(target, &eonce_status);
@@ -2253,8 +2274,11 @@ int dsp5680xx_f_unlock(struct target *target)
jtag_add_sleep(TIME_DIV_FREESCALE * 200 * 1000);
retval = reset_jtag();
- err_check(retval, DSP5680XX_ERROR_JTAG_RESET,
- "Failed to reset JTAG state machine");
+ if (retval != ERROR_OK) {
+ err_log(DSP5680XX_ERROR_JTAG_RESET,
+ "Failed to reset JTAG state machine");
+ return retval;
+ }
jtag_add_sleep(150);
/* Enable core tap */
@@ -2297,8 +2321,11 @@ int dsp5680xx_f_unlock(struct target *target)
jtag_add_sleep(TIME_DIV_FREESCALE * 200 * 1000);
retval = reset_jtag();
- err_check(retval, DSP5680XX_ERROR_JTAG_RESET,
- "Failed to reset JTAG state machine");
+ if (retval != ERROR_OK) {
+ err_log(DSP5680XX_ERROR_JTAG_RESET,
+ "Failed to reset JTAG state machine");
+ return retval;
+ }
jtag_add_sleep(150);
instr = 0x0606ffff;
@@ -2343,17 +2370,20 @@ int dsp5680xx_f_lock(struct target *target)
jtag_add_sleep(TIME_DIV_FREESCALE * 200 * 1000);
retval = reset_jtag();
- err_check(retval, DSP5680XX_ERROR_JTAG_RESET,
- "Failed to reset JTAG state machine");
+ if (retval != ERROR_OK) {
+ err_log(DSP5680XX_ERROR_JTAG_RESET,
+ "Failed to reset JTAG state machine");
+ return retval;
+ }
jtag_add_sleep(TIME_DIV_FREESCALE * 100 * 1000);
jtag_add_reset(0, 0);
jtag_add_sleep(TIME_DIV_FREESCALE * 300 * 1000);
tap_chp = jtag_tap_by_string("dsp568013.chp");
if (!tap_chp) {
- retval = ERROR_FAIL;
- err_check(retval, DSP5680XX_ERROR_JTAG_TAP_ENABLE_MASTER,
+ err_log(DSP5680XX_ERROR_JTAG_TAP_ENABLE_MASTER,
"Failed to get master tap.");
+ return ERROR_FAIL;
}
tap_cpu = jtag_tap_by_string("dsp568013.cpu");
if (!tap_cpu) {
-----------------------------------------------------------------------
Summary of changes:
src/target/dsp5680xx.c | 214 ++++++++++++++++++++++++++++---------------------
1 file changed, 122 insertions(+), 92 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-04-06 16:24: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 4c072f0d0a3a308e0f8f1e596814838cd32cbdc3 (commit)
via 0f6616ac00f3ab6ea8c4241cee5660563336f353 (commit)
from 48f57a72cec23c03321452ed696eff5763bbe251 (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 4c072f0d0a3a308e0f8f1e596814838cd32cbdc3
Author: Mark O'Donovan <sh...@po...>
Date: Sun Mar 29 12:05:51 2026 +0100
target/dsp5680xx: remove check_halt_and_debug()
Improve readability by dropping macros containing `return`
Change-Id: I163b0055a31177e7e3ee6e70d4293e373ca1a476
Signed-off-by: Mark O'Donovan <sh...@po...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9546
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/target/dsp5680xx.c b/src/target/dsp5680xx.c
index 0d85a7632..0088b3c3b 100644
--- a/src/target/dsp5680xx.c
+++ b/src/target/dsp5680xx.c
@@ -22,12 +22,7 @@ static struct dsp5680xx_common dsp5680xx_context;
#define err_log(c, m) LOG_ERROR(_E, c, __func__, __LINE__, m)
#define err_check(r, c, m) if (r != ERROR_OK) {LOG_ERROR(_E, c, __func__, __LINE__, m); return r; }
#define DEBUG_MSG "Debug mode be enabled to read mem."
-#define DEBUG_FAIL { err_check(ERROR_FAIL, DSP5680XX_ERROR_NOT_IN_DEBUG, DEBUG_MSG) }
-#define CHECK_DBG if (!dsp5680xx_context.debug_mode_enabled) DEBUG_FAIL
#define HALT_MSG "Target must be halted."
-#define HALT_FAIL { err_check(ERROR_FAIL, DSP5680XX_ERROR_TARGET_RUNNING, HALT_MSG) }
-#define CHECK_HALT(target) if (target->state != TARGET_HALTED) HALT_FAIL
-#define check_halt_and_debug(target) { CHECK_HALT(target); CHECK_DBG; }
static int dsp5680xx_execute_queue(void)
{
@@ -490,7 +485,10 @@ static int core_rx_lower_data(struct target *target, uint8_t *data_read)
static int core_move_value_to_pc(struct target *target, uint32_t value)
{
- check_halt_and_debug(target);
+ if (target->state != TARGET_HALTED)
+ err_check(ERROR_FAIL, DSP5680XX_ERROR_TARGET_RUNNING, HALT_MSG)
+ if (!dsp5680xx_context.debug_mode_enabled)
+ err_check(ERROR_FAIL, DSP5680XX_ERROR_NOT_IN_DEBUG, DEBUG_MSG)
int retval;
retval =
@@ -1211,7 +1209,10 @@ static int dsp5680xx_read(struct target *t, target_addr_t a, uint32_t size,
uint8_t *buffer = buf;
- check_halt_and_debug(target);
+ if (target->state != TARGET_HALTED)
+ err_check(ERROR_FAIL, DSP5680XX_ERROR_TARGET_RUNNING, HALT_MSG)
+ if (!dsp5680xx_context.debug_mode_enabled)
+ err_check(ERROR_FAIL, DSP5680XX_ERROR_NOT_IN_DEBUG, DEBUG_MSG)
int retval = ERROR_OK;
@@ -1472,7 +1473,10 @@ static int dsp5680xx_write(struct target *target, target_addr_t a, uint32_t size
uint8_t const *buffer = b;
- check_halt_and_debug(target);
+ if (target->state != TARGET_HALTED)
+ err_check(ERROR_FAIL, DSP5680XX_ERROR_TARGET_RUNNING, HALT_MSG)
+ if (!dsp5680xx_context.debug_mode_enabled)
+ err_check(ERROR_FAIL, DSP5680XX_ERROR_NOT_IN_DEBUG, DEBUG_MSG)
int retval = 0;
@@ -1507,7 +1511,10 @@ static int dsp5680xx_write(struct target *target, target_addr_t a, uint32_t size
static int dsp5680xx_write_buffer(struct target *t, target_addr_t a, uint32_t size,
const uint8_t *b)
{
- check_halt_and_debug(t);
+ if (t->state != TARGET_HALTED)
+ err_check(ERROR_FAIL, DSP5680XX_ERROR_TARGET_RUNNING, HALT_MSG)
+ if (!dsp5680xx_context.debug_mode_enabled)
+ err_check(ERROR_FAIL, DSP5680XX_ERROR_NOT_IN_DEBUG, DEBUG_MSG)
return dsp5680xx_write(t, a, 1, size, b);
}
@@ -1524,7 +1531,11 @@ static int dsp5680xx_write_buffer(struct target *t, target_addr_t a, uint32_t si
static int dsp5680xx_read_buffer(struct target *target, target_addr_t address, uint32_t size,
uint8_t *buffer)
{
- check_halt_and_debug(target);
+ if (target->state != TARGET_HALTED)
+ err_check(ERROR_FAIL, DSP5680XX_ERROR_TARGET_RUNNING, HALT_MSG)
+ if (!dsp5680xx_context.debug_mode_enabled)
+ err_check(ERROR_FAIL, DSP5680XX_ERROR_NOT_IN_DEBUG, DEBUG_MSG)
+
/* The "/2" solves the byte/word addressing issue.*/
return dsp5680xx_read(target, address, 2, size / 2, buffer);
}
@@ -1633,7 +1644,10 @@ int dsp5680xx_f_protect_check(struct target *target, uint16_t *protected)
{
int retval;
- check_halt_and_debug(target);
+ if (target->state != TARGET_HALTED)
+ err_check(ERROR_FAIL, DSP5680XX_ERROR_TARGET_RUNNING, HALT_MSG)
+ if (!dsp5680xx_context.debug_mode_enabled)
+ err_check(ERROR_FAIL, DSP5680XX_ERROR_NOT_IN_DEBUG, DEBUG_MSG)
if (!protected) {
const char *msg = "NULL pointer not valid.";
commit 0f6616ac00f3ab6ea8c4241cee5660563336f353
Author: Mark O'Donovan <sh...@po...>
Date: Sun Mar 29 11:51:25 2026 +0100
target/dsp5680xx: remove err_check_propagate()
Improve readability by dropping macros containing `return`
Change-Id: I43b162e01d71617078d67832c8c6e95350d06d37
Signed-off-by: Mark O'Donovan <sh...@po...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9545
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/target/dsp5680xx.c b/src/target/dsp5680xx.c
index 7f2b40edf..0d85a7632 100644
--- a/src/target/dsp5680xx.c
+++ b/src/target/dsp5680xx.c
@@ -21,7 +21,6 @@ static struct dsp5680xx_common dsp5680xx_context;
#define _E "DSP5680XX_ERROR:%d\nAt:%s:%d:%s"
#define err_log(c, m) LOG_ERROR(_E, c, __func__, __LINE__, m)
#define err_check(r, c, m) if (r != ERROR_OK) {LOG_ERROR(_E, c, __func__, __LINE__, m); return r; }
-#define err_check_propagate(retval) if (retval != ERROR_OK) return retval;
#define DEBUG_MSG "Debug mode be enabled to read mem."
#define DEBUG_FAIL { err_check(ERROR_FAIL, DSP5680XX_ERROR_NOT_IN_DEBUG, DEBUG_MSG) }
#define CHECK_DBG if (!dsp5680xx_context.debug_mode_enabled) DEBUG_FAIL
@@ -51,9 +50,11 @@ static int reset_jtag(void)
states[0] = tap_state_by_name(cp);
retval = jtag_add_statemove(states[0]);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = jtag_execute_queue();
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
jtag_add_pathmove(0, states + 1);
retval = jtag_execute_queue();
return retval;
@@ -160,7 +161,8 @@ static int dsp5680xx_jtag_status(struct target *target, uint8_t *status)
retval =
dsp5680xx_irscan(target, &instr, &read_from_ir,
DSP5680XX_JTAG_CORE_TAP_IRLEN);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
if (status)
*status = (uint8_t) read_from_ir;
return ERROR_OK;
@@ -193,7 +195,8 @@ static int jtag_data_write(struct target *target, uint32_t instr, int num_bits,
retval =
dsp5680xx_drscan(target, (uint8_t *) &instr,
(uint8_t *) &data_read_dummy, num_bits);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
if (data_read)
*data_read = data_read_dummy;
return retval;
@@ -227,7 +230,8 @@ static int eonce_instruction_exec_single(struct target *target, uint8_t instr,
uint8_t instr_with_flags = instr | (rw << 7) | (go << 6) | (ex << 5);
retval = jtag_data_write(target, instr_with_flags, 8, &dr_out_tmp);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
if (eonce_status)
*eonce_status = (uint8_t) dr_out_tmp;
return retval;
@@ -245,9 +249,9 @@ static int dsp5680xx_exe1(struct target *target, uint16_t opcode)
int retval;
retval = eonce_instruction_exec_single(target, 0x04, 0, 1, 0, NULL);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = jtag_data_write16(target, opcode, NULL);
- err_check_propagate(retval);
return retval;
}
@@ -258,13 +262,15 @@ static int dsp5680xx_exe2(struct target *target, uint16_t opcode1,
int retval;
retval = eonce_instruction_exec_single(target, 0x04, 0, 0, 0, NULL);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = jtag_data_write16(target, opcode1, NULL);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = eonce_instruction_exec_single(target, 0x04, 0, 1, 0, NULL);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = jtag_data_write16(target, opcode2, NULL);
- err_check_propagate(retval);
return retval;
}
@@ -275,17 +281,21 @@ static int dsp5680xx_exe3(struct target *target, uint16_t opcode1,
int retval;
retval = eonce_instruction_exec_single(target, 0x04, 0, 0, 0, NULL);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = jtag_data_write16(target, opcode1, NULL);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = eonce_instruction_exec_single(target, 0x04, 0, 0, 0, NULL);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = jtag_data_write16(target, opcode2, NULL);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = eonce_instruction_exec_single(target, 0x04, 0, 1, 0, NULL);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = jtag_data_write16(target, opcode3, NULL);
- err_check_propagate(retval);
return retval;
}
@@ -310,9 +320,9 @@ static int core_tx_upper_data(struct target *target, uint16_t data,
retval =
eonce_instruction_exec_single(target, DSP5680XX_ONCE_ORX1, 0, 0, 0,
NULL);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = jtag_data_write16(target, data, eonce_status_low);
- err_check_propagate(retval);
return retval;
}
@@ -334,9 +344,9 @@ static int core_rx_upper_data(struct target *target, uint8_t *data_read)
retval =
eonce_instruction_exec_single(target, DSP5680XX_ONCE_OTX1, 1, 0, 0,
NULL);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = jtag_data_read16(target, data_read);
- err_check_propagate(retval);
return retval;
}
@@ -353,9 +363,9 @@ static int core_rx_lower_data(struct target *target, uint8_t *data_read)
retval =
eonce_instruction_exec_single(target, DSP5680XX_ONCE_OTX, 1, 0, 0,
NULL);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = jtag_data_read16(target, data_read);
- err_check_propagate(retval);
return retval;
}
@@ -486,7 +496,6 @@ static int core_move_value_to_pc(struct target *target, uint32_t value)
retval =
dsp5680xx_exe_generic(target, 3, 0xE71E, value & 0xffff,
value >> 16);
- err_check_propagate(retval);
return retval;
}
@@ -521,11 +530,13 @@ static int dsp5680xx_read_core_reg(struct target *target, uint8_t reg_addr,
uint32_t dummy_data_to_shift_into_dr;
retval = eonce_instruction_exec_single(target, reg_addr, 1, 0, 0, NULL);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval =
dsp5680xx_drscan(target, (uint8_t *) &dummy_data_to_shift_into_dr,
(uint8_t *) data_read, 8);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
LOG_DEBUG("Reg. data: 0x%02X.", *data_read);
return retval;
}
@@ -535,7 +546,6 @@ static int eonce_read_status_reg(struct target *target, uint16_t *data)
int retval;
retval = dsp5680xx_read_core_reg(target, DSP5680XX_ONCE_OSR, data);
- err_check_propagate(retval);
return retval;
}
@@ -553,7 +563,6 @@ static int eonce_exit_debug_mode(struct target *target, uint8_t *eonce_status)
retval =
eonce_instruction_exec_single(target, 0x1F, 0, 0, 1, eonce_status);
- err_check_propagate(retval);
return retval;
}
@@ -596,12 +605,14 @@ static int switch_tap(struct target *target, struct jtag_tap *master_tap,
retval =
dsp5680xx_irscan(target, &instr, &ir_out,
DSP5680XX_JTAG_MASTER_TAP_IRLEN);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
instr = 0x2;
retval =
dsp5680xx_drscan(target, (uint8_t *) &instr,
(uint8_t *) &ir_out, 4);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
core_tap->enabled = true;
master_tap->enabled = false;
} else {
@@ -609,12 +620,14 @@ static int switch_tap(struct target *target, struct jtag_tap *master_tap,
retval =
dsp5680xx_irscan(target, &instr, &ir_out,
DSP5680XX_JTAG_CORE_TAP_IRLEN);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
instr = 0x1;
retval =
dsp5680xx_drscan(target, (uint8_t *) &instr,
(uint8_t *) &ir_out, 4);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
core_tap->enabled = false;
master_tap->enabled = true;
}
@@ -648,7 +661,8 @@ static int eonce_enter_debug_mode_without_reset(struct target *target,
retval =
dsp5680xx_irscan(target, &instr, &ir_out,
DSP5680XX_JTAG_CORE_TAP_IRLEN);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
/* Enable EOnCE module */
instr = JTAG_INSTR_ENABLE_ONCE;
@@ -656,33 +670,34 @@ static int eonce_enter_debug_mode_without_reset(struct target *target,
retval =
dsp5680xx_irscan(target, &instr, &ir_out,
DSP5680XX_JTAG_CORE_TAP_IRLEN);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval =
dsp5680xx_irscan(target, &instr, &ir_out,
DSP5680XX_JTAG_CORE_TAP_IRLEN);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
if ((ir_out & JTAG_STATUS_MASK) == JTAG_STATUS_DEBUG)
target->state = TARGET_HALTED;
else {
- retval = ERROR_FAIL;
- err_check_propagate(retval);
+ return ERROR_FAIL;
}
/* Verify that debug mode is enabled */
uint16_t data_read_from_dr;
retval = eonce_read_status_reg(target, &data_read_from_dr);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
if ((data_read_from_dr & 0x30) == 0x30) {
LOG_DEBUG("EOnCE successfully entered debug mode.");
dsp5680xx_context.debug_mode_enabled = true;
retval = ERROR_OK;
} else {
dsp5680xx_context.debug_mode_enabled = false;
- retval = ERROR_TARGET_FAILURE;
/**
*No error msg here, since there is still hope with full halting sequence
*/
- err_check_propagate(retval);
+ return ERROR_TARGET_FAILURE;
}
if (eonce_status)
*eonce_status = data_read_from_dr;
@@ -739,7 +754,8 @@ static int eonce_enter_debug_mode(struct target *target,
retval =
dsp5680xx_irscan(target, &instr, &ir_out,
DSP5680XX_JTAG_MASTER_TAP_IRLEN);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
jtag_add_sleep(TIME_DIV_FREESCALE * 100 * 1000);
/* Enable EOnCE module */
@@ -749,35 +765,41 @@ static int eonce_enter_debug_mode(struct target *target,
retval =
dsp5680xx_drscan(target, (uint8_t *) &instr, (uint8_t *) &ir_out,
32);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
/* ir_out now hold tap idcode */
/* Enable core tap */
tap_chp->enabled = true;
retval = switch_tap(target, tap_chp, tap_cpu);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
instr = JTAG_INSTR_ENABLE_ONCE;
/* Two rounds of jtag 0x6 (enable eonce) to enable EOnCE. */
retval =
dsp5680xx_irscan(target, &instr, &ir_out,
DSP5680XX_JTAG_CORE_TAP_IRLEN);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
instr = JTAG_INSTR_DEBUG_REQUEST;
retval =
dsp5680xx_irscan(target, &instr, &ir_out,
DSP5680XX_JTAG_CORE_TAP_IRLEN);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
instr_16 = 0x1;
retval =
dsp5680xx_drscan(target, (uint8_t *) &instr_16,
(uint8_t *) &read_16, 8);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
instr_16 = 0x20;
retval =
dsp5680xx_drscan(target, (uint8_t *) &instr_16,
(uint8_t *) &read_16, 8);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
jtag_add_sleep(TIME_DIV_FREESCALE * 100 * 1000);
jtag_add_reset(0, 0);
jtag_add_sleep(TIME_DIV_FREESCALE * 300 * 1000);
@@ -788,7 +810,8 @@ static int eonce_enter_debug_mode(struct target *target,
retval =
dsp5680xx_irscan(target, &instr, &ir_out,
DSP5680XX_JTAG_CORE_TAP_IRLEN);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
}
if ((ir_out & JTAG_STATUS_MASK) == JTAG_STATUS_DEBUG)
target->state = TARGET_HALTED;
@@ -811,7 +834,8 @@ static int eonce_enter_debug_mode(struct target *target,
uint16_t data_read_from_dr;
retval = eonce_read_status_reg(target, &data_read_from_dr);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
if ((data_read_from_dr & 0x30) == 0x30) {
LOG_DEBUG("EOnCE successfully entered debug mode.");
dsp5680xx_context.debug_mode_enabled = true;
@@ -841,15 +865,20 @@ static int eonce_pc_store(struct target *target)
int retval;
retval = core_move_pc_to_r4(target);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = core_move_r4_to_y(target);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = eonce_load_tx_rx_to_r0(target);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = core_move_y0_at_r0(target);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = core_rx_lower_data(target, tmp);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
LOG_USER("PC value: 0x%X%X\n", tmp[1], tmp[0]);
dsp5680xx_context.stored_pc = (tmp[0] | (tmp[1] << 8));
return ERROR_OK;
@@ -909,12 +938,13 @@ static int dsp5680xx_halt(struct target *target)
("Target already halted, re attempting to enter debug mode.");
}
retval = eonce_enter_debug_mode(target, &eonce_status);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = eonce_pc_store(target);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
if (dsp5680xx_context.debug_mode_enabled) {
retval = eonce_pc_store(target);
- err_check_propagate(retval);
}
return retval;
}
@@ -930,11 +960,13 @@ static int dsp5680xx_poll(struct target *target)
uint16_t read_tmp;
retval = dsp5680xx_jtag_status(target, &jtag_status);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
if (jtag_status == JTAG_STATUS_DEBUG)
if (target->state != TARGET_HALTED) {
retval = eonce_enter_debug_mode(target, &read_tmp);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
eonce_status = (uint8_t) read_tmp;
if ((eonce_status & EONCE_STAT_MASK) !=
DSP5680XX_ONCE_OSCR_DEBUG_M) {
@@ -950,9 +982,11 @@ static int dsp5680xx_poll(struct target *target)
if (jtag_status == JTAG_STATUS_NORMAL) {
if (target->state == TARGET_RESET) {
retval = dsp5680xx_halt(target);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = eonce_exit_debug_mode(target, &eonce_status);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
if ((eonce_status & EONCE_STAT_MASK) !=
DSP5680XX_ONCE_OSCR_NORMAL_M) {
const char *msg =
@@ -966,7 +1000,8 @@ static int dsp5680xx_poll(struct target *target)
}
if (target->state != TARGET_RUNNING) {
retval = eonce_read_status_reg(target, &read_tmp);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
eonce_status = (uint8_t) read_tmp;
if ((eonce_status & EONCE_STAT_MASK) !=
DSP5680XX_ONCE_OSCR_NORMAL_M) {
@@ -1009,14 +1044,16 @@ static int dsp5680xx_resume(struct target *target, bool current,
if (dsp5680xx_context.debug_mode_enabled) {
if (!current) {
retval = core_move_value_to_pc(target, address);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
}
int retry = 20;
while (retry-- > 1) {
retval = eonce_exit_debug_mode(target, &eonce_status);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
if (eonce_status == DSP5680XX_ONCE_OSCR_NORMAL_M)
break;
}
@@ -1045,7 +1082,8 @@ static int dsp5680xx_resume(struct target *target, bool current,
jtag_add_reset(0, 0);
jtag_add_sleep(TIME_DIV_FREESCALE * 300 * 1000);
retval = dsp5680xx_jtag_status(target, &jtag_status);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
if ((jtag_status & JTAG_STATUS_MASK) == JTAG_STATUS_NORMAL) {
target->state = TARGET_RUNNING;
dsp5680xx_context.debug_mode_enabled = false;
@@ -1093,19 +1131,24 @@ static int dsp5680xx_read_16_single(struct target *t, uint32_t a,
int retval;
retval = core_move_long_to_r0(target, address);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
if (r_pmem)
retval = core_move_at_pr0_inc_to_y0(target);
else
retval = core_move_at_r0_to_y0(target);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = eonce_load_tx_rx_to_r0(target);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = core_move_y0_at_r0(target);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
/* at this point the data i want is at the reg eonce can read */
retval = core_rx_lower_data(target, data_read);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
LOG_DEBUG("%s:Data read from 0x%06" PRIX32 ": 0x%02X%02X", __func__, address,
data_read[1], data_read[0]);
return retval;
@@ -1123,31 +1166,39 @@ static int dsp5680xx_read_32_single(struct target *t, uint32_t a,
address = (address & 0xFFFFF);
/* Get data to an intermediate register */
retval = core_move_long_to_r0(target, address);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
if (r_pmem) {
retval = core_move_at_pr0_inc_to_y0(target);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = core_move_at_pr0_inc_to_y1(target);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
} else {
retval = core_move_at_r0_inc_to_y0(target);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = core_move_at_r0_to_y1(target);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
}
/* Get lower part of data to TX/RX */
retval = eonce_load_tx_rx_to_r0(target);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = core_move_y0_at_r0_inc(target); /* This also load TX/RX high to r0 */
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
/* Get upper part of data to TX/RX */
retval = core_move_y1_at_r0(target);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
/* at this point the data i want is at the reg eonce can read */
retval = core_rx_lower_data(target, data_read);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = core_rx_upper_data(target, data_read + 2);
- err_check_propagate(retval);
return retval;
}
@@ -1167,7 +1218,8 @@ static int dsp5680xx_read(struct target *t, target_addr_t a, uint32_t size,
int pmem = 1;
retval = dsp5680xx_convert_address(&address, &pmem);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
dsp5680xx_context.flush = 0;
int counter = FLUSH_COUNT_READ_WRITE;
@@ -1199,13 +1251,13 @@ static int dsp5680xx_read(struct target *t, target_addr_t a, uint32_t size,
LOG_USER("%s: Invalid read size.", __func__);
break;
}
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
dsp5680xx_context.flush = 0;
}
dsp5680xx_context.flush = 1;
retval = dsp5680xx_execute_queue();
- err_check_propagate(retval);
return retval;
}
@@ -1220,15 +1272,19 @@ static int dsp5680xx_write_16_single(struct target *t, uint32_t a,
int retval = 0;
retval = core_move_long_to_r0(target, address);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
if (w_pmem) {
retval = core_move_value_to_y0(target, data);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = core_move_y0_at_pr0_inc(target);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
} else {
retval = core_move_value_at_r0(target, data);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
}
return retval;
}
@@ -1243,19 +1299,21 @@ static int dsp5680xx_write_32_single(struct target *t, uint32_t a,
int retval = ERROR_OK;
retval = core_move_long_to_r0(target, address);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = core_move_long_to_y(target, data);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
if (w_pmem)
retval = core_move_y0_at_pr0_inc(target);
else
retval = core_move_y0_at_r0_inc(target);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
if (w_pmem)
retval = core_move_y1_at_pr0_inc(target);
else
retval = core_move_y1_at_r0_inc(target);
- err_check_propagate(retval);
return retval;
}
@@ -1305,7 +1363,8 @@ static int dsp5680xx_write_8(struct target *t, uint32_t a, uint32_t c,
retval =
dsp5680xx_read(target, address + iter, 1, 1,
(uint8_t *) &data_old);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
if (count == 1)
data_old = (((data_old & 0xff) << 8) | data[0]); /* preserve upper byte */
else
@@ -1314,7 +1373,6 @@ static int dsp5680xx_write_8(struct target *t, uint32_t a, uint32_t c,
retval =
dsp5680xx_write_16_single(target, address + iter, data_old,
pmem);
- err_check_propagate(retval);
}
return retval;
}
@@ -1421,7 +1479,8 @@ static int dsp5680xx_write(struct target *target, target_addr_t a, uint32_t size
int p_mem = 1;
retval = dsp5680xx_convert_address(&address, &p_mem);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
switch (size) {
case 1:
@@ -1545,7 +1604,8 @@ static int dsp5680xx_f_sim_reset(struct target *target)
retval =
dsp5680xx_write(target, sim_addr, 1, 2,
(const uint8_t *)&sim_cmd);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
}
return retval;
}
@@ -1563,9 +1623,9 @@ static int dsp5680xx_soft_reset_halt(struct target *target)
int retval;
retval = dsp5680xx_halt(target);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = dsp5680xx_f_sim_reset(target);
- err_check_propagate(retval);
return retval;
}
@@ -1583,7 +1643,6 @@ int dsp5680xx_f_protect_check(struct target *target, uint16_t *protected)
retval =
dsp5680xx_read_16_single(target, HFM_BASE_ADDR | HFM_PROT,
(uint8_t *) protected, 0);
- err_check_propagate(retval);
return retval;
}
@@ -1607,20 +1666,25 @@ static int dsp5680xx_f_ex(struct target *target, uint16_t c, uint32_t address, u
int retval;
retval = core_load_tx_rx_high_addr_to_r0(target);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = core_move_long_to_r2(target, HFM_BASE_ADDR);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
uint8_t i[2];
int watchdog = 100;
do {
retval = core_move_at_r2_disp_to_y0(target, HFM_USTAT); /* read HMF_USTAT */
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = core_move_y0_at_r0(target);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = core_rx_upper_data(target, i);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
if ((watchdog--) == 1) {
retval = ERROR_TARGET_FAILURE;
const char *msg =
@@ -1633,53 +1697,67 @@ static int dsp5680xx_f_ex(struct target *target, uint16_t c, uint32_t address, u
/* write to HFM_CNFG (lock=0,select bank) - flash_desc.bank&0x03, 0x01 == 0x00, 0x01 ??? */
retval = core_move_value_at_r2_disp(target, 0x00, HFM_CNFG);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
/* write to HMF_USTAT, clear PVIOL, ACCERR &BLANK bits */
retval = core_move_value_at_r2_disp(target, 0x04, HFM_USTAT);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
/* clear only one bit at a time */
retval = core_move_value_at_r2_disp(target, 0x10, HFM_USTAT);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = core_move_value_at_r2_disp(target, 0x20, HFM_USTAT);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
/* write to HMF_PROT, clear protection */
retval = core_move_value_at_r2_disp(target, 0x00, HFM_PROT);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
/* write to HMF_PROTB, clear protection */
retval = core_move_value_at_r2_disp(target, 0x00, HFM_PROTB);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = core_move_value_to_y0(target, data);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
/* write to the flash block */
retval = core_move_long_to_r3(target, address);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
if (pmem) {
retval = core_move_y0_at_pr3_inc(target);
- err_check_propagate(retval);
} else {
retval = core_move_y0_at_r3(target);
- err_check_propagate(retval);
}
+ if (retval != ERROR_OK)
+ return retval;
/* write command to the HFM_CMD reg */
retval = core_move_value_at_r2_disp(target, command, HFM_CMD);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
/* start the command */
retval = core_move_value_at_r2_disp(target, 0x80, HFM_USTAT);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
dsp5680xx_context.flush = 1;
retval = dsp5680xx_execute_queue();
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
watchdog = 100;
do {
/* read HMF_USTAT */
retval = core_move_at_r2_disp_to_y0(target, HFM_USTAT);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = core_move_y0_at_r0(target);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = core_rx_upper_data(target, i);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
if ((watchdog--) == 1) {
retval = ERROR_TARGET_FAILURE;
err_check(retval, DSP5680XX_ERROR_FM_CMD_TIMED_OUT,
@@ -1715,16 +1793,21 @@ static int set_fm_ck_div(struct target *target)
int retval;
retval = core_move_long_to_r2(target, HFM_BASE_ADDR);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = core_load_tx_rx_high_addr_to_r0(target);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
/* read HFM_CLKD */
retval = core_move_at_r2_to_y0(target);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = core_move_y0_at_r0(target);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = core_rx_upper_data(target, i);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
unsigned int hfm_at_wrong_value = 0;
if ((i[0] & 0x7f) != HFM_CLK_DEFAULT) {
@@ -1739,14 +1822,18 @@ static int set_fm_ck_div(struct target *target)
}
/* write HFM_CLKD */
retval = core_move_value_at_r2(target, HFM_CLK_DEFAULT);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
/* verify HFM_CLKD */
retval = core_move_at_r2_to_y0(target);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = core_move_y0_at_r0(target);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = core_rx_upper_data(target, i);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
if (i[0] != (0x80 | (HFM_CLK_DEFAULT & 0x7f))) {
retval = ERROR_TARGET_FAILURE;
err_check(retval, DSP5680XX_ERROR_FM_SET_CLK,
@@ -1789,7 +1876,8 @@ static int dsp5680xx_f_signature(struct target *target, uint32_t address, uint32
retval =
dsp5680xx_f_ex(target, HFM_CALCULATE_DATA_SIGNATURE, address, words,
&hfm_ustat, 1);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval =
dsp5680xx_read_16_single(target, HFM_BASE_ADDR | HFM_DATA,
(uint8_t *) signature, 0);
@@ -1807,17 +1895,20 @@ int dsp5680xx_f_erase_check(struct target *target, uint8_t *erased,
if (!dsp5680xx_context.debug_mode_enabled) {
retval = dsp5680xx_halt(target);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
}
retval = set_fm_ck_div(target);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
/*
* Check if chip is already erased.
*/
tmp = HFM_FLASH_BASE_ADDR + sector * HFM_SECTOR_SIZE / 2;
retval =
dsp5680xx_f_ex(target, HFM_ERASE_VERIFY, tmp, 0, &hfm_ustat, 1);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
if (erased)
*erased = (uint8_t) (hfm_ustat & HFM_USTAT_MASK_BLANK);
return retval;
@@ -1839,7 +1930,6 @@ static int erase_sector(struct target *target, int sector, uint16_t *hfm_ustat)
uint32_t tmp = HFM_FLASH_BASE_ADDR + sector * HFM_SECTOR_SIZE / 2;
retval = dsp5680xx_f_ex(target, HFM_PAGE_ERASE, tmp, 0, hfm_ustat, 1);
- err_check_propagate(retval);
return retval;
}
@@ -1865,20 +1955,23 @@ int dsp5680xx_f_erase(struct target *target, int first, int last)
if (!dsp5680xx_context.debug_mode_enabled) {
retval = dsp5680xx_halt(target);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
}
/*
* Reset SIM
*
*/
retval = dsp5680xx_f_sim_reset(target);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
/*
* Set hfmdiv
*
*/
retval = set_fm_ck_div(target);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
uint16_t hfm_ustat;
@@ -1888,11 +1981,13 @@ int dsp5680xx_f_erase(struct target *target, int first, int last)
if (do_mass_erase) {
/* Mass erase */
retval = mass_erase(target, &hfm_ustat);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
} else {
for (int i = first; i <= last; i++) {
retval = erase_sector(target, i, &hfm_ustat);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
}
}
return ERROR_OK;
@@ -1966,7 +2061,8 @@ int dsp5680xx_f_wr(struct target *t, const uint8_t *b, uint32_t a, uint32_t coun
if (!dsp5680xx_context.debug_mode_enabled) {
retval = eonce_enter_debug_mode(target, NULL);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
}
/*
* Download the pgm that flashes.
@@ -1984,16 +2080,19 @@ int dsp5680xx_f_wr(struct target *t, const uint8_t *b, uint32_t a, uint32_t coun
retval =
dsp5680xx_write(target, ram_addr, 1, len * 2,
(uint8_t *) pgm_write_pflash);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = dsp5680xx_execute_queue();
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
}
/*
* Set hfmdiv
*
*/
retval = set_fm_ck_div(target);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
/*
* Setup registers needed by pgm_write_pflash
*
@@ -2002,32 +2101,41 @@ int dsp5680xx_f_wr(struct target *t, const uint8_t *b, uint32_t a, uint32_t coun
dsp5680xx_context.flush = 0;
retval = core_move_long_to_r3(target, address); /* Destination address to r3 */
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
core_load_tx_rx_high_addr_to_r0(target); /* TX/RX reg address to r0 */
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = core_move_long_to_r2(target, HFM_BASE_ADDR); /* FM base address to r2 */
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
/*
* Run flashing program.
*
*/
/* write to HFM_CNFG (lock=0, select bank) */
retval = core_move_value_at_r2_disp(target, 0x00, HFM_CNFG);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
/* write to HMF_USTAT, clear PVIOL, ACCERR &BLANK bits */
retval = core_move_value_at_r2_disp(target, 0x04, HFM_USTAT);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
/* clear only one bit at a time */
retval = core_move_value_at_r2_disp(target, 0x10, HFM_USTAT);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = core_move_value_at_r2_disp(target, 0x20, HFM_USTAT);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
/* write to HMF_PROT, clear protection */
retval = core_move_value_at_r2_disp(target, 0x00, HFM_PROT);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
/* write to HMF_PROTB, clear protection */
retval = core_move_value_at_r2_disp(target, 0x00, HFM_PROTB);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
if (count % 2) {
/* TODO implement handling of odd number of words. */
retval = ERROR_FAIL;
@@ -2039,17 +2147,20 @@ int dsp5680xx_f_wr(struct target *t, const uint8_t *b, uint32_t a, uint32_t coun
dsp5680xx_context.flush = 1;
retval = dsp5680xx_execute_queue();
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
uint32_t drscan_data;
uint16_t tmp = (buffer[0] | (buffer[1] << 8));
retval = core_tx_upper_data(target, tmp, &drscan_data);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
retval = dsp5680xx_resume(target, false, ram_addr, false, false);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
int counter = FLUSH_COUNT_FLASH;
@@ -2065,7 +2176,7 @@ int dsp5680xx_f_wr(struct target *t, const uint8_t *b, uint32_t a, uint32_t coun
retval = core_tx_upper_data(target, tmp, &drscan_data);
if (retval != ERROR_OK) {
dsp5680xx_context.flush = 1;
- err_check_propagate(retval);
+ return retval;
}
dsp5680xx_context.flush = 0;
}
@@ -2080,7 +2191,8 @@ int dsp5680xx_f_wr(struct target *t, const uint8_t *b, uint32_t a, uint32_t coun
uint16_t pc_crc;
retval = dsp5680xx_f_signature(target, address, i, &signature);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
pc_crc = perl_crc(buffer, i);
if (pc_crc != signature) {
retval = ERROR_FAIL;
@@ -2134,13 +2246,15 @@ int dsp5680xx_f_unlock(struct target *target)
/* Enable core tap */
tap_chp->enabled = true;
retval = switch_tap(target, tap_chp, tap_cpu);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
instr = JTAG_INSTR_DEBUG_REQUEST;
retval =
dsp5680xx_irscan(target, &instr, &ir_out,
DSP5680XX_JTAG_CORE_TAP_IRLEN);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
jtag_add_sleep(TIME_DIV_FREESCALE * 100 * 1000);
jtag_add_reset(0, 0);
jtag_add_sleep(TIME_DIV_FREESCALE * 300 * 1000);
@@ -2148,18 +2262,21 @@ int dsp5680xx_f_unlock(struct target *target)
/* Enable master tap */
tap_chp->enabled = false;
retval = switch_tap(target, tap_chp, tap_cpu);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
/* Execute mass erase to unlock */
instr = MASTER_TAP_CMD_FLASH_ERASE;
retval =
dsp5680xx_irscan(target, &instr, &ir_out,
DSP5680XX_JTAG_MASTER_TAP_IRLEN);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
instr = HFM_CLK_DEFAULT;
retval = dsp5680xx_drscan(target, (uint8_t *) &instr, (uint8_t *) &ir_out, 16);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
jtag_add_sleep(TIME_DIV_FREESCALE * 150 * 1000);
jtag_add_reset(0, 1);
@@ -2173,18 +2290,21 @@ int dsp5680xx_f_unlock(struct target *target)
instr = 0x0606ffff;
retval = dsp5680xx_drscan(target, (uint8_t *) &instr, (uint8_t *) &ir_out,
32);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
/* enable core tap */
instr = 0x5;
retval =
dsp5680xx_irscan(target, &instr, &ir_out,
DSP5680XX_JTAG_MASTER_TAP_IRLEN);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
instr = 0x2;
retval = dsp5680xx_drscan(target, (uint8_t *) &instr, (uint8_t *) &ir_out,
4);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
tap_cpu->enabled = true;
tap_chp->enabled = false;
@@ -2202,7 +2322,8 @@ int dsp5680xx_f_lock(struct target *target)
struct jtag_tap *tap_cpu;
uint16_t lock_word = HFM_LOCK_FLASH;
retval = dsp5680xx_f_wr(target, (uint8_t *)&lock_word, HFM_LOCK_ADDR_L, 2, 1);
- err_check_propagate(retval);
+ if (retval != ERROR_OK)
+ return retval;
jtag_add_reset(0, 1);
jtag_add_sleep(TIME_DIV_FREESCALE * 200 * 1000);
-----------------------------------------------------------------------
Summary of changes:
src/target/dsp5680xx.c | 489 +++++++++++++++++++++++++++++++------------------
1 file changed, 312 insertions(+), 177 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-04-06 16:24:26
|
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 48f57a72cec23c03321452ed696eff5763bbe251 (commit)
via b8cfd063683cec565aa137ca4b754182eacb72e9 (commit)
from 231aa88ee5170f28c3a6f9c2bd3055ba7f242c99 (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 48f57a72cec23c03321452ed696eff5763bbe251
Author: Mark O'Donovan <sh...@po...>
Date: Tue Feb 24 21:55:37 2026 +0000
target/dsp5680xx: cleanup code confusing cppcheck
1. Add check of target pointer in dsp5680xx_irscan().
2. Replace some calls to err_check().
The calls to err_check() were confusing cppcheck.
The changes are not strictly required but I think they are more
readable.
Change-Id: I9c144143254c8e153cc7848094994ea9f769f4ff
Signed-off-by: Mark O'Donovan <sh...@po...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9504
Reviewed-by: Antonio Borneo <bor...@gm...>
Tested-by: jenkins
diff --git a/src/target/dsp5680xx.c b/src/target/dsp5680xx.c
index 65efbae32..7f2b40edf 100644
--- a/src/target/dsp5680xx.c
+++ b/src/target/dsp5680xx.c
@@ -19,6 +19,7 @@
static struct dsp5680xx_common dsp5680xx_context;
#define _E "DSP5680XX_ERROR:%d\nAt:%s:%d:%s"
+#define err_log(c, m) LOG_ERROR(_E, c, __func__, __LINE__, m)
#define err_check(r, c, m) if (r != ERROR_OK) {LOG_ERROR(_E, c, __func__, __LINE__, m); return r; }
#define err_check_propagate(retval) if (retval != ERROR_OK) return retval;
#define DEBUG_MSG "Debug mode be enabled to read mem."
@@ -116,10 +117,9 @@ static int dsp5680xx_irscan(struct target *target, uint32_t *d_in,
uint16_t tap_ir_len = DSP5680XX_JTAG_MASTER_TAP_IRLEN;
- if (!target->tap) {
- retval = ERROR_FAIL;
- err_check(retval, DSP5680XX_ERROR_JTAG_INVALID_TAP,
- "Invalid tap");
+ if (!target || !target->tap) {
+ err_log(DSP5680XX_ERROR_JTAG_INVALID_TAP, "Invalid tap");
+ return ERROR_FAIL;
}
if (ir_len != target->tap->ir_length) {
if (target->tap->enabled) {
@@ -579,9 +579,9 @@ static int switch_tap(struct target *target, struct jtag_tap *master_tap,
if (!core_tap) {
core_tap = jtag_tap_by_string("dsp568013.cpu");
if (!core_tap) {
- retval = ERROR_FAIL;
- err_check(retval, DSP5680XX_ERROR_JTAG_TAP_FIND_CORE,
+ err_log(DSP5680XX_ERROR_JTAG_TAP_FIND_CORE,
"Failed to get core tap.");
+ return ERROR_FAIL;
}
}
@@ -727,9 +727,9 @@ static int eonce_enter_debug_mode(struct target *target,
}
tap_cpu = jtag_tap_by_string("dsp568013.cpu");
if (!tap_cpu) {
- retval = ERROR_FAIL;
- err_check(retval, DSP5680XX_ERROR_JTAG_TAP_FIND_CORE,
+ err_log(DSP5680XX_ERROR_JTAG_TAP_FIND_CORE,
"Failed to get master tap.");
+ return ERROR_FAIL;
}
/* Enable master tap */
tap_chp->enabled = true;
@@ -2222,9 +2222,9 @@ int dsp5680xx_f_lock(struct target *target)
}
tap_cpu = jtag_tap_by_string("dsp568013.cpu");
if (!tap_cpu) {
- retval = ERROR_FAIL;
- err_check(retval, DSP5680XX_ERROR_JTAG_TAP_ENABLE_CORE,
+ err_log(DSP5680XX_ERROR_JTAG_TAP_ENABLE_CORE,
"Failed to get master tap.");
+ return ERROR_FAIL;
}
target->state = TARGET_RUNNING;
dsp5680xx_context.debug_mode_enabled = false;
@@ -2237,8 +2237,9 @@ int dsp5680xx_f_lock(struct target *target)
static int dsp5680xx_step(struct target *target, bool current, target_addr_t address,
bool handle_breakpoints)
{
- err_check(ERROR_FAIL, DSP5680XX_ERROR_NOT_IMPLEMENTED_STEP,
+ err_log(DSP5680XX_ERROR_NOT_IMPLEMENTED_STEP,
"Not implemented yet.");
+ return ERROR_FAIL;
}
/** Holds methods for dsp5680xx targets. */
commit b8cfd063683cec565aa137ca4b754182eacb72e9
Author: Mark O'Donovan <sh...@po...>
Date: Tue Feb 24 20:49:50 2026 +0000
target/semihosting_common: remove redundant NULL check
The value semihosting can never be NULL here.
Found by cppcheck.
Change-Id: Iff5cef0ffc78ec19bc7630bc2cc9bc4eea002e47
Signed-off-by: Mark O'Donovan <sh...@po...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9503
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/target/semihosting_common.c b/src/target/semihosting_common.c
index 345e542c3..bcf37b6ad 100644
--- a/src/target/semihosting_common.c
+++ b/src/target/semihosting_common.c
@@ -1857,7 +1857,7 @@ COMMAND_HANDLER(handle_common_semihosting_command)
return ERROR_FAIL;
}
- if (semihosting && semihosting->setup(target, is_active) != ERROR_OK) {
+ if (semihosting->setup(target, is_active) != ERROR_OK) {
LOG_ERROR("Failed to Configure semihosting");
return ERROR_FAIL;
}
-----------------------------------------------------------------------
Summary of changes:
src/target/dsp5680xx.c | 23 ++++++++++++-----------
src/target/semihosting_common.c | 2 +-
2 files changed, 13 insertions(+), 12 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-04-06 16:23:52
|
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 231aa88ee5170f28c3a6f9c2bd3055ba7f242c99 (commit)
via 49e75c74d5572d49f575603ceae2b65ef9b08a81 (commit)
from bd17a59fd14e72a36930af4ab87d3f7b74887206 (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 231aa88ee5170f28c3a6f9c2bd3055ba7f242c99
Author: Mark O'Donovan <sh...@po...>
Date: Mon Mar 9 21:24:32 2026 +0000
target/arm_simulator: fix undefined behaviour
Shifting 32 bit unsigned variables by 32 bits is undefined behaviour
Change-Id: I846619a522c747f9c3b11a814a1864d1d51cfe87
Signed-off-by: Mark O'Donovan <sh...@po...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9502
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/target/arm_simulator.c b/src/target/arm_simulator.c
index e9f667116..8a87e4412 100644
--- a/src/target/arm_simulator.c
+++ b/src/target/arm_simulator.c
@@ -27,25 +27,31 @@ static uint32_t arm_shift(uint8_t shift, uint32_t rm,
shift_amount &= 0xff;
if (shift == 0x0) { /* LSL */
- if ((shift_amount > 0) && (shift_amount <= 32)) {
+ if (shift_amount > 0 && shift_amount < 32) {
return_value = rm << shift_amount;
*carry = rm >> (32 - shift_amount);
+ } else if (shift_amount == 32) {
+ return_value = 0x0;
+ *carry = rm & 0x1;
} else if (shift_amount > 32) {
return_value = 0x0;
*carry = 0x0;
} else /* (shift_amount == 0) */
return_value = rm;
} else if (shift == 0x1) { /* LSR */
- if ((shift_amount > 0) && (shift_amount <= 32)) {
+ if (shift_amount > 0 && shift_amount < 32) {
return_value = rm >> shift_amount;
*carry = (rm >> (shift_amount - 1)) & 1;
+ } else if (shift_amount == 32) {
+ return_value = 0x0;
+ *carry = (rm >> 31) & 0x1;
} else if (shift_amount > 32) {
return_value = 0x0;
*carry = 0x0;
} else /* (shift_amount == 0) */
return_value = rm;
} else if (shift == 0x2) { /* ASR */
- if ((shift_amount > 0) && (shift_amount <= 32)) {
+ if (shift_amount > 0 && shift_amount < 32) {
/* C right shifts of unsigned values are guaranteed to
* be logical (shift in zeroes); simulate an arithmetic
* shift (shift in signed-bit) by adding the sign bit
@@ -54,7 +60,7 @@ static uint32_t arm_shift(uint8_t shift, uint32_t rm,
return_value = rm >> shift_amount;
if (rm & 0x80000000)
return_value |= 0xffffffff << (32 - shift_amount);
- } else if (shift_amount > 32) {
+ } else if (shift_amount >= 32) {
if (rm & 0x80000000) {
return_value = 0xffffffff;
*carry = 0x1;
commit 49e75c74d5572d49f575603ceae2b65ef9b08a81
Author: Mark O'Donovan <sh...@po...>
Date: Tue Feb 24 20:37:06 2026 +0000
rtos/hwthread: move pointer deref after NULL check
Move pointer deref after NULL check.
Found by cppcheck.
Change-Id: I41b20a0598da83b6d7e353042b6f69e7a58706fc
Signed-off-by: Mark O'Donovan <sh...@po...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9501
Reviewed-by: Antonio Borneo <bor...@gm...>
Tested-by: jenkins
diff --git a/src/rtos/hwthread.c b/src/rtos/hwthread.c
index d422fac53..9367f70af 100644
--- a/src/rtos/hwthread.c
+++ b/src/rtos/hwthread.c
@@ -94,12 +94,13 @@ static int hwthread_update_threads(struct rtos *rtos)
struct target_list *head;
struct target *target;
int64_t current_thread = 0;
- int64_t current_threadid = rtos->current_threadid; /* thread selected by GDB */
+ int64_t current_threadid;
enum target_debug_reason current_reason = DBG_REASON_UNDEFINED;
if (!rtos)
return -1;
+ current_threadid = rtos->current_threadid; /* thread selected by GDB */
target = rtos->target;
/* wipe out previous thread details if any */
-----------------------------------------------------------------------
Summary of changes:
src/rtos/hwthread.c | 3 ++-
src/target/arm_simulator.c | 14 ++++++++++----
2 files changed, 12 insertions(+), 5 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-04-06 16:23: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 bd17a59fd14e72a36930af4ab87d3f7b74887206 (commit)
via 0e41ac862d3280fa2fb948ba4dbf74d52cb25966 (commit)
from b215fe8621890e624a4bc0c56ccb4f9340009144 (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 bd17a59fd14e72a36930af4ab87d3f7b74887206
Author: Mark O'Donovan <sh...@po...>
Date: Tue Feb 24 20:41:43 2026 +0000
pld/gowin: move pointer deref after NULL check
Move pointer deref after NULL check.
Found by cppcheck.
Change-Id: Ic1b197fa43fa800cfec631614574dda46b137597
Signed-off-by: Mark O'Donovan <sh...@po...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9500
Reviewed-by: Antonio Borneo <bor...@gm...>
Tested-by: jenkins
Reviewed-by: Daniel Anselmi <dan...@gm...>
diff --git a/src/pld/gowin.c b/src/pld/gowin.c
index bbc2fe15f..939e61060 100644
--- a/src/pld/gowin.c
+++ b/src/pld/gowin.c
@@ -172,11 +172,11 @@ static int gowin_read_fs_file(struct gowin_bit_file *bit_file, const char *filen
static int gowin_read_file(struct gowin_bit_file *bit_file, const char *filename, bool *is_fs)
{
- memset(bit_file, 0, sizeof(struct gowin_bit_file));
-
if (!filename || !bit_file)
return ERROR_COMMAND_SYNTAX_ERROR;
+ memset(bit_file, 0, sizeof(struct gowin_bit_file));
+
const char *file_suffix_pos = strrchr(filename, '.');
if (!file_suffix_pos) {
LOG_ERROR("Unable to detect filename suffix");
commit 0e41ac862d3280fa2fb948ba4dbf74d52cb25966
Author: Mark O'Donovan <sh...@po...>
Date: Tue Feb 24 20:44:43 2026 +0000
pld/gatemate: move pointer deref after NULL check
Move pointer deref after NULL check.
Found by cppcheck.
Change-Id: Ifdf40046cb1b03dbe7f445660b3349deae788e7b
Signed-off-by: Mark O'Donovan <sh...@po...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9499
Reviewed-by: Daniel Anselmi <dan...@gm...>
Reviewed-by: Antonio Borneo <bor...@gm...>
Tested-by: jenkins
diff --git a/src/pld/gatemate.c b/src/pld/gatemate.c
index f35b39ad2..479f6d183 100644
--- a/src/pld/gatemate.c
+++ b/src/pld/gatemate.c
@@ -138,11 +138,11 @@ static int gatemate_read_cfg_file(struct gatemate_bit_file *bit_file, const char
static int gatemate_read_file(struct gatemate_bit_file *bit_file, const char *filename)
{
- memset(bit_file, 0, sizeof(struct gatemate_bit_file));
-
if (!filename || !bit_file)
return ERROR_COMMAND_SYNTAX_ERROR;
+ memset(bit_file, 0, sizeof(struct gatemate_bit_file));
+
/* check if binary .bit or ascii .cfg */
const char *file_suffix_pos = strrchr(filename, '.');
if (!file_suffix_pos) {
-----------------------------------------------------------------------
Summary of changes:
src/pld/gatemate.c | 4 ++--
src/pld/gowin.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-04-06 16:22:58
|
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 b215fe8621890e624a4bc0c56ccb4f9340009144 (commit)
via 92dc88978ada47764c7c4b093702952c92bd7484 (commit)
from 4e23bf155f8e132f90720dfdcca77835934efddb (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 b215fe8621890e624a4bc0c56ccb4f9340009144
Author: Mark O'Donovan <sh...@po...>
Date: Tue Feb 24 22:14:04 2026 +0000
jtag/drivers/presto: fix potential divide by 0
Found by cppcheck.
Change-Id: I656685eb3b639dc054c3a563203264e03d72d1c7
Signed-off-by: Mark O'Donovan <sh...@po...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9498
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/jtag/drivers/presto.c b/src/jtag/drivers/presto.c
index 84b881cdc..552c74c9c 100644
--- a/src/jtag/drivers/presto.c
+++ b/src/jtag/drivers/presto.c
@@ -451,7 +451,7 @@ static struct bitq_interface presto_bitq = {
static int presto_adapter_khz(int khz, int *jtag_speed)
{
- if (khz < 0) {
+ if (khz <= 0) {
*jtag_speed = 0;
return ERROR_COMMAND_SYNTAX_ERROR;
}
commit 92dc88978ada47764c7c4b093702952c92bd7484
Author: Mark O'Donovan <sh...@po...>
Date: Mon Mar 9 21:48:16 2026 +0000
flash/nor/str7x: fix undefined behaviour
Shifting 32 bit signed variables by 31 bits is undefined behaviour
Change-Id: Iec61a98eecd6657ff6ba1dcad6fff76052c917e3
Signed-off-by: Mark O'Donovan <sh...@po...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9497
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/flash/nor/str7x.c b/src/flash/nor/str7x.c
index 0177095cb..e84721333 100644
--- a/src/flash/nor/str7x.c
+++ b/src/flash/nor/str7x.c
@@ -736,7 +736,7 @@ COMMAND_HANDLER(str7x_handle_disable_jtag_command)
target_read_u32(target, str7x_get_flash_adr(bank, FLASH_NVAPR1), ®);
protection_regs = ~(reg >> 16);
- while (((protection_regs) != 0) && (protection_level < 16)) {
+ while ((protection_regs != 0) && (protection_level < 16)) {
protection_regs >>= 1;
protection_level++;
}
@@ -753,7 +753,7 @@ COMMAND_HANDLER(str7x_handle_disable_jtag_command)
target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), flash_cmd);
target_write_u32(target, str7x_get_flash_adr(bank, FLASH_AR), 0x4010DFBC);
target_write_u32(target, str7x_get_flash_adr(bank, FLASH_DR0),
- ~(1 << (15 + protection_level)));
+ ~(1U << (15 + protection_level)));
flash_cmd = FLASH_SPR | FLASH_WMS;
target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), flash_cmd);
}
-----------------------------------------------------------------------
Summary of changes:
src/flash/nor/str7x.c | 4 ++--
src/jtag/drivers/presto.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-04-06 16:22:39
|
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 4e23bf155f8e132f90720dfdcca77835934efddb (commit)
from e4c49d86052dfc241ec60bbd3b7e190307891722 (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 4e23bf155f8e132f90720dfdcca77835934efddb
Author: Mark O'Donovan <sh...@po...>
Date: Tue Feb 24 20:32:02 2026 +0000
flash/nand/core: remove redundant NULL check
The value p can never be NULL here.
Found by cppcheck.
Change-Id: I2947b46e714c365021a945705f71d099168d30f4
Signed-off-by: Mark O'Donovan <sh...@po...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9496
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/flash/nand/core.c b/src/flash/nand/core.c
index a79844eb5..6fe8d4023 100644
--- a/src/flash/nand/core.c
+++ b/src/flash/nand/core.c
@@ -21,7 +21,7 @@ void nand_device_add(struct nand_device *c)
{
if (nand_devices) {
struct nand_device *p = nand_devices;
- while (p && p->next)
+ while (p->next)
p = p->next;
p->next = c;
} else
-----------------------------------------------------------------------
Summary of changes:
src/flash/nand/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-03-08 10:26: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 e4c49d86052dfc241ec60bbd3b7e190307891722 (commit)
from 22e1e1b33e844c343eb3f24d24f630e2471d2b27 (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 e4c49d86052dfc241ec60bbd3b7e190307891722
Author: Marc Schink <de...@za...>
Date: Thu Feb 26 10:14:34 2026 +0100
server/server: Fix build on FreeBSD
On FreeBSD, sig_atomic_t is of type 'long' rather than 'int'. Remove
the assert() instead of replacing it with a more complex, size-agnostic
check that would handle both 'int' and 'long'. Since the signal number
comes from the operating system, an explicit range check is unnecessary.
Checkpatch-ignore: COMMIT_LOG_LONG_LINE
Build error on FreeBSD:
../src/server/server.c:616:39: error: result of comparison of constant 9223372036854775807 with expression of type 'int' is always true [-Werror,-Wtautological-constant-out-of-range-compare]
616 | assert(sig >= SIG_ATOMIC_MIN && sig <= SIG_ATOMIC_MAX);
| ~~~ ^ ~~~~~~~~~~~~~~
/usr/include/assert.h:55:21: note: expanded from macro 'assert'
55 | #define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \
| ^
../src/server/server.c:616:14: error: result of comparison of constant -9223372036854775808 with expression of type 'int' is always true [-Werror,-Wtautological-constant-out-of-range-compare]
616 | assert(sig >= SIG_ATOMIC_MIN && sig <= SIG_ATOMIC_MAX);
| ~~~ ^ ~~~~~~~~~~~~~~
/usr/include/assert.h:55:21: note: expanded from macro 'assert'
55 | #define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \
Change-Id: I6cf9242ab8206184bff9390ef0245843261656bd
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9477
Reviewed-by: Anatoly P <kup...@gm...>
Reviewed-by: Antonio Borneo <bor...@gm...>
Tested-by: jenkins
diff --git a/src/server/server.c b/src/server/server.c
index 62c2ce821..a48c0dba9 100644
--- a/src/server/server.c
+++ b/src/server/server.c
@@ -613,7 +613,6 @@ static void sig_handler(int sig)
/* store only first signal that hits us */
if (shutdown_openocd == CONTINUE_MAIN_LOOP) {
shutdown_openocd = SHUTDOWN_WITH_SIGNAL_CODE;
- assert(sig >= SIG_ATOMIC_MIN && sig <= SIG_ATOMIC_MAX);
last_signal = sig;
LOG_DEBUG("Terminating on Signal %d", sig);
} else
-----------------------------------------------------------------------
Summary of changes:
src/server/server.c | 1 -
1 file changed, 1 deletion(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-03-08 10:22:24
|
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 22e1e1b33e844c343eb3f24d24f630e2471d2b27 (commit)
from 092282c7d27141df23a6055f9ee216da32494401 (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 22e1e1b33e844c343eb3f24d24f630e2471d2b27
Author: Cristian Dinca <he...@ic...>
Date: Fri Feb 13 15:50:48 2026 +0200
target/smp: reply to unknown packets in gdb_read_smp_packet
Some clients probe or use SMP-related 'j' packets. If OpenOCD
received an unknown 'j' packet, gdb_read_smp_packet previously did
not send any reply. This may result cause the client to hang while
waiting for a response.
Send an empty reply packet for unsupported 'j' packets.
Change-Id: I84c5e8e99f946d41dd5c11163c3eeb8af2b6c90f
Signed-off-by: Cristian Dinca <he...@ic...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9461
Tested-by: jenkins
Reviewed-by: Evgeniy Naydanov <eu...@gm...>
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index cf7a2bde0..f59eb5029 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -3753,18 +3753,30 @@ static int gdb_input_inner(struct connection *connection)
break;
case 'j':
- /* DEPRECATED */
- /* packet supported only by smp target i.e cortex_a.c*/
- /* handle smp packet replying coreid played to gbd */
- gdb_read_smp_packet(connection, packet, packet_size);
+ if (strncmp(packet, "jc", 2) == 0) {
+ /* DEPRECATED */
+ /* packet supported only by smp target i.e cortex_a.c*/
+ /* handle smp packet replying coreid played to gbd */
+ gdb_read_smp_packet(connection, packet, packet_size);
+ } else {
+ /* ignore unknown packets */
+ LOG_DEBUG("ignoring 0x%2.2x packet", packet[0]);
+ retval = gdb_put_packet(connection, "", 0);
+ }
break;
case 'J':
- /* DEPRECATED */
- /* packet supported only by smp target i.e cortex_a.c */
- /* handle smp packet setting coreid to be played at next
- * resume to gdb */
- gdb_write_smp_packet(connection, packet, packet_size);
+ if (strncmp(packet, "jc", 2) == 0) {
+ /* DEPRECATED */
+ /* packet supported only by smp target i.e cortex_a.c */
+ /* handle smp packet setting coreid to be played at next
+ * resume to gdb */
+ gdb_read_smp_packet(connection, packet, packet_size);
+ } else {
+ /* ignore unknown packets */
+ LOG_DEBUG("ignoring 0x%2.2x packet", packet[0]);
+ retval = gdb_put_packet(connection, "", 0);
+ }
break;
case 'F':
diff --git a/src/target/smp.c b/src/target/smp.c
index 41ca880d4..8a9dd2d9d 100644
--- a/src/target/smp.c
+++ b/src/target/smp.c
@@ -54,16 +54,13 @@ int gdb_read_smp_packet(struct connection *connection,
LOG_WARNING(DEPRECATED_MSG);
if (target->smp) {
- if (strncmp(packet, "jc", 2) == 0) {
- const uint32_t len = sizeof(target->gdb_service->core[0]);
- char hex_buffer[len * 2 + 1];
- uint8_t buffer[len];
- buf_set_u32(buffer, 0, len * 8, target->gdb_service->core[0]);
- size_t pkt_len = hexify(hex_buffer, buffer, sizeof(buffer),
- sizeof(hex_buffer));
-
- retval = gdb_put_packet(connection, hex_buffer, pkt_len);
- }
+ const uint32_t len = sizeof(target->gdb_service->core[0]);
+ char hex_buffer[len * 2 + 1];
+ uint8_t buffer[len];
+ buf_set_u32(buffer, 0, len * 8, target->gdb_service->core[0]);
+ size_t pkt_len = hexify(hex_buffer, buffer, sizeof(buffer),
+ sizeof(hex_buffer));
+ retval = gdb_put_packet(connection, hex_buffer, pkt_len);
} else
retval = gdb_put_packet(connection, "E01", 3);
return retval;
-----------------------------------------------------------------------
Summary of changes:
src/server/gdb_server.c | 30 +++++++++++++++++++++---------
src/target/smp.c | 17 +++++++----------
2 files changed, 28 insertions(+), 19 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-03-08 10:21:49
|
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 092282c7d27141df23a6055f9ee216da32494401 (commit)
from c3b4bcc6e62e2bb8b09835c27f7dc34aa1c73be3 (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 092282c7d27141df23a6055f9ee216da32494401
Author: Marc Schink <de...@za...>
Date: Tue Feb 17 11:21:34 2026 +0100
tools/checkpatch: Add Markdown linter support
Use 'pymarkdownlnt' to lint Markdown files and enforce a strict style.
If the linter is not found, a single error message is printed and the
Markdown checks are skipped.
Example checkpatch output (line breaks added for commit message only):
ERROR:MARKDOWN_LINT: ./README.md:1:1: MD041: First line in file should
be a top level heading (first-line-heading,first-line-h1)
ERROR:MARKDOWN_LINT: ./README.md:272:1: MD012: Multiple consecutive
blank lines [Expected: 1, Actual: 4] (no-multiple-blanks)
ERROR:MARKDOWN_LINT: ./README.md:273:35: MD026: Trailing punctuation
present in heading text. (no-trailing-punctuation)
Change-Id: I460ef881b83eb0a2eb46ee62d520b514785ad4e1
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9474
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/README.md b/README.md
index c8806e06c..bf26d5903 100644
--- a/README.md
+++ b/README.md
@@ -262,6 +262,7 @@ Optional development script checkpatch needs:
- perl
- python
- python-ply
+- pymarkdownlnt
### Compiling OpenOCD
diff --git a/tools/scripts/checkpatch.pl b/tools/scripts/checkpatch.pl
index 9232c83a3..6235fc7eb 100755
--- a/tools/scripts/checkpatch.pl
+++ b/tools/scripts/checkpatch.pl
@@ -92,6 +92,12 @@ my $git_command ='export LANGUAGE=en_US.UTF-8; git';
my $tabsize = 8;
my ${CONFIG_} = "CONFIG_";
+# OpenOCD specific: Begin: check markdown with pymarkdownlnt
+# Remember which Markdown (*.md) files were already linted.
+my %md_checked;
+my $md_linter_not_found;
+# OpenOCD specific: End
+
sub help {
my ($exitcode) = @_;
@@ -2435,6 +2441,44 @@ sub report_dump {
our @report;
}
+# OpenOCD specific: Begin: check markdown with pymarkdownlnt
+sub run_md_linter {
+ my ($file) = @_;
+ my $md_linter = "pymarkdownlnt";
+
+ return if !$file || !-f $file;
+
+ if (!defined($md_linter_not_found)) {
+ $md_linter_not_found = (which($md_linter) eq "");
+ }
+
+ if ($md_linter_not_found) {
+ return;
+ }
+
+ my @cmd = ($md_linter, "scan", $file);
+
+ my @out = qx{@cmd 2>&1};
+ my $rc = $? >> 8;
+
+ foreach my $line (@out) {
+ chomp $line;
+ next if $line eq "";
+
+ if ($line =~ m/^(.*?):(\d+):(\d+):\s*([A-Z0-9]+):\s*(.*)$/) {
+ my ($path, $ln, $col, $code, $msg) = ($1, $2, $3, $4, $5);
+ WARN("MARKDOWN_LINT", "$file:$ln:$col: $code: $msg\n");
+ } else {
+ WARN("MARKDOWN_LINT: Failed to parse output: $line\n");
+ }
+ }
+
+ if ($rc != 0 && !@out) {
+ WARN("MARKDOWN_LINT", "Markdown linter exited with status $rc for $file\n");
+ }
+}
+# OpenOCD specific: End
+
sub fixup_current_range {
my ($lineRef, $offset, $length) = @_;
@@ -2965,6 +3009,15 @@ sub process {
}
}
+ # OpenOCD specific: Begin: check markdown with pymarkdownlnt
+ # Lint Markdown files.
+ if ($realfile =~ /\.md$/ && !$md_checked{$realfile}) {
+ my $fullpath = $root ? "$root/$realfile" : $realfile;
+ run_md_linter($fullpath);
+ $md_checked{$realfile} = 1;
+ }
+ # OpenOCD specific: End
+
next;
}
-----------------------------------------------------------------------
Summary of changes:
README.md | 1 +
tools/scripts/checkpatch.pl | 53 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 54 insertions(+)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-03-08 10:20:55
|
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 c3b4bcc6e62e2bb8b09835c27f7dc34aa1c73be3 (commit)
from a5a9121ad66b2d2ead1c3d44a7d10a19d9e98fac (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 c3b4bcc6e62e2bb8b09835c27f7dc34aa1c73be3
Author: Antonio Borneo <bor...@gm...>
Date: Sun Feb 15 21:04:09 2026 +0100
log: simplify handling of mallinfo()
Simplify the use of C preprocessor conditionals by adding a new
function get_free_memory_space().
Change-Id: I795bd13284d06844f976a5264ca4d54ad887983c
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9463
Reviewed-by: R. Diez <rdi...@rd...>
Tested-by: jenkins
diff --git a/src/helper/log.c b/src/helper/log.c
index 06d381055..0976f4e0f 100644
--- a/src/helper/log.c
+++ b/src/helper/log.c
@@ -62,6 +62,28 @@ static void log_forward(const char *file, unsigned int line, const char *functio
}
}
+// whitespace + SIZE_MAX + zero termination
+#define MEM_STR_LEN (1 + 21 + 1)
+static void get_free_memory_space(char *s)
+{
+#if defined(HAVE_MALLINFO2)
+ if (LOG_LEVEL_IS(LOG_LVL_DEBUG_MALLOC)) {
+ struct mallinfo2 info = mallinfo2();
+ snprintf(s, MEM_STR_LEN, " %zu", info.fordblks);
+ return;
+ }
+#elif defined(HAVE_MALLINFO)
+ if (LOG_LEVEL_IS(LOG_LVL_DEBUG_MALLOC)) {
+ struct mallinfo info = mallinfo();
+ snprintf(s, MEM_STR_LEN, " %d", info.fordblks);
+ return;
+ }
+#endif
+
+ // empty string
+ *s = 0;
+}
+
/* The log_puts() serves two somewhat different goals:
*
* - logging
@@ -102,34 +124,12 @@ static void log_puts(enum log_levels level,
/* print with count and time information */
int64_t t = timeval_ms() - start;
-#if defined(HAVE_MALLINFO) || defined(HAVE_MALLINFO2)
- const int should_use_mallinfo = LOG_LEVEL_IS(LOG_LVL_DEBUG_MALLOC);
+ char free_memory[MEM_STR_LEN];
+ get_free_memory_space(free_memory);
- if (should_use_mallinfo) {
-#ifdef HAVE_MALLINFO2
- struct mallinfo2 info = mallinfo2();
-#else
- struct mallinfo info = mallinfo();
-#endif
-
- fprintf(log_output, "%s%u %" PRId64 " %s:%d %s()"
-#ifdef HAVE_MALLINFO2
- " %zu"
-#else
- " %d"
-#endif
- ": %s", log_strings[level + 1], count, t, file, line, function,
- info.fordblks,
- string);
- }
-#else
- const int should_use_mallinfo = 0;
-#endif
- if (!should_use_mallinfo) {
- fprintf(log_output, "%s%u %" PRId64 " %s:%d %s()"
- ": %s", log_strings[level + 1], count, t, file, line, function,
- string);
- }
+ fprintf(log_output, "%s%u %" PRId64 " %s:%d %s()%s: %s",
+ log_strings[level + 1], count, t, file, line, function,
+ free_memory, string);
} else {
/* if we are using gdb through pipes then we do not want any output
* to the pipe otherwise we get repeated strings */
-----------------------------------------------------------------------
Summary of changes:
src/helper/log.c | 54 +++++++++++++++++++++++++++---------------------------
1 file changed, 27 insertions(+), 27 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-03-08 10:19: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 a5a9121ad66b2d2ead1c3d44a7d10a19d9e98fac (commit)
from 687dd5c5df4583ec0ef4b9dcc9ebd4a6c1968dd8 (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 a5a9121ad66b2d2ead1c3d44a7d10a19d9e98fac
Author: Antonio Borneo <bor...@gm...>
Date: Fri Jan 30 09:37:47 2026 +0100
target: stm32mpxxx: fix return to SWD after reset
A target reset can cause a power cycle, causing the DAP to switch
from SWD to JTAG. The adapter can loose the connection because it
keeps using SWD, triggering error messages.
While some ST-Link FW can automatically reconnect the lost SWD
connection, this is not possible with older FW nor with other
adapters.
Force a DAP initialization after reset to eventually switch it
back to SWD.
Change-Id: I29ea49d2d5ee013ad33371265fd6996353f391d6
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9462
Tested-by: jenkins
diff --git a/tcl/target/st/stm32mp13x.cfg b/tcl/target/st/stm32mp13x.cfg
index 164e0ff1f..acd2ce0ed 100644
--- a/tcl/target/st/stm32mp13x.cfg
+++ b/tcl/target/st/stm32mp13x.cfg
@@ -119,6 +119,8 @@ $_CHIPNAME.ap1 configure -event reset-assert-post {
$_CHIPNAME.ap1 configure -event reset-deassert-pre {
adapter deassert srst deassert trst
+ catch {dap init}
+ catch {$::_CHIPNAME.dap apid 1}
$::_CHIPNAME.ap1 arp_examine
_handshake_with_wrapper $halt
_enable_debug
diff --git a/tcl/target/st/stm32mp15x.cfg b/tcl/target/st/stm32mp15x.cfg
index 979a5a491..3d7225271 100644
--- a/tcl/target/st/stm32mp15x.cfg
+++ b/tcl/target/st/stm32mp15x.cfg
@@ -175,6 +175,8 @@ $_CHIPNAME.ap1 configure -event reset-assert-post {
$_CHIPNAME.ap1 configure -event reset-deassert-pre {
adapter deassert srst deassert trst
+ catch {dap init}
+ catch {$::_CHIPNAME.dap apid 1}
$::_CHIPNAME.ap1 arp_examine
_handshake_with_wrapper $halt
if { $::EN_CA7_0 } {
diff --git a/tcl/target/st/stm32mp21x.cfg b/tcl/target/st/stm32mp21x.cfg
index f4073a9f5..9a102c6d9 100644
--- a/tcl/target/st/stm32mp21x.cfg
+++ b/tcl/target/st/stm32mp21x.cfg
@@ -182,6 +182,8 @@ $_CHIPNAME.axi configure -event reset-assert-post {
$_CHIPNAME.axi configure -event reset-deassert-pre {
adapter deassert srst deassert trst
+ catch {dap init}
+ catch {$::_CHIPNAME.dap apid 0}
$::_CHIPNAME.axi arp_examine
set is_dev_boot [_enable_dbgmcu_on_devboot]
if { !$is_dev_boot } {
diff --git a/tcl/target/st/stm32mp23x.cfg b/tcl/target/st/stm32mp23x.cfg
index 015f816e4..7ca1830e3 100644
--- a/tcl/target/st/stm32mp23x.cfg
+++ b/tcl/target/st/stm32mp23x.cfg
@@ -171,7 +171,8 @@ $_CHIPNAME.axi configure -event reset-assert-post {
$_CHIPNAME.axi configure -event reset-deassert-pre {
adapter deassert srst deassert trst
-
+ catch {dap init}
+ catch {$::_CHIPNAME.dap apid 0}
$::_CHIPNAME.ap0 arp_examine
_handshake_with_wrapper $halt
diff --git a/tcl/target/st/stm32mp25x.cfg b/tcl/target/st/stm32mp25x.cfg
index 6807d64a1..92410c7b5 100644
--- a/tcl/target/st/stm32mp25x.cfg
+++ b/tcl/target/st/stm32mp25x.cfg
@@ -191,7 +191,8 @@ $_CHIPNAME.axi configure -event reset-assert-post {
$_CHIPNAME.axi configure -event reset-deassert-pre {
adapter deassert srst deassert trst
-
+ catch {dap init}
+ catch {$::_CHIPNAME.dap apid 0}
$::_CHIPNAME.ap0 arp_examine
_handshake_with_wrapper $halt
-----------------------------------------------------------------------
Summary of changes:
tcl/target/st/stm32mp13x.cfg | 2 ++
tcl/target/st/stm32mp15x.cfg | 2 ++
tcl/target/st/stm32mp21x.cfg | 2 ++
tcl/target/st/stm32mp23x.cfg | 3 ++-
tcl/target/st/stm32mp25x.cfg | 3 ++-
5 files changed, 10 insertions(+), 2 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-03-08 10:15:39
|
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 687dd5c5df4583ec0ef4b9dcc9ebd4a6c1968dd8 (commit)
from 0c6fe74351352fad03bd7115a38ef8c7c2ef83f6 (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 687dd5c5df4583ec0ef4b9dcc9ebd4a6c1968dd8
Author: Antonio Borneo <bor...@gm...>
Date: Thu Dec 25 11:31:35 2025 +0100
flash: nor: improve check on memory allocations
Add check for failed allocation.
Add warning for memory allocation fallback and change existing log
from user to more appropriate warning and debug.
Move allocation and check before changing flash information.
Change-Id: I5b2ab6bc12ea15a5d8f634ed00cf0a0bc7e5a517
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9384
Tested-by: jenkins
Reviewed-by: Tomas Vanek <va...@fb...>
Reviewed-by: Marc Schink <de...@za...>
diff --git a/src/flash/nor/core.c b/src/flash/nor/core.c
index 48440662e..2c41d1853 100644
--- a/src/flash/nor/core.c
+++ b/src/flash/nor/core.c
@@ -336,6 +336,10 @@ static int default_flash_mem_blank_check(struct flash_bank *bank)
}
uint8_t *buffer = malloc(buffer_size);
+ if (!buffer) {
+ LOG_ERROR("Out of memory");
+ return ERROR_FAIL;
+ }
for (unsigned int i = 0; i < bank->num_sectors; i++) {
uint32_t j;
@@ -382,8 +386,10 @@ int default_flash_blank_check(struct flash_bank *bank)
struct target_memory_check_block *block_array;
block_array = malloc(bank->num_sectors * sizeof(struct target_memory_check_block));
- if (!block_array)
+ if (!block_array) {
+ LOG_WARNING("Running slow fallback erase check - limited host memory available");
return default_flash_mem_blank_check(bank);
+ }
for (unsigned int i = 0; i < bank->num_sectors; i++) {
block_array[i].address = bank->base + bank->sectors[i].offset;
@@ -413,9 +419,9 @@ int default_flash_blank_check(struct flash_bank *bank)
retval = ERROR_OK;
} else {
if (retval == ERROR_NOT_IMPLEMENTED)
- LOG_USER("Running slow fallback erase check");
+ LOG_DEBUG("Running slow fallback erase check");
else
- LOG_USER("Running slow fallback erase check - add working memory");
+ LOG_WARNING("Running slow fallback erase check - add working memory");
retval = default_flash_mem_blank_check(bank);
}
@@ -729,11 +735,25 @@ int flash_write_unlock_verify(struct target *target, struct image *image,
unsigned int section;
uint32_t section_offset;
struct flash_bank *c;
- int *padding;
section = 0;
section_offset = 0;
+ /* allocate padding array */
+ int *padding = calloc(image->num_sections, sizeof(*padding));
+
+ /* This fn requires all sections to be in ascending order of addresses,
+ * whereas an image can have sections out of order. */
+ struct imagesection **sections = malloc(sizeof(struct imagesection *) *
+ image->num_sections);
+
+ if (!padding || !sections) {
+ LOG_ERROR("Out of memory");
+ free(padding);
+ free(sections);
+ return ERROR_FAIL;
+ }
+
if (written)
*written = 0;
@@ -744,14 +764,6 @@ int flash_write_unlock_verify(struct target *target, struct image *image,
flash_set_dirty();
}
- /* allocate padding array */
- padding = calloc(image->num_sections, sizeof(*padding));
-
- /* This fn requires all sections to be in ascending order of addresses,
- * whereas an image can have sections out of order. */
- struct imagesection **sections = malloc(sizeof(struct imagesection *) *
- image->num_sections);
-
for (unsigned int i = 0; i < image->num_sections; i++)
sections[i] = &image->sections[i];
-----------------------------------------------------------------------
Summary of changes:
src/flash/nor/core.c | 36 ++++++++++++++++++++++++------------
1 file changed, 24 insertions(+), 12 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-03-08 10:14:23
|
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 0c6fe74351352fad03bd7115a38ef8c7c2ef83f6 (commit)
from 5b3db97c42b62e4c2559f3384120626b28401b4e (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 0c6fe74351352fad03bd7115a38ef8c7c2ef83f6
Author: Jan Matyas <jan...@co...>
Date: Mon Jan 5 07:20:37 2026 +0100
server: Make "exit" command behave consistently
Before this fix, the "exit" command behaved differently
depending on where it was called from:
- "exit" in a telnet session: Session disconnected.
- "exit" in a Tcl session: Empty response sent but the
session remained connected.
- "exit" in a script (outside of Telnet or Tcl): OpenOCD
exited with code 0. Based on the help and documentation
"exit" was apparently not intended for these cases.
What's more, if "exit" is allowed in Tcl scripts,
user may confuse it with the Tcl's native "exit"
command that is not available in OpenOCD (it is
shadowed with this OpenOCD's "exit" command).
This fix makes the behavior of "exit" consistent:
- "exit" in a telnet session: Session disconnected
(no change).
- "exit" in a Tcl session: Session disconnected
(same as for telnet).
- "exit" in a script: Notify the user that "exit"
is deprecated outside of telnet/tcl but
still shut down OpenOCD (to preserve the original
behavior).
Update the documentation to make it very clear to users
when to use "exit" vs. "shutdown".
Change-Id: I790495330e1fa705b34097a1347fdc57aaa86de1
Signed-off-by: Jan Matyas <jan...@co...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9380
Reviewed-by: Antonio Borneo <bor...@gm...>
Tested-by: jenkins
diff --git a/doc/openocd.texi b/doc/openocd.texi
index 579f39844..a21a3e4bd 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -9529,7 +9529,12 @@ port is 6666.
@section Server Commands
@deffn {Command} {exit}
-Exits the current telnet session.
+Exits the current telnet or Tcl session but the OpenOCD process remains running.
+This command should only be used in telnet or Tcl sessions (and not directly
+in Tcl scripts).
+
+Note: To terminate the whole OpenOCD process, use the
+@command{shutdown} command instead.
@end deffn
@deffn {Command} {help} [string]
diff --git a/src/server/server.c b/src/server/server.c
index 0b957836d..62c2ce821 100644
--- a/src/server/server.c
+++ b/src/server/server.c
@@ -783,6 +783,23 @@ COMMAND_HANDLER(handle_shutdown_command)
return ERROR_COMMAND_CLOSE_CONNECTION;
}
+COMMAND_HANDLER(handle_exit_command)
+{
+ if (!tcl_is_from_tcl_session(CMD_CTX)
+ && !telnet_is_from_telnet_session(CMD_CTX)) {
+ LOG_WARNING("DEPRECATED: 'exit' should only be used in telnet or Tcl "
+ "sessions to close the session");
+ LOG_WARNING("Did you mean 'shutdown'?");
+ return command_run_line(CMD_CTX, "shutdown");
+ }
+
+ if (CMD_ARGC != 0)
+ return ERROR_COMMAND_SYNTAX_ERROR;
+
+ /* Disconnect telnet / Tcl session */
+ return ERROR_COMMAND_CLOSE_CONNECTION;
+}
+
COMMAND_HANDLER(handle_poll_period_command)
{
if (CMD_ARGC == 0)
@@ -819,6 +836,13 @@ static const struct command_registration server_command_handlers[] = {
.usage = "",
.help = "shut the server down",
},
+ {
+ .name = "exit",
+ .handler = &handle_exit_command,
+ .mode = COMMAND_ANY,
+ .usage = "",
+ .help = "exit (disconnect) telnet or Tcl session",
+ },
{
.name = "poll_period",
.handler = &handle_poll_period_command,
diff --git a/src/server/tcl_server.c b/src/server/tcl_server.c
index 16cc55e29..929fbee0c 100644
--- a/src/server/tcl_server.c
+++ b/src/server/tcl_server.c
@@ -230,12 +230,22 @@ static int tcl_input(struct connection *connection)
#undef ESTR
} else {
tclc->tc_line[tclc->tc_lineoffset-1] = '\0';
- command_run_line(connection->cmd_ctx, tclc->tc_line);
+ retval = command_run_line(connection->cmd_ctx, tclc->tc_line);
+
+ if (retval == ERROR_COMMAND_CLOSE_CONNECTION) {
+ /* "shutdown" or "exit" executed.
+ * Send an empty response - just the response termination character.
+ */
+ tcl_output(connection, "\x1a", 1);
+ return ERROR_SERVER_REMOTE_CLOSED;
+ }
+
result = Jim_GetString(Jim_GetResult(interp), &reslen);
retval = tcl_output(connection, result, reslen);
if (retval != ERROR_OK)
return retval;
- /* Always output ctrl-z as end of line to allow multiline results */
+
+ /* Signal the end of response by a termination character (ctrl-z) */
tcl_output(connection, "\x1a", 1);
}
@@ -284,6 +294,15 @@ int tcl_init(void)
return add_service(&tcl_service_driver, tcl_port, CONNECTION_LIMIT_UNLIMITED, NULL);
}
+bool tcl_is_from_tcl_session(struct command_context *cmd_ctx)
+{
+ if (!cmd_ctx->output_handler_priv)
+ return false;
+
+ struct connection *conn = (struct connection *)cmd_ctx->output_handler_priv;
+ return strcmp(conn->service->name, "tcl") == 0;
+}
+
COMMAND_HANDLER(handle_tcl_port_command)
{
return CALL_COMMAND_HANDLER(server_pipe_command, &tcl_port);
@@ -297,7 +316,7 @@ COMMAND_HANDLER(handle_tcl_notifications_command)
if (CMD_CTX->output_handler_priv)
connection = CMD_CTX->output_handler_priv;
- if (connection && !strcmp(connection->service->name, "tcl")) {
+ if (connection && tcl_is_from_tcl_session(CMD_CTX)) {
tclc = connection->priv;
return CALL_COMMAND_HANDLER(handle_command_parse_bool, &tclc->tc_notify, "Target Notification output ");
} else {
@@ -314,7 +333,7 @@ COMMAND_HANDLER(handle_tcl_trace_command)
if (CMD_CTX->output_handler_priv)
connection = CMD_CTX->output_handler_priv;
- if (connection && !strcmp(connection->service->name, "tcl")) {
+ if (connection && tcl_is_from_tcl_session(CMD_CTX)) {
tclc = connection->priv;
return CALL_COMMAND_HANDLER(handle_command_parse_bool, &tclc->tc_trace, "Target trace output ");
} else {
diff --git a/src/server/tcl_server.h b/src/server/tcl_server.h
index bee562ce8..f92656f9c 100644
--- a/src/server/tcl_server.h
+++ b/src/server/tcl_server.h
@@ -12,5 +12,6 @@
int tcl_init(void);
int tcl_register_commands(struct command_context *cmd_ctx);
void tcl_service_free(void);
+bool tcl_is_from_tcl_session(struct command_context *ctx);
#endif /* OPENOCD_SERVER_TCL_SERVER_H */
diff --git a/src/server/telnet_server.c b/src/server/telnet_server.c
index 3634a2a59..ea7f38fb8 100644
--- a/src/server/telnet_server.c
+++ b/src/server/telnet_server.c
@@ -519,6 +519,7 @@ static int telnet_exec_line(struct connection *connection)
t_con->prompt_visible = true;
if (retval == ERROR_COMMAND_CLOSE_CONNECTION)
+ /* "shutdown" or "exit" executed. */
return ERROR_SERVER_REMOTE_CLOSED;
/* the prompt is always placed at the line beginning */
@@ -967,14 +968,14 @@ int telnet_init(char *banner)
return ERROR_OK;
}
-COMMAND_HANDLER(handle_telnet_port_command)
+bool telnet_is_from_telnet_session(struct command_context *cmd_ctx)
{
- return CALL_COMMAND_HANDLER(server_pipe_command, &telnet_port);
+ return cmd_ctx->output_handler == telnet_output;
}
-COMMAND_HANDLER(handle_exit_command)
+COMMAND_HANDLER(handle_telnet_port_command)
{
- return ERROR_COMMAND_CLOSE_CONNECTION;
+ return CALL_COMMAND_HANDLER(server_pipe_command, &telnet_port);
}
static const struct command_registration telnet_subcommand_handlers[] = {
@@ -991,13 +992,6 @@ static const struct command_registration telnet_subcommand_handlers[] = {
};
static const struct command_registration telnet_command_handlers[] = {
- {
- .name = "exit",
- .handler = handle_exit_command,
- .mode = COMMAND_ANY,
- .usage = "",
- .help = "exit telnet session",
- },
{
.name = "telnet",
.chain = telnet_subcommand_handlers,
diff --git a/src/server/telnet_server.h b/src/server/telnet_server.h
index 313b529f0..a905b4199 100644
--- a/src/server/telnet_server.h
+++ b/src/server/telnet_server.h
@@ -54,5 +54,6 @@ struct telnet_service {
int telnet_init(char *banner);
int telnet_register_commands(struct command_context *command_context);
void telnet_service_free(void);
+bool telnet_is_from_telnet_session(struct command_context *cmd_ctx);
#endif /* OPENOCD_SERVER_TELNET_SERVER_H */
-----------------------------------------------------------------------
Summary of changes:
doc/openocd.texi | 7 ++++++-
src/server/server.c | 24 ++++++++++++++++++++++++
src/server/tcl_server.c | 27 +++++++++++++++++++++++----
src/server/tcl_server.h | 1 +
src/server/telnet_server.c | 16 +++++-----------
src/server/telnet_server.h | 1 +
6 files changed, 60 insertions(+), 16 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-03-05 21:31: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 5b3db97c42b62e4c2559f3384120626b28401b4e (commit)
from 84f88140031b09b7fc88e077fb640276d55402ed (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 5b3db97c42b62e4c2559f3384120626b28401b4e
Author: Tomas Vanek <va...@fb...>
Date: Sun Mar 1 17:41:12 2026 +0100
tcl/target/nordic/nrf53: fix empty event handler
reset-assert of network CPU should be handled by empty dummy handler
to prevent the Cortex-M target native processing. Unfortunately configuring
the empty string does not define a new handler, it drops the existing one.
Use semicolon to fix configuration and to make the emtpy handler
clearly visible.
Fixes: commit 17be341d38bd ("tcl/target: add nRF53 and nRF91 config files")
Reported-by: Lawrence King <law...@gm...>
Change-Id: I3bd229a78860ed05d694e708ab62cb1670a77010
Signed-off-by: Tomas Vanek <va...@fb...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9492
Tested-by: jenkins
Reviewed-by: Lawrence King <law...@gm...>
diff --git a/tcl/target/nordic/nrf53.cfg b/tcl/target/nordic/nrf53.cfg
index ce2eaf045..137897c57 100644
--- a/tcl/target/nordic/nrf53.cfg
+++ b/tcl/target/nordic/nrf53.cfg
@@ -72,9 +72,11 @@ if { ![using_hla] } {
flash bank $_CHIPNAME.net.uicr nrf5 0x01FF8000 0 0 0 $_TARGETNAME_NET
# System reset sets NETWORK.FORCEOFF which keeps the network core in reset
- # Don't touch network core during reset
- $_TARGETNAME_NET configure -event reset-assert {}
- # and start it after application core reset is finished to make all flash accessible
+ # Don't touch network core during reset - the event handler is
+ # intentionally empty and prevents native processing
+ $_TARGETNAME_NET configure -event reset-assert {;}
+ # and start it after application core reset is finished to make
+ # all flash accessible
$_TARGETNAME_APP configure -event reset-init "nrf53_cpunet_release $_CHIPNAME"
$_TARGETNAME_APP cortex_m reset_config sysresetreq
-----------------------------------------------------------------------
Summary of changes:
tcl/target/nordic/nrf53.cfg | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-03-01 19:43:33
|
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 84f88140031b09b7fc88e077fb640276d55402ed (commit)
from 70525731872b26b9c64c2ec6617b927045d41dae (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 84f88140031b09b7fc88e077fb640276d55402ed
Author: Tomas Vanek <va...@fb...>
Date: Wed Feb 4 12:45:41 2026 +0100
target/arm_adi_v5: search for multiple AP types much more effective way
Cortex-M debug AP could be on AHB3 or AHB5.
Finding AHB3 is fast as AP usually has a low address.
On the other hand, finding AP on the AHB5 equipped device is weird
without this patch. cortex_m_find_mem_ap()
first tries to read IDR from all possible 256 ADIv5 APs and checks
for AHB3 ID and if that fails, starts over and search for AHB5.
It takes long time (74 msec on fast USB HS based STLINK V3J15M7)
and logs lot of rubbish:
Debug: 168 117 target_examine_one(): [stm32u3x.cpu] Examination started
Debug: 169 117 target_call_event_callbacks(): event 19 (examine-start)
Debug: 170 117 arm_adi_v5.c:1201 dap_get_ap(): refcount AP#0x0 get 1
Debug: 171 118 arm_adi_v5.c:1226 dap_put_ap(): refcount AP#0x0 put 0
Debug: 172 118 arm_adi_v5.c:1201 dap_get_ap(): refcount AP#0x1 get 1
Debug: 173 118 arm_adi_v5.c:1226 dap_put_ap(): refcount AP#0x1 put 0
Debug: 174 118 arm_adi_v5.c:1201 dap_get_ap(): refcount AP#0x2 get 1
Debug: 175 119 arm_adi_v5.c:1226 dap_put_ap(): refcount AP#0x2 put 0
...
Debug: 188 123 arm_adi_v5.c:1201 dap_get_ap(): refcount AP#0x9 get 1
Debug: 189 123 stlink_usb_error_check(): STLINK_BAD_AP_ERROR
Debug: 190 123 arm_adi_v5.c:1226 dap_put_ap(): refcount AP#0x9 put 0
Debug: 191 123 arm_adi_v5.c:1201 dap_get_ap(): refcount AP#0xa get 1
Debug: 192 123 stlink_usb_error_check(): STLINK_BAD_AP_ERROR
Debug: 193 123 arm_adi_v5.c:1226 dap_put_ap(): refcount AP#0xa put 0
...
Debug: 926 190 arm_adi_v5.c:1201 dap_get_ap(): refcount AP#0xff get 1
Debug: 927 191 stlink_usb_error_check(): STLINK_BAD_AP_ERROR
Debug: 928 191 arm_adi_v5.c:1226 dap_put_ap(): refcount AP#0xff put 0
Debug: 929 191 arm_adi_v5.c:1154 dap_find_get_ap(): No MEM-AP AHB3 found
Debug: 930 191 arm_adi_v5.c:1201 dap_get_ap(): refcount AP#0x0 get 1
Debug: 931 191 arm_adi_v5.c:1144 dap_find_get_ap(): Found MEM-AP AHB5
at AP index: 0 (IDR=0x14770015)
Introduce dap_find_by_types_get_ap() to search for the array of AP IDs.
With the patch cortex_m_find_mem_ap() succeeds immediately:
Debug: 168 118 target_examine_one(): [stm32u3x.cpu] Examination started
Debug: 169 118 target_call_event_callbacks(): event 19 (examine-start)
Debug: 170 118 arm_adi_v5.c:1222 dap_get_ap(): refcount AP#0x0 get 1
Debug: 171 118 arm_adi_v5.c:1150 dap_find_by_types_get_ap(): Found MEM-AP
AHB5 at AP index: 0 (IDR=0x14770015)
Change-Id: Iabcfa1fd64a48febb0f759a213f15d69621ea5cf
Fixes: commit 0d47d85ff5d3 ("target/cortex_m: Add support for AHB5-AP")
Signed-off-by: Tomas Vanek <va...@fb...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9439
Tested-by: jenkins
Reviewed-by: Marc Schink <de...@za...>
diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c
index 67a3fcc57..e64f8ac37 100644
--- a/src/target/arm_adi_v5.c
+++ b/src/target/arm_adi_v5.c
@@ -1112,7 +1112,9 @@ bool is_ap_num_valid(struct adiv5_dap *dap, uint64_t ap_num)
* This function checks the ID for each access port to find the requested Access Port type
* It also calls dap_get_ap() to increment the AP refcount
*/
-int dap_find_get_ap(struct adiv5_dap *dap, enum ap_type type_to_find, struct adiv5_ap **ap_out)
+int dap_find_by_types_get_ap(struct adiv5_dap *dap,
+ const enum ap_type *types_to_find, unsigned int num_types,
+ struct adiv5_ap **ap_out)
{
if (is_adiv6(dap)) {
/* TODO: scan the ROM table and detect the AP available */
@@ -1120,6 +1122,8 @@ int dap_find_get_ap(struct adiv5_dap *dap, enum ap_type type_to_find, struct adi
return ERROR_FAIL;
}
+ assert(num_types > 0);
+
/* Maximum AP number is 255 since the SELECT register is 8 bits */
for (unsigned int ap_num = 0; ap_num <= DP_APSEL_MAX; ap_num++) {
struct adiv5_ap *ap = dap_get_ap(dap, ap_num);
@@ -1140,18 +1144,39 @@ int dap_find_get_ap(struct adiv5_dap *dap, enum ap_type type_to_find, struct adi
/* Reading register for a non-existent AP should not cause an error,
* but just to be sure, try to continue searching if an error does happen.
*/
- if (retval == ERROR_OK && (id_val & AP_TYPE_MASK) == type_to_find) {
- LOG_DEBUG("Found %s at AP index: %d (IDR=0x%08" PRIX32 ")",
- ap_type_to_description(type_to_find),
+ if (retval == ERROR_OK) {
+ for (unsigned int i = 0; i < num_types; i++) {
+ if ((id_val & AP_TYPE_MASK) == types_to_find[i]) {
+ LOG_DEBUG("Found %s at AP index: %d (IDR=0x%08" PRIX32 ")",
+ ap_type_to_description(types_to_find[i]),
ap_num, id_val);
- *ap_out = ap;
- return ERROR_OK;
+ *ap_out = ap;
+ return ERROR_OK;
+ }
+ }
}
dap_put_ap(ap);
}
- LOG_DEBUG("No %s found", ap_type_to_description(type_to_find));
+ char *types_str = NULL;
+ for (unsigned int i = 0; i < num_types; i++) {
+ if (!types_str) {
+ types_str = strdup(ap_type_to_description(types_to_find[i]));
+ } else {
+ char *next_str = alloc_printf("%s, %s", types_str,
+ ap_type_to_description(types_to_find[i]));
+ free(types_str);
+ types_str = next_str;
+ }
+ if (!types_str) {
+ LOG_ERROR("No memory");
+ return ERROR_FAIL;
+ }
+ }
+ LOG_DEBUG("No %s found", types_str);
+ free(types_str);
+
return ERROR_FAIL;
}
diff --git a/src/target/arm_adi_v5.h b/src/target/arm_adi_v5.h
index ebd2752bd..b7472510b 100644
--- a/src/target/arm_adi_v5.h
+++ b/src/target/arm_adi_v5.h
@@ -738,10 +738,21 @@ int adiv6_dap_read_baseptr(struct command_invocation *cmd, struct adiv5_dap *dap
/* test if ap_num is valid, based on current knowledge of dap */
bool is_ap_num_valid(struct adiv5_dap *dap, uint64_t ap_num);
+/* Probe Access Ports to find any type from array.
+ * Increment AP refcount */
+int dap_find_by_types_get_ap(struct adiv5_dap *dap,
+ const enum ap_type *types_to_find,
+ unsigned int num_types,
+ struct adiv5_ap **ap_out);
+
/* Probe Access Ports to find a particular type. Increment AP refcount */
-int dap_find_get_ap(struct adiv5_dap *dap,
+static inline int dap_find_get_ap(struct adiv5_dap *dap,
enum ap_type type_to_find,
- struct adiv5_ap **ap_out);
+ struct adiv5_ap **ap_out)
+{
+ const enum ap_type types[1] = { type_to_find };
+ return dap_find_by_types_get_ap(dap, types, 1, ap_out);
+}
/* Return AP with specified ap_num. Increment AP refcount */
struct adiv5_ap *dap_get_ap(struct adiv5_dap *dap, uint64_t ap_num);
diff --git a/src/target/cortex_m.c b/src/target/cortex_m.c
index fc12a1770..c4eee8c07 100644
--- a/src/target/cortex_m.c
+++ b/src/target/cortex_m.c
@@ -2775,10 +2775,12 @@ int cortex_m_security_restore(struct target *target, struct cortex_m_saved_secur
static int cortex_m_find_mem_ap(struct adiv5_dap *swjdp,
struct adiv5_ap **debug_ap)
{
- if (dap_find_get_ap(swjdp, AP_TYPE_AHB3_AP, debug_ap) == ERROR_OK)
- return ERROR_OK;
+ const enum ap_type types[] = {
+ AP_TYPE_AHB3_AP,
+ AP_TYPE_AHB5_AP
+ };
- return dap_find_get_ap(swjdp, AP_TYPE_AHB5_AP, debug_ap);
+ return dap_find_by_types_get_ap(swjdp, types, ARRAY_SIZE(types), debug_ap);
}
int cortex_m_examine(struct target *target)
-----------------------------------------------------------------------
Summary of changes:
src/target/arm_adi_v5.c | 39 ++++++++++++++++++++++++++++++++-------
src/target/arm_adi_v5.h | 15 +++++++++++++--
src/target/cortex_m.c | 8 +++++---
3 files changed, 50 insertions(+), 12 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-02-27 16:16: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 70525731872b26b9c64c2ec6617b927045d41dae (commit)
from 129e9d30055e5cbed5ad6f0229772a3dc89fa529 (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 70525731872b26b9c64c2ec6617b927045d41dae
Author: Marc Schink <de...@za...>
Date: Fri Jul 11 22:08:14 2025 +0000
server/gdb: Add support for NVM banks without sectors
This is necessary for non-flash NVM which does not have the concept of
sectors, such as RRAM. Also small flash memory regions without sectors,
such as configuration areas, can now be exposed to GDB.
Tested with nRF54L15-DK, tested for regression with AT32F421C8T7.
Change-Id: Ifc96ddca7dcfcd4ab17683c0e59f1be912901941
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9290
Reviewed-by: Tomas Vanek <va...@fb...>
Reviewed-by: Antonio Borneo <bor...@gm...>
Tested-by: jenkins
diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index b966e8593..cf7a2bde0 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -2010,6 +2010,15 @@ static int gdb_memory_map(struct connection *connection,
"length=\"0x%x\"/>\n",
p->base, p->size);
} else {
+ if (p->num_sectors == 0) {
+ xml_printf(&retval, &xml, &pos, &size,
+ "<memory type=\"flash\" "
+ "start=\"" TARGET_ADDR_FMT "\" "
+ "length=\"0x%x\">"
+ "<property name=\"blocksize\">0x%x</property>\n"
+ "</memory>\n", p->base, p->size, p->size);
+ }
+
/* Report adjacent groups of same-size sectors. So for
* example top boot CFI flash will list an initial region
* with several large sectors (maybe 128KB) and several
-----------------------------------------------------------------------
Summary of changes:
src/server/gdb_server.c | 9 +++++++++
1 file changed, 9 insertions(+)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2026-02-15 18:24: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 129e9d30055e5cbed5ad6f0229772a3dc89fa529 (commit)
from aaceff81f064107537c7706dc19ca6ff80ca12c8 (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 129e9d30055e5cbed5ad6f0229772a3dc89fa529
Author: R. Diez <rdi...@rd...>
Date: Mon Feb 2 18:00:49 2026 +0100
configure.ac: Replace --enable-malloc-logging with a new runtime log level.
About why the new log level LOG_LVL_DEBUG_USB has the same value a
LOG_LVL_DEBUG_MALLOC, see the mailing list discussion starting here:
Replacing --enable-verbose-usb-comms in configure.ac
https://sourceforge.net/p/openocd/mailman/message/59215751/
Other minor fixes included here which are probably
not worth submmitting in separate patches:
- In error message "level must be between -3 and 4", increase 4 to 5.
- LOG_DEBUG_IO was passing LOG_LVL_DEBUG instead of LOG_LVL_DEBUG_IO.
Change-Id: I71440bbabe4785338c0a27562cc76fa1b7d54bf5
Signed-off-by: R. Diez <rdi...@rd...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9432
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/configure.ac b/configure.ac
index 5bb76fe00..39f5e074e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -96,8 +96,8 @@ AC_CHECK_FUNCS([strnlen])
AC_CHECK_FUNCS([gettimeofday])
AC_CHECK_FUNCS([usleep])
AC_CHECK_FUNCS([realpath])
-AC_CHECK_FUNCS([mallinfo], [has_at_least_one_mallinfo=yes])
-AC_CHECK_FUNCS([mallinfo2], [has_at_least_one_mallinfo=yes])
+AC_CHECK_FUNCS([mallinfo])
+AC_CHECK_FUNCS([mallinfo2])
# guess-rev.sh only exists in the repository, not in the released archives
AC_MSG_CHECKING([whether to build a release])
@@ -264,21 +264,6 @@ AS_IF([test "x$enable_gcov" = "xyes"], [
AC_DEFINE([USE_GCOV], [0], [0 to leave coverage collection disabled.])
])
-debug_malloc=no
-AC_ARG_ENABLE([malloc_logging],
- AS_HELP_STRING([--enable-malloc-logging],
- [Include free space in logging messages (requires malloc.h).]),
- [debug_malloc=$enableval], [])
-
-AC_MSG_CHECKING([whether to enable malloc free space logging]);
-AC_MSG_RESULT([$debug_malloc])
-AS_IF([test "x$debug_malloc" = "xyes"], [
- AS_IF([test "x$has_at_least_one_mallinfo" != "xyes"], [
- AC_MSG_ERROR([Option --enable-malloc-logging needs a libc with mallinfo or mallinfo2.])
- ])
- AC_DEFINE([_DEBUG_FREE_SPACE_],[1], [Include malloc free space in logging])
-])
-
m4_define([AC_ARG_ADAPTERS], [
m4_foreach([adapter_driver], [$1],
[AC_ARG_ENABLE(ADAPTER_OPT([adapter_driver]),
diff --git a/doc/openocd.texi b/doc/openocd.texi
index 4c5df9b88..579f39844 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -9589,7 +9589,8 @@ level 1 adds warnings;
level 2 adds informational messages;
level 3 adds debugging messages;
level 4 adds verbose low-level debug messages;
-and level 5 adds USB communication messages.
+and level 5 adds USB communication messages
+and amount of free heap space if mallinfo is available.
The default is level 2, but that can be overridden on
the command line along with the location of that log
file (which is normally the server's standard output).
diff --git a/src/helper/log.c b/src/helper/log.c
index caed8a9da..06d381055 100644
--- a/src/helper/log.c
+++ b/src/helper/log.c
@@ -24,8 +24,8 @@
#include <stdarg.h>
-#ifdef _DEBUG_FREE_SPACE_
-#include <malloc.h> // For mallinfo/mallinfo2.
+#if defined(HAVE_MALLINFO) || defined(HAVE_MALLINFO2)
+#include <malloc.h>
#endif
int debug_level = LOG_LVL_INFO;
@@ -101,30 +101,35 @@ static void log_puts(enum log_levels level,
if (LOG_LEVEL_IS(LOG_LVL_DEBUG)) {
/* print with count and time information */
int64_t t = timeval_ms() - start;
-#ifdef _DEBUG_FREE_SPACE_
+
+#if defined(HAVE_MALLINFO) || defined(HAVE_MALLINFO2)
+ const int should_use_mallinfo = LOG_LEVEL_IS(LOG_LVL_DEBUG_MALLOC);
+
+ if (should_use_mallinfo) {
#ifdef HAVE_MALLINFO2
- struct mallinfo2 info = mallinfo2();
-#elif defined(HAVE_MALLINFO)
- struct mallinfo info = mallinfo();
+ struct mallinfo2 info = mallinfo2();
#else
-#error "Configuration error: Neither mallinfo() nor mallinfo2() are available."
+ struct mallinfo info = mallinfo();
#endif
-#endif
- fprintf(log_output, "%s%u %" PRId64 " %s:%d %s()"
-#ifdef _DEBUG_FREE_SPACE_
+
+ fprintf(log_output, "%s%u %" PRId64 " %s:%d %s()"
#ifdef HAVE_MALLINFO2
- " %zu"
-#elif defined(HAVE_MALLINFO)
- " %d"
+ " %zu"
#else
-#error "Configuration error: Neither mallinfo() nor mallinfo2() are available."
+ " %d"
#endif
+ ": %s", log_strings[level + 1], count, t, file, line, function,
+ info.fordblks,
+ string);
+ }
+#else
+ const int should_use_mallinfo = 0;
#endif
- ": %s", log_strings[level + 1], count, t, file, line, function,
-#ifdef _DEBUG_FREE_SPACE_
- info.fordblks,
-#endif
- string);
+ if (!should_use_mallinfo) {
+ fprintf(log_output, "%s%u %" PRId64 " %s:%d %s()"
+ ": %s", log_strings[level + 1], count, t, file, line, function,
+ string);
+ }
} else {
/* if we are using gdb through pipes then we do not want any output
* to the pipe otherwise we get repeated strings */
@@ -211,7 +216,7 @@ COMMAND_HANDLER(handle_debug_level_command)
int new_level;
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], new_level);
if (new_level > LOG_LVL_DEBUG_USB || new_level < LOG_LVL_SILENT) {
- command_print(CMD, "level must be between %d and %d", LOG_LVL_SILENT, LOG_LVL_DEBUG_IO);
+ command_print(CMD, "level must be between %d and %d", LOG_LVL_SILENT, LOG_LVL_DEBUG_USB);
return ERROR_COMMAND_ARGUMENT_INVALID;
}
debug_level = new_level;
diff --git a/src/helper/log.h b/src/helper/log.h
index 07c195d28..01917abe2 100644
--- a/src/helper/log.h
+++ b/src/helper/log.h
@@ -40,6 +40,10 @@
* LOG_LVL_DEBUG_USB - verbose USB trace
* In the past this corresponded to build configuration options
--enable-verbose and --enable-verbose-usb-comms.
+ * LOG_LVL_DEBUG_MALLOC - log messages will include the amount of free heap space
+ * maintained by malloc in its free list, if mallinfo is available.
+ * In the past this corresponded to build configuration
+ * option --enable-malloc-logging.
*/
enum log_levels {
LOG_LVL_SILENT = -3,
@@ -50,7 +54,10 @@ enum log_levels {
LOG_LVL_INFO = 2,
LOG_LVL_DEBUG = 3,
LOG_LVL_DEBUG_IO = 4,
+ // LOG_LVL_DEBUG_USB and LOG_LVL_DEBUG_MALLOC have the same value at the moment.
+ // In the future, these logging categories will be individually switchable.
LOG_LVL_DEBUG_USB = 5,
+ LOG_LVL_DEBUG_MALLOC = 5,
};
void log_printf(enum log_levels level, const char *file, unsigned int line,
@@ -109,7 +116,7 @@ extern int debug_level;
#define LOG_DEBUG_IO(expr ...) \
do { \
if (LOG_LEVEL_IS(LOG_LVL_DEBUG_IO)) \
- log_printf_lf(LOG_LVL_DEBUG, \
+ log_printf_lf(LOG_LVL_DEBUG_IO, \
__FILE__, __LINE__, __func__, \
expr); \
} while (0)
-----------------------------------------------------------------------
Summary of changes:
configure.ac | 19 ++-----------------
doc/openocd.texi | 3 ++-
src/helper/log.c | 45 +++++++++++++++++++++++++--------------------
src/helper/log.h | 9 ++++++++-
4 files changed, 37 insertions(+), 39 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|