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
(47) |
Dec
|
|
From: openocd-gerrit <ope...@us...> - 2024-08-25 12:43: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 5cb184a732c998eed1d4e1a54c682d204f6f34d2 (commit)
from ff22f78d4605d7037a70fa36232986c7396f2946 (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 5cb184a732c998eed1d4e1a54c682d204f6f34d2
Author: Richard Allen <rs...@gm...>
Date: Wed May 15 12:29:05 2024 -0500
target: fix profiler output on Windows
Open output file in binary mode to disable EOL
conversion on Windows (and sometimes cygwin depending
on installation settings and path).
Change-Id: I38276dd1af011ce5781b0264b7cbb08c32a1a2ad
Signed-off-by: Richard Allen <rs...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8278
Reviewed-by: Karl Palsson <ka...@tw...>
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/target/target.c b/src/target/target.c
index b1a26f9e3..9d1d2f550 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -4209,7 +4209,7 @@ static void write_gmon(uint32_t *samples, uint32_t sample_num, const char *filen
uint32_t start_address, uint32_t end_address, struct target *target, uint32_t duration_ms)
{
uint32_t i;
- FILE *f = fopen(filename, "w");
+ FILE *f = fopen(filename, "wb");
if (!f)
return;
write_string(f, "gmon");
-----------------------------------------------------------------------
Summary of changes:
src/target/target.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-08-25 12:42:53
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via ff22f78d4605d7037a70fa36232986c7396f2946 (commit)
from 0bf3373e808a097fdf50fc04f987c26b35ddf09d (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 ff22f78d4605d7037a70fa36232986c7396f2946
Author: Parshintsev Anatoly <ana...@sy...>
Date: Thu Jul 4 20:52:13 2024 +0300
doc: document that breakpoints are disabled on step/resume
OpenOCD disables breakpoints on step/resume if they
match the current code position. This is a non-obvious
behavior that should be documented
Change-Id: Id762066569ec6452869a58dfcd9df88c8a14d6ab
Signed-off-by: Parshintsev Anatoly <ana...@sy...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8388
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/doc/openocd.texi b/doc/openocd.texi
index c78638276..db787fdb2 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -9273,11 +9273,19 @@ power consumption (because the CPU is needlessly clocked).
@deffn {Command} {resume} [address]
Resume the target at its current code position,
or the optional @var{address} if it is provided.
+
+@b{NOTE:} targets are expected to temporary disable breakpoints
+if they match the address of the current code position
+or the @var{address} provided by user.
@end deffn
@deffn {Command} {step} [address]
Single-step the target at its current code position,
or the optional @var{address} if it is provided.
+
+@b{NOTE:} targets are expected to temporary disable breakpoints
+if they match the address of the current code position
+or the @var{address} provided by user.
@end deffn
@anchor{resetcommand}
-----------------------------------------------------------------------
Summary of changes:
doc/openocd.texi | 8 ++++++++
1 file changed, 8 insertions(+)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-08-25 12:41: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 0bf3373e808a097fdf50fc04f987c26b35ddf09d (commit)
from 941fa8538f2ad491f365a3818caa7534aaf29ea3 (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 0bf3373e808a097fdf50fc04f987c26b35ddf09d
Author: Marc Schink <de...@za...>
Date: Wed Jul 31 09:35:03 2024 +0200
target/breakpoints: Use 'unsigned int' for length
Change-Id: I233efb5b18de5f043fdc976807437db0a94236d1
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7056
Reviewed-by: Antonio Borneo <bor...@gm...>
Tested-by: jenkins
diff --git a/src/target/breakpoints.c b/src/target/breakpoints.c
index c39a98057..2fbb69e07 100644
--- a/src/target/breakpoints.c
+++ b/src/target/breakpoints.c
@@ -38,7 +38,7 @@ static int bpwp_unique_id;
static int breakpoint_add_internal(struct target *target,
target_addr_t address,
- uint32_t length,
+ unsigned int length,
enum breakpoint_type type)
{
struct breakpoint *breakpoint = target->breakpoints;
@@ -101,7 +101,7 @@ fail:
static int context_breakpoint_add_internal(struct target *target,
uint32_t asid,
- uint32_t length,
+ unsigned int length,
enum breakpoint_type type)
{
struct breakpoint *breakpoint = target->breakpoints;
@@ -151,7 +151,7 @@ static int context_breakpoint_add_internal(struct target *target,
static int hybrid_breakpoint_add_internal(struct target *target,
target_addr_t address,
uint32_t asid,
- uint32_t length,
+ unsigned int length,
enum breakpoint_type type)
{
struct breakpoint *breakpoint = target->breakpoints;
@@ -207,7 +207,7 @@ static int hybrid_breakpoint_add_internal(struct target *target,
int breakpoint_add(struct target *target,
target_addr_t address,
- uint32_t length,
+ unsigned int length,
enum breakpoint_type type)
{
if (target->smp) {
@@ -233,7 +233,7 @@ int breakpoint_add(struct target *target,
int context_breakpoint_add(struct target *target,
uint32_t asid,
- uint32_t length,
+ unsigned int length,
enum breakpoint_type type)
{
if (target->smp) {
@@ -255,7 +255,7 @@ int context_breakpoint_add(struct target *target,
int hybrid_breakpoint_add(struct target *target,
target_addr_t address,
uint32_t asid,
- uint32_t length,
+ unsigned int length,
enum breakpoint_type type)
{
if (target->smp) {
@@ -500,7 +500,7 @@ struct breakpoint *breakpoint_find(struct target *target, target_addr_t address)
}
static int watchpoint_add_internal(struct target *target, target_addr_t address,
- uint32_t length, enum watchpoint_rw rw, uint64_t value, uint64_t mask)
+ unsigned int length, enum watchpoint_rw rw, uint32_t value, uint32_t mask)
{
struct watchpoint *watchpoint = target->watchpoints;
struct watchpoint **watchpoint_p = &target->watchpoints;
@@ -556,7 +556,7 @@ bye:
}
LOG_TARGET_DEBUG(target, "added %s watchpoint at " TARGET_ADDR_FMT
- " of length 0x%8.8" PRIx32 " (WPID: %d)",
+ " of length 0x%8.8x (WPID: %d)",
watchpoint_rw_strings[(*watchpoint_p)->rw],
(*watchpoint_p)->address,
(*watchpoint_p)->length,
@@ -566,7 +566,7 @@ bye:
}
int watchpoint_add(struct target *target, target_addr_t address,
- uint32_t length, enum watchpoint_rw rw, uint64_t value, uint64_t mask)
+ unsigned int length, enum watchpoint_rw rw, uint64_t value, uint64_t mask)
{
if (target->smp) {
struct target_list *head;
diff --git a/src/target/breakpoints.h b/src/target/breakpoints.h
index 64c0ce2a5..0789267c7 100644
--- a/src/target/breakpoints.h
+++ b/src/target/breakpoints.h
@@ -26,7 +26,7 @@ enum watchpoint_rw {
struct breakpoint {
target_addr_t address;
uint32_t asid;
- int length;
+ unsigned int length;
enum breakpoint_type type;
bool is_set;
unsigned int number;
@@ -40,7 +40,7 @@ struct breakpoint {
struct watchpoint {
target_addr_t address;
- uint32_t length;
+ unsigned int length;
uint64_t mask;
uint64_t value;
enum watchpoint_rw rw;
@@ -52,11 +52,12 @@ struct watchpoint {
int breakpoint_clear_target(struct target *target);
int breakpoint_add(struct target *target,
- target_addr_t address, uint32_t length, enum breakpoint_type type);
+ target_addr_t address, unsigned int length, enum breakpoint_type type);
int context_breakpoint_add(struct target *target,
- uint32_t asid, uint32_t length, enum breakpoint_type type);
+ uint32_t asid, unsigned int length, enum breakpoint_type type);
int hybrid_breakpoint_add(struct target *target,
- target_addr_t address, uint32_t asid, uint32_t length, enum breakpoint_type type);
+ target_addr_t address, uint32_t asid, unsigned int length,
+ enum breakpoint_type type);
int breakpoint_remove(struct target *target, target_addr_t address);
int breakpoint_remove_all(struct target *target);
@@ -70,7 +71,7 @@ static inline void breakpoint_hw_set(struct breakpoint *breakpoint, unsigned int
int watchpoint_clear_target(struct target *target);
int watchpoint_add(struct target *target,
- target_addr_t address, uint32_t length,
+ target_addr_t address, unsigned int length,
enum watchpoint_rw rw, uint64_t value, uint64_t mask);
int watchpoint_remove(struct target *target, target_addr_t address);
int watchpoint_remove_all(struct target *target);
diff --git a/src/target/target.c b/src/target/target.c
index 09396d878..b1a26f9e3 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -3950,7 +3950,7 @@ static int handle_bp_command_list(struct command_invocation *cmd)
}
static int handle_bp_command_set(struct command_invocation *cmd,
- target_addr_t addr, uint32_t asid, uint32_t length, int hw)
+ target_addr_t addr, uint32_t asid, unsigned int length, int hw)
{
struct target *target = get_current_target(cmd->ctx);
int retval;
@@ -4067,7 +4067,7 @@ COMMAND_HANDLER(handle_wp_command)
while (watchpoint) {
char wp_type = (watchpoint->rw == WPT_READ ? 'r' : (watchpoint->rw == WPT_WRITE ? 'w' : 'a'));
command_print(CMD, "address: " TARGET_ADDR_FMT
- ", len: 0x%8.8" PRIx32
+ ", len: 0x%8.8x"
", r/w/a: %c, value: 0x%8.8" PRIx64
", mask: 0x%8.8" PRIx64,
watchpoint->address,
-----------------------------------------------------------------------
Summary of changes:
src/target/breakpoints.c | 18 +++++++++---------
src/target/breakpoints.h | 13 +++++++------
src/target/target.c | 4 ++--
3 files changed, 18 insertions(+), 17 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-08-25 12:41:00
|
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 941fa8538f2ad491f365a3818caa7534aaf29ea3 (commit)
from fc1e73b9cf4264350f445479a5a08833582e0cc3 (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 941fa8538f2ad491f365a3818caa7534aaf29ea3
Author: Peter Collingbourne <pc...@go...>
Date: Wed Jul 31 19:05:06 2024 -0700
arm_cti: Add CTIDEVCTL to register list
This is useful for setting a reset catch on a CPU that is being
brought out of reset.
Change-Id: Id8fe9bc3f75fd170f207f470a9f3b0faba7f24c1
Signed-off-by: Peter Collingbourne <pc...@go...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8422
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/target/arm_cti.c b/src/target/arm_cti.c
index 422513e3e..97d1fb34b 100644
--- a/src/target/arm_cti.c
+++ b/src/target/arm_cti.c
@@ -189,6 +189,7 @@ static const struct {
{ CTI_APPCLEAR, "APPCLR" },
{ CTI_APPPULSE, "APPPULSE" },
{ CTI_INACK, "INACK" },
+ { CTI_DEVCTL, "DEVCTL" },
};
static int cti_find_reg_offset(const char *name)
diff --git a/src/target/arm_cti.h b/src/target/arm_cti.h
index cfcde6560..1513f0254 100644
--- a/src/target/arm_cti.h
+++ b/src/target/arm_cti.h
@@ -39,6 +39,7 @@
#define CTI_CHIN_STATUS 0x138
#define CTI_CHOU_STATUS 0x13C
#define CTI_GATE 0x140
+#define CTI_DEVCTL 0x150
#define CTI_UNLOCK 0xFB0
#define CTI_CHNL(x) (1 << x)
-----------------------------------------------------------------------
Summary of changes:
src/target/arm_cti.c | 1 +
src/target/arm_cti.h | 1 +
2 files changed, 2 insertions(+)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-08-25 12:40:29
|
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 fc1e73b9cf4264350f445479a5a08833582e0cc3 (commit)
from 7eb9a48f2d53a773d822b7a2b93f53c09acb48d9 (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 fc1e73b9cf4264350f445479a5a08833582e0cc3
Author: Peter Collingbourne <pc...@go...>
Date: Wed Jul 31 19:02:42 2024 -0700
arm_cti: Clean up the list of CTI registers
Reduce the amount of boilerplate by moving cti_regs into its only
user, making it a local variable and removing the now-redundant
p_val pointer.
Change-Id: I778cc1e960532fae1ac1a952c6ff19c54e578a5f
Signed-off-by: Peter Collingbourne <pc...@go...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8421
Reviewed-by: Antonio Borneo <bor...@gm...>
Tested-by: jenkins
diff --git a/src/target/arm_cti.c b/src/target/arm_cti.c
index 0ea853e49..422513e3e 100644
--- a/src/target/arm_cti.c
+++ b/src/target/arm_cti.c
@@ -157,41 +157,38 @@ int arm_cti_clear_channel(struct arm_cti *self, uint32_t channel)
return arm_cti_write_reg(self, CTI_APPCLEAR, CTI_CHNL(channel));
}
-static uint32_t cti_regs[28];
-
static const struct {
uint32_t offset;
const char *label;
- uint32_t *p_val;
} cti_names[] = {
- { CTI_CTR, "CTR", &cti_regs[0] },
- { CTI_GATE, "GATE", &cti_regs[1] },
- { CTI_INEN0, "INEN0", &cti_regs[2] },
- { CTI_INEN1, "INEN1", &cti_regs[3] },
- { CTI_INEN2, "INEN2", &cti_regs[4] },
- { CTI_INEN3, "INEN3", &cti_regs[5] },
- { CTI_INEN4, "INEN4", &cti_regs[6] },
- { CTI_INEN5, "INEN5", &cti_regs[7] },
- { CTI_INEN6, "INEN6", &cti_regs[8] },
- { CTI_INEN7, "INEN7", &cti_regs[9] },
- { CTI_INEN8, "INEN8", &cti_regs[10] },
- { CTI_OUTEN0, "OUTEN0", &cti_regs[11] },
- { CTI_OUTEN1, "OUTEN1", &cti_regs[12] },
- { CTI_OUTEN2, "OUTEN2", &cti_regs[13] },
- { CTI_OUTEN3, "OUTEN3", &cti_regs[14] },
- { CTI_OUTEN4, "OUTEN4", &cti_regs[15] },
- { CTI_OUTEN5, "OUTEN5", &cti_regs[16] },
- { CTI_OUTEN6, "OUTEN6", &cti_regs[17] },
- { CTI_OUTEN7, "OUTEN7", &cti_regs[18] },
- { CTI_OUTEN8, "OUTEN8", &cti_regs[19] },
- { CTI_TRIN_STATUS, "TRIN", &cti_regs[20] },
- { CTI_TROUT_STATUS, "TROUT", &cti_regs[21] },
- { CTI_CHIN_STATUS, "CHIN", &cti_regs[22] },
- { CTI_CHOU_STATUS, "CHOUT", &cti_regs[23] },
- { CTI_APPSET, "APPSET", &cti_regs[24] },
- { CTI_APPCLEAR, "APPCLR", &cti_regs[25] },
- { CTI_APPPULSE, "APPPULSE", &cti_regs[26] },
- { CTI_INACK, "INACK", &cti_regs[27] },
+ { CTI_CTR, "CTR" },
+ { CTI_GATE, "GATE" },
+ { CTI_INEN0, "INEN0" },
+ { CTI_INEN1, "INEN1" },
+ { CTI_INEN2, "INEN2" },
+ { CTI_INEN3, "INEN3" },
+ { CTI_INEN4, "INEN4" },
+ { CTI_INEN5, "INEN5" },
+ { CTI_INEN6, "INEN6" },
+ { CTI_INEN7, "INEN7" },
+ { CTI_INEN8, "INEN8" },
+ { CTI_OUTEN0, "OUTEN0" },
+ { CTI_OUTEN1, "OUTEN1" },
+ { CTI_OUTEN2, "OUTEN2" },
+ { CTI_OUTEN3, "OUTEN3" },
+ { CTI_OUTEN4, "OUTEN4" },
+ { CTI_OUTEN5, "OUTEN5" },
+ { CTI_OUTEN6, "OUTEN6" },
+ { CTI_OUTEN7, "OUTEN7" },
+ { CTI_OUTEN8, "OUTEN8" },
+ { CTI_TRIN_STATUS, "TRIN" },
+ { CTI_TROUT_STATUS, "TROUT" },
+ { CTI_CHIN_STATUS, "CHIN" },
+ { CTI_CHOU_STATUS, "CHOUT" },
+ { CTI_APPSET, "APPSET" },
+ { CTI_APPCLEAR, "APPCLR" },
+ { CTI_APPPULSE, "APPPULSE" },
+ { CTI_INACK, "INACK" },
};
static int cti_find_reg_offset(const char *name)
@@ -224,10 +221,11 @@ COMMAND_HANDLER(handle_cti_dump)
struct arm_cti *cti = CMD_DATA;
struct adiv5_ap *ap = cti->ap;
int retval = ERROR_OK;
+ uint32_t values[ARRAY_SIZE(cti_names)];
for (size_t i = 0; (retval == ERROR_OK) && (i < ARRAY_SIZE(cti_names)); i++)
retval = mem_ap_read_u32(ap,
- cti->spot.base + cti_names[i].offset, cti_names[i].p_val);
+ cti->spot.base + cti_names[i].offset, &values[i]);
if (retval == ERROR_OK)
retval = dap_run(ap->dap);
@@ -237,7 +235,7 @@ COMMAND_HANDLER(handle_cti_dump)
for (size_t i = 0; i < ARRAY_SIZE(cti_names); i++)
command_print(CMD, "%8.8s (0x%04"PRIx32") 0x%08"PRIx32,
- cti_names[i].label, cti_names[i].offset, *cti_names[i].p_val);
+ cti_names[i].label, cti_names[i].offset, values[i]);
return JIM_OK;
}
-----------------------------------------------------------------------
Summary of changes:
src/target/arm_cti.c | 64 +++++++++++++++++++++++++---------------------------
1 file changed, 31 insertions(+), 33 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-08-25 12:40: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 7eb9a48f2d53a773d822b7a2b93f53c09acb48d9 (commit)
from d3f50ea9145aa6cbe9232ab29736aebbd60763cd (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 7eb9a48f2d53a773d822b7a2b93f53c09acb48d9
Author: Peter Collingbourne <pc...@go...>
Date: Tue Jul 30 18:03:33 2024 -0700
arm_adi_v5: Also clear sticky overrun bit on init
Some targets start up with the sticky overrun bit set. On such targets
we need to clear it in order to avoid subsequent incorrect reads.
Change-Id: I3e939a9e092de6fcea9494d3179a3386aa1701d2
Signed-off-by: Peter Collingbourne <pc...@go...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8420
Reviewed-by: Antonio Borneo <bor...@gm...>
Tested-by: jenkins
Reviewed-by: Tomas Vanek <va...@fb...>
diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c
index 8a97d7a52..3a5afc605 100644
--- a/src/target/arm_adi_v5.c
+++ b/src/target/arm_adi_v5.c
@@ -795,11 +795,12 @@ int dap_dp_init(struct adiv5_dap *dap)
dap->dp_ctrl_stat = CDBGPWRUPREQ | CSYSPWRUPREQ;
/*
- * This write operation clears the sticky error bit in jtag mode only and
- * is ignored in swd mode. It also powers-up system and debug domains in
- * both jtag and swd modes, if not done before.
+ * This write operation clears the sticky error and overrun bits in jtag
+ * mode only and is ignored in swd mode. It also powers-up system and
+ * debug domains in both jtag and swd modes, if not done before.
*/
- retval = dap_queue_dp_write(dap, DP_CTRL_STAT, dap->dp_ctrl_stat | SSTICKYERR);
+ retval = dap_queue_dp_write(dap, DP_CTRL_STAT,
+ dap->dp_ctrl_stat | SSTICKYERR | SSTICKYORUN);
if (retval != ERROR_OK)
return retval;
-----------------------------------------------------------------------
Summary of changes:
src/target/arm_adi_v5.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-08-25 12:39: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 d3f50ea9145aa6cbe9232ab29736aebbd60763cd (commit)
from 16429f6252c0d4b985d882e53ff476fe42fa0125 (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 d3f50ea9145aa6cbe9232ab29736aebbd60763cd
Author: Antonio Borneo <bor...@gm...>
Date: Fri Jun 7 14:42:58 2024 +0200
target: arm_adi_v5: add more CoreSight P/N
Add part numbers for:
- Cortex-A65AE,
- Cortex-M52,
- Cortex-M55,
- Cortex-R52+,
- STAR-MC1.
Change-Id: I6282768896dd727e803a071139816494470744f1
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8319
Tested-by: jenkins
diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c
index 9129acecf..8a97d7a52 100644
--- a/src/target/arm_adi_v5.c
+++ b/src/target/arm_adi_v5.c
@@ -1453,11 +1453,13 @@ static const struct dap_part_nums {
{ ARM_ID, 0x4af, "Cortex-A15 ROM", "(ROM Table)", },
{ ARM_ID, 0x4b5, "Cortex-R5 ROM", "(ROM Table)", },
{ ARM_ID, 0x4b8, "Cortex-R52 ROM", "(ROM Table)", },
+ { ARM_ID, 0x4bd, "Cortex-R52+ ROM", "(ROM Table)", },
{ ARM_ID, 0x4c0, "Cortex-M0+ ROM", "(ROM Table)", },
{ ARM_ID, 0x4c3, "Cortex-M3 ROM", "(ROM Table)", },
{ ARM_ID, 0x4c4, "Cortex-M4 ROM", "(ROM Table)", },
{ ARM_ID, 0x4c7, "Cortex-M7 PPB ROM", "(Private Peripheral Bus ROM Table)", },
{ ARM_ID, 0x4c8, "Cortex-M7 ROM", "(ROM Table)", },
+ { ARM_ID, 0x4c9, "STAR ROM", "(ROM Table)", },
{ ARM_ID, 0x4e0, "Cortex-A35 ROM", "(v7 Memory Map ROM Table)", },
{ ARM_ID, 0x4e4, "Cortex-A76 ROM", "(ROM Table)", },
{ ARM_ID, 0x906, "CoreSight CTI", "(Cross Trigger)", },
@@ -1499,6 +1501,7 @@ static const struct dap_part_nums {
{ ARM_ID, 0x9ae, "Cortex-A17 PMU", "(Performance Monitor Unit)", },
{ ARM_ID, 0x9af, "Cortex-A15 PMU", "(Performance Monitor Unit)", },
{ ARM_ID, 0x9b6, "Cortex-R52 PMU/CTI/ETM", "(Performance Monitor Unit/Cross Trigger/ETM)", },
+ { ARM_ID, 0x9bb, "Cortex-R52+ PMU/CTI/ETM", "(Performance Monitor Unit/Cross Trigger/ETM)", },
{ ARM_ID, 0x9b7, "Cortex-R7 PMU", "(Performance Monitor Unit)", },
{ ARM_ID, 0x9d3, "Cortex-A53 PMU", "(Performance Monitor Unit)", },
{ ARM_ID, 0x9d7, "Cortex-A57 PMU", "(Performance Monitor Unit)", },
@@ -1533,6 +1536,10 @@ static const struct dap_part_nums {
{ ARM_ID, 0xd0b, "Cortex-A76 Debug", "(Debug Unit)", },
{ ARM_ID, 0xd0c, "Neoverse N1", "(Debug Unit)", },
{ ARM_ID, 0xd13, "Cortex-R52 Debug", "(Debug Unit)", },
+ { ARM_ID, 0xd16, "Cortex-R52+ Debug", "(Debug Unit)", },
+ { ARM_ID, 0xd21, "STAR Debug", "(Debug Unit)", },
+ { ARM_ID, 0xd22, "Cortex-M55 Debug", "(Debug Unit)", },
+ { ARM_ID, 0xd43, "Cortex-A65AE Debug", "(Debug Unit)", },
{ ARM_ID, 0xd49, "Neoverse N2", "(Debug Unit)", },
{ 0x017, 0x120, "TI SDTI", "(System Debug Trace Interface)", }, /* from OMAP3 memmap */
{ 0x017, 0x343, "TI DAPCTL", "", }, /* from OMAP3 memmap */
@@ -1552,6 +1559,9 @@ static const struct dap_part_nums {
{ 0x1eb, 0x211, "Tegra 210 ROM", "(ROM Table)", },
{ 0x1eb, 0x302, "Denver Debug", "(Debug Unit)", },
{ 0x1eb, 0x402, "Denver PMU", "(Performance Monitor Unit)", },
+ { 0x575, 0x132, "STAR SCS", "(System Control Space)", },
+ { 0x575, 0x4d2, "Cortex-M52 ROM", "(ROM Table)", },
+ { 0x575, 0xd24, "Cortex-M52 Debug", "(Debug Unit)", },
};
static const struct dap_part_nums *pidr_to_part_num(unsigned int designer_id, unsigned int part_num)
-----------------------------------------------------------------------
Summary of changes:
src/target/arm_adi_v5.c | 10 ++++++++++
1 file changed, 10 insertions(+)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-08-25 12:37:50
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via 16429f6252c0d4b985d882e53ff476fe42fa0125 (commit)
from ceae51ad74ba3a16be3e7ee2df4743a6df3cd097 (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 16429f6252c0d4b985d882e53ff476fe42fa0125
Author: Marc Schink <de...@za...>
Date: Thu Aug 1 09:22:02 2024 +0200
target/arm_cti: Use suitable data types
While at it, fix some small coding style issues.
Change-Id: Ifb8e78b55d29a06d69a3ce71d12d0040777aef13
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8423
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/target/arm_cti.c b/src/target/arm_cti.c
index 7637ad015..0ea853e49 100644
--- a/src/target/arm_cti.c
+++ b/src/target/arm_cti.c
@@ -196,9 +196,7 @@ static const struct {
static int cti_find_reg_offset(const char *name)
{
- unsigned int i;
-
- for (i = 0; i < ARRAY_SIZE(cti_names); i++) {
+ for (size_t i = 0; i < ARRAY_SIZE(cti_names); i++) {
if (!strcmp(name, cti_names[i].label))
return cti_names[i].offset;
}
@@ -227,7 +225,7 @@ COMMAND_HANDLER(handle_cti_dump)
struct adiv5_ap *ap = cti->ap;
int retval = ERROR_OK;
- for (int i = 0; (retval == ERROR_OK) && (i < (int)ARRAY_SIZE(cti_names)); i++)
+ for (size_t i = 0; (retval == ERROR_OK) && (i < ARRAY_SIZE(cti_names)); i++)
retval = mem_ap_read_u32(ap,
cti->spot.base + cti_names[i].offset, cti_names[i].p_val);
@@ -237,7 +235,7 @@ COMMAND_HANDLER(handle_cti_dump)
if (retval != ERROR_OK)
return JIM_ERR;
- for (int i = 0; i < (int)ARRAY_SIZE(cti_names); i++)
+ for (size_t i = 0; i < ARRAY_SIZE(cti_names); i++)
command_print(CMD, "%8.8s (0x%04"PRIx32") 0x%08"PRIx32,
cti_names[i].label, cti_names[i].offset, *cti_names[i].p_val);
@@ -323,7 +321,6 @@ COMMAND_HANDLER(handle_cti_ack)
int retval = arm_cti_ack_events(cti, 1 << event);
-
if (retval != ERROR_OK)
return retval;
@@ -437,6 +434,7 @@ static int cti_configure(struct jim_getopt_info *goi, struct arm_cti *cti)
return JIM_OK;
}
+
static int cti_create(struct jim_getopt_info *goi)
{
struct command_context *cmd_ctx;
@@ -538,7 +536,6 @@ COMMAND_HANDLER(cti_handle_names)
return ERROR_OK;
}
-
static const struct command_registration cti_subcommand_handlers[] = {
{
.name = "create",
-----------------------------------------------------------------------
Summary of changes:
src/target/arm_cti.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-08-25 12:37:25
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via ceae51ad74ba3a16be3e7ee2df4743a6df3cd097 (commit)
from bfd3110e59f5b13c075823c654f1a51cfcd66d4d (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 ceae51ad74ba3a16be3e7ee2df4743a6df3cd097
Author: Antonio Borneo <bor...@gm...>
Date: Thu Aug 1 10:43:41 2024 +0200
checkpatch: only report error on hit
The Linux checkpatch script used by OpenOCD reports hits either as
error, warning and check.
Such classification is meaningful for Linux maintainers, but for
OpenOCD Jenkins they are all considered as errors.
Having such classification in the checkpatch report by Jenkins is
misleading for developers that expect 'warnings' to be probably
ignored by maintainers, while having no idea what 'checks' means.
This patch flattens all the checkpatch reports to 'error' only.
Checkpatch can trigger false positives. OpenOCD uses the tag
Checkpatch-ignore:
in the commit message to prevent Jenkins to report the error, as
described in HACKING.
Change-Id: I1d3164ba1f725c0763dfe362192ffa669b3856e6
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8424
Reviewed-by: Karl Palsson <ka...@tw...>
Tested-by: jenkins
diff --git a/tools/scripts/checkpatch.pl b/tools/scripts/checkpatch.pl
index 26589beab..a2f89eac8 100755
--- a/tools/scripts/checkpatch.pl
+++ b/tools/scripts/checkpatch.pl
@@ -2384,6 +2384,10 @@ sub show_type {
sub report {
my ($level, $type, $msg) = @_;
+ # OpenOCD specific: Begin: Flatten ERROR, WARNING and CHECK as ERROR
+ $level = 'ERROR';
+ # OpenOCD specific: End
+
if (!show_type($type) ||
(defined $tst_only && $msg !~ /\Q$tst_only\E/)) {
return 0;
@@ -7638,9 +7642,15 @@ sub process {
print report_dump();
if ($summary && !($clean == 1 && $quiet == 1)) {
print "$filename " if ($summary_file);
+ if (!$OpenOCD) {
print "total: $cnt_error errors, $cnt_warn warnings, " .
(($check)? "$cnt_chk checks, " : "") .
"$cnt_lines lines checked\n";
+ } # $OpenOCD
+ # OpenOCD specific: Begin: Report total as errors
+ my $total = $cnt_error + $cnt_warn + $cnt_chk;
+ print "total: $total errors, $cnt_lines lines checked\n";
+ # OpenOCD specific: End
}
if ($quiet == 0) {
-----------------------------------------------------------------------
Summary of changes:
tools/scripts/checkpatch.pl | 10 ++++++++++
1 file changed, 10 insertions(+)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-08-25 12:37:03
|
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 bfd3110e59f5b13c075823c654f1a51cfcd66d4d (commit)
from bee5999a447880dda271926bbbd7d49dc5f4fbe9 (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 bfd3110e59f5b13c075823c654f1a51cfcd66d4d
Author: Antonio Borneo <bor...@gm...>
Date: Sun Jul 14 14:59:34 2024 +0200
binarybuffer: str_to_buf(): simplify it and fix scan-build error
The function str_to_buf() can be simplified by writing directly
the intermediate results in the output buffer.
Such simplification improves the readability and also makes
scan-build happy, as it does not trigger anymore the warning:
src/helper/binarybuffer.c:328:8: warning: Use of memory
allocated with size zero [unix.Malloc]
if ((b256_buf[(buf_len / 8)] & mask) != 0x0) {
Change-Id: I1cef9a1ec5ff0e5841ba582610f273e89e7a81da
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8396
Reviewed-by: Jan Matyas <jan...@co...>
Tested-by: jenkins
diff --git a/src/helper/binarybuffer.c b/src/helper/binarybuffer.c
index dd1449276..509f24f0b 100644
--- a/src/helper/binarybuffer.c
+++ b/src/helper/binarybuffer.c
@@ -175,19 +175,6 @@ uint32_t flip_u32(uint32_t value, unsigned int num)
return c;
}
-static int ceil_f_to_u32(float x)
-{
- if (x < 0) /* return zero for negative numbers */
- return 0;
-
- uint32_t y = x; /* cut off fraction */
-
- if ((x - y) > 0.0) /* if there was a fractional part, increase by one */
- y++;
-
- return y;
-}
-
char *buf_to_hex_str(const void *_buf, unsigned buf_len)
{
unsigned len_bytes = DIV_ROUND_UP(buf_len, 8);
@@ -252,7 +239,10 @@ static const char *str_strip_number_prefix(const char *str, unsigned int radix)
int str_to_buf(const char *str, void *_buf, unsigned int buf_bitsize)
{
assert(str);
+ assert(_buf);
+ assert(buf_bitsize > 0);
+ uint8_t *buf = _buf;
unsigned int radix = str_radix_guess(str);
str = str_strip_number_prefix(str, radix);
@@ -261,86 +251,49 @@ int str_to_buf(const char *str, void *_buf, unsigned int buf_bitsize)
if (str_len == 0)
return ERROR_INVALID_NUMBER;
- float factor = 0.0;
- if (radix == 16)
- factor = 0.5; /* log(16) / log(256) = 0.5 */
- else if (radix == 10)
- factor = 0.41524; /* log(10) / log(256) = 0.41524 */
- else if (radix == 8)
- factor = 0.375; /* log(8) / log(256) = 0.375 */
- else
- assert(false);
-
- const unsigned int b256_len = ceil_f_to_u32(str_len * factor);
-
- /* Allocate a buffer for digits in base-256 notation */
- uint8_t *b256_buf = calloc(b256_len, 1);
- if (!b256_buf) {
- LOG_ERROR("Unable to allocate memory");
- return ERROR_FAIL;
- }
+ const size_t buf_len = DIV_ROUND_UP(buf_bitsize, 8);
+ memset(buf, 0, buf_len);
/* Go through the zero-terminated buffer
* of input digits (ASCII) */
- for (unsigned int i = 0; str[i]; i++) {
- uint32_t tmp = str[i];
- if ((tmp >= '0') && (tmp <= '9')) {
- tmp = (tmp - '0');
- } else if ((tmp >= 'a') && (tmp <= 'f')) {
- tmp = (tmp - 'a' + 10);
- } else if ((tmp >= 'A') && (tmp <= 'F')) {
- tmp = (tmp - 'A' + 10);
+ for (; *str; str++) {
+ unsigned int tmp;
+ const char c = *str;
+
+ if ((c >= '0') && (c <= '9')) {
+ tmp = c - '0';
+ } else if ((c >= 'a') && (c <= 'f')) {
+ tmp = c - 'a' + 10;
+ } else if ((c >= 'A') && (c <= 'F')) {
+ tmp = c - 'A' + 10;
} else {
/* Characters other than [0-9,a-f,A-F] are invalid */
- free(b256_buf);
return ERROR_INVALID_NUMBER;
}
- if (tmp >= radix) {
- /* Encountered a digit that is invalid for the current radix */
- free(b256_buf);
+ /* Error on invalid digit for current radix */
+ if (tmp >= radix)
return ERROR_INVALID_NUMBER;
- }
- /* Add the current digit (tmp) to the intermediate result
- * in b256_buf (base-256 digits) */
- for (unsigned int j = 0; j < b256_len; j++) {
- tmp += (uint32_t)b256_buf[j] * radix;
- b256_buf[j] = (uint8_t)(tmp & 0xFFu);
+ /* Add the current digit (tmp) to the intermediate result in buf */
+ for (unsigned int j = 0; j < buf_len; j++) {
+ tmp += buf[j] * radix;
+ buf[j] = tmp & 0xFFu;
tmp >>= 8;
}
- /* The b256_t buffer is large enough to contain the whole result. */
- assert(tmp == 0);
- }
-
- /* The result must not contain more bits than buf_bitsize. */
- /* Check the whole bytes: */
- for (unsigned int j = DIV_ROUND_UP(buf_bitsize, 8); j < b256_len; j++) {
- if (b256_buf[j] != 0x0) {
- free(b256_buf);
+ /* buf should be large enough to contain the whole result. */
+ if (tmp != 0)
return ERROR_NUMBER_EXCEEDS_BUFFER;
- }
}
- /* Check the partial byte: */
+
+ /* Check the partial most significant byte */
if (buf_bitsize % 8) {
const uint8_t mask = 0xFFu << (buf_bitsize % 8);
- if ((b256_buf[(buf_bitsize / 8)] & mask) != 0x0) {
- free(b256_buf);
+ if ((buf[buf_len - 1] & mask) != 0x0)
return ERROR_NUMBER_EXCEEDS_BUFFER;
- }
- }
-
- /* Copy the digits to the output buffer */
- uint8_t *buf = _buf;
- for (unsigned int j = 0; j < DIV_ROUND_UP(buf_bitsize, 8); j++) {
- if (j < b256_len)
- buf[j] = b256_buf[j];
- else
- buf[j] = 0;
}
- free(b256_buf);
return ERROR_OK;
}
-----------------------------------------------------------------------
Summary of changes:
src/helper/binarybuffer.c | 99 +++++++++++++----------------------------------
1 file changed, 26 insertions(+), 73 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-08-25 12:36:45
|
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 bee5999a447880dda271926bbbd7d49dc5f4fbe9 (commit)
from 8a3efbf21fda2ac673c401f8b9ec82d300c2af29 (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 bee5999a447880dda271926bbbd7d49dc5f4fbe9
Author: Antonio Borneo <bor...@gm...>
Date: Sun Jul 14 12:31:53 2024 +0200
binarybuffer: str_to_buf(): rename buf_len as buf_bitsize
The name 'buf_len' is misleading, as it usually refers to the byte
length of a buffer. Here we use it for the length in bits.
Rename it as 'buf_bitsize'.
While there, fix checkpatch error by changing the index type to
'unsigned int'.
Change-Id: I78855ed79a346d996d9c0100d94d14c64a36b228
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8395
Tested-by: jenkins
Reviewed-by: Jan Matyas <jan...@co...>
diff --git a/src/helper/binarybuffer.c b/src/helper/binarybuffer.c
index da6e10bab..dd1449276 100644
--- a/src/helper/binarybuffer.c
+++ b/src/helper/binarybuffer.c
@@ -249,7 +249,7 @@ static const char *str_strip_number_prefix(const char *str, unsigned int radix)
}
}
-int str_to_buf(const char *str, void *_buf, unsigned int buf_len)
+int str_to_buf(const char *str, void *_buf, unsigned int buf_bitsize)
{
assert(str);
@@ -314,18 +314,18 @@ int str_to_buf(const char *str, void *_buf, unsigned int buf_len)
assert(tmp == 0);
}
- /* The result must not contain more bits than buf_len. */
+ /* The result must not contain more bits than buf_bitsize. */
/* Check the whole bytes: */
- for (unsigned int j = DIV_ROUND_UP(buf_len, 8); j < b256_len; j++) {
+ for (unsigned int j = DIV_ROUND_UP(buf_bitsize, 8); j < b256_len; j++) {
if (b256_buf[j] != 0x0) {
free(b256_buf);
return ERROR_NUMBER_EXCEEDS_BUFFER;
}
}
/* Check the partial byte: */
- if (buf_len % 8) {
- const uint8_t mask = 0xFFu << (buf_len % 8);
- if ((b256_buf[(buf_len / 8)] & mask) != 0x0) {
+ if (buf_bitsize % 8) {
+ const uint8_t mask = 0xFFu << (buf_bitsize % 8);
+ if ((b256_buf[(buf_bitsize / 8)] & mask) != 0x0) {
free(b256_buf);
return ERROR_NUMBER_EXCEEDS_BUFFER;
}
@@ -333,7 +333,7 @@ int str_to_buf(const char *str, void *_buf, unsigned int buf_len)
/* Copy the digits to the output buffer */
uint8_t *buf = _buf;
- for (unsigned j = 0; j < DIV_ROUND_UP(buf_len, 8); j++) {
+ for (unsigned int j = 0; j < DIV_ROUND_UP(buf_bitsize, 8); j++) {
if (j < b256_len)
buf[j] = b256_buf[j];
else
diff --git a/src/helper/binarybuffer.h b/src/helper/binarybuffer.h
index 6cff86bd9..103a48c5c 100644
--- a/src/helper/binarybuffer.h
+++ b/src/helper/binarybuffer.h
@@ -198,10 +198,10 @@ void *buf_set_buf(const void *src, unsigned src_start,
* number is detected between decimal, hexadecimal and octal.
* @param str Input number, zero-terminated string
* @param _buf Output buffer, allocated by the caller
- * @param buf_len Output buffer size in bits
+ * @param buf_bitsize Output buffer size in bits
* @returns Error on invalid or overflowing number
*/
-int str_to_buf(const char *str, void *_buf, unsigned int buf_len);
+int str_to_buf(const char *str, void *_buf, unsigned int buf_bitsize);
char *buf_to_hex_str(const void *buf, unsigned size);
-----------------------------------------------------------------------
Summary of changes:
src/helper/binarybuffer.c | 14 +++++++-------
src/helper/binarybuffer.h | 4 ++--
2 files changed, 9 insertions(+), 9 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-08-25 12:36:25
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via 8a3efbf21fda2ac673c401f8b9ec82d300c2af29 (commit)
via ea859e1cd042578ea17994b56ac15be216eefe4a (commit)
from a414ffaf65171bf2d1ed289397befca3cbf8b967 (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 8a3efbf21fda2ac673c401f8b9ec82d300c2af29
Author: Antonio Borneo <bor...@gm...>
Date: Sun Jul 14 12:09:15 2024 +0200
binarybuffer: simplify the prototype of str_to_buf()
With 'radix' always zero and '_detected_radix' always NULL, drop
the two parameters and simplify str_to_buf().
While there:
- drop some redundant assert(),
- drop the re-check for the base prefix,
- simplify str_strip_number_prefix_if_present() and rename it, as
the prefix MUST be present,
- fix a minor typo,
- update the doxygen description of str_to_buf().
Change-Id: I1abdc8ec0587b23881953d3094101c04d5bb1c58
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8394
Tested-by: jenkins
Reviewed-by: Jan Matyas <jan...@co...>
diff --git a/src/helper/binarybuffer.c b/src/helper/binarybuffer.c
index 3e09143c6..da6e10bab 100644
--- a/src/helper/binarybuffer.c
+++ b/src/helper/binarybuffer.c
@@ -225,49 +225,37 @@ static bool str_has_octal_prefix(const char *s)
*/
static unsigned int str_radix_guess(const char *str)
{
- assert(str);
-
if (str_has_hex_prefix(str))
return 16;
if (str_has_octal_prefix(str))
return 8;
- /* Otherwise assume a decadic number. */
+ /* Otherwise assume a decimal number. */
return 10;
}
/** Strip leading "0x" or "0X" from hex numbers or "0" from octal numbers. */
-static void str_strip_number_prefix_if_present(const char **_str, unsigned int radix)
+static const char *str_strip_number_prefix(const char *str, unsigned int radix)
{
- assert(radix == 16 || radix == 10 || radix == 8);
- assert(_str);
-
- const char *str = *_str;
- assert(str);
-
- if (radix == 16 && str_has_hex_prefix(str))
- str += 2;
- else if (radix == 8 && str_has_octal_prefix(str))
- str += 1;
-
- /* No prefix to strip for radix == 10. */
-
- *_str = str;
+ switch (radix) {
+ case 16:
+ return str + 2;
+ case 8:
+ return str + 1;
+ case 10:
+ default:
+ return str;
+ }
}
-int str_to_buf(const char *str, void *_buf, unsigned int buf_len,
- unsigned int radix, unsigned int *_detected_radix)
+int str_to_buf(const char *str, void *_buf, unsigned int buf_len)
{
- assert(radix == 0 || radix == 8 || radix == 10 || radix == 16);
-
- if (radix == 0)
- radix = str_radix_guess(str);
+ assert(str);
- if (_detected_radix)
- *_detected_radix = radix;
+ unsigned int radix = str_radix_guess(str);
- str_strip_number_prefix_if_present(&str, radix);
+ str = str_strip_number_prefix(str, radix);
const size_t str_len = strlen(str);
if (str_len == 0)
diff --git a/src/helper/binarybuffer.h b/src/helper/binarybuffer.h
index 441374330..6cff86bd9 100644
--- a/src/helper/binarybuffer.h
+++ b/src/helper/binarybuffer.h
@@ -194,15 +194,14 @@ void *buf_set_buf(const void *src, unsigned src_start,
/**
* Parse an unsigned number (provided as a zero-terminated string)
- * into a bit buffer whose size is buf_len bits.
+ * into a bit buffer whose size is buf_len bits. The base of the
+ * number is detected between decimal, hexadecimal and octal.
* @param str Input number, zero-terminated string
* @param _buf Output buffer, allocated by the caller
* @param buf_len Output buffer size in bits
- * @param radix Base of the input number - 16, 10, 8 or 0.
- * 0 means auto-detect the radix.
+ * @returns Error on invalid or overflowing number
*/
-int str_to_buf(const char *str, void *_buf, unsigned int buf_len,
- unsigned int radix, unsigned int *_detected_radix);
+int str_to_buf(const char *str, void *_buf, unsigned int buf_len);
char *buf_to_hex_str(const void *buf, unsigned size);
diff --git a/src/helper/command.c b/src/helper/command.c
index b5dd927f2..907869325 100644
--- a/src/helper/command.c
+++ b/src/helper/command.c
@@ -1365,7 +1365,7 @@ COMMAND_HELPER(command_parse_str_to_buf, const char *str, void *buf, unsigned in
assert(str);
assert(buf);
- int ret = str_to_buf(str, buf, buf_len, 0, NULL);
+ int ret = str_to_buf(str, buf, buf_len);
if (ret == ERROR_OK)
return ret;
commit ea859e1cd042578ea17994b56ac15be216eefe4a
Author: Antonio Borneo <bor...@gm...>
Date: Sun Jul 14 11:28:49 2024 +0200
helper: command: drop radix parameter from command_parse_str_to_buf()
Commit 53b94fad58ab ("binarybuffer: Fix str_to_buf() parsing
function") introduces the helper command_parse_str_to_buf() to
parse as number a string on TCL command-line.
The parameter 'radix' can specify the base (decimal, octal,
hexadecimal, or auto-detected).
TCL is supposed to use decimal numbers by default, while octal and
hexadecimal numbers must be prefixed respectively with '0' and
'0x' (or '0X').
This would require the helper to always run auto-detection of the
base, thus always set the 'radix' parameter to zero. This makes
the parameter useless.
Keeping the 'radix' parameter can open the door to future abuse of
TCL syntax, E.g. a command can require an octal value without the
mandatory TCL '0' prefix; the octal value cannot be the result of
TCL expression.
To prevent any future abuse of the 'radix' parameter, drop it.
Change-Id: I88855bd83b4e08e8fdcf86a2fa5ef3269dd4ad57
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8393
Tested-by: jenkins
Reviewed-by: Jan Matyas <jan...@co...>
diff --git a/src/helper/command.c b/src/helper/command.c
index 15a9b4a08..b5dd927f2 100644
--- a/src/helper/command.c
+++ b/src/helper/command.c
@@ -1360,37 +1360,18 @@ int command_parse_bool_arg(const char *in, bool *out)
return ERROR_COMMAND_SYNTAX_ERROR;
}
-static const char *radix_to_str(unsigned int radix)
-{
- switch (radix) {
- case 16: return "hexadecimal";
- case 10: return "decadic";
- case 8: return "octal";
- }
- assert(false);
- return "";
-}
-
-COMMAND_HELPER(command_parse_str_to_buf, const char *str, void *buf, unsigned int buf_len,
- unsigned int radix)
+COMMAND_HELPER(command_parse_str_to_buf, const char *str, void *buf, unsigned int buf_len)
{
assert(str);
assert(buf);
- int ret = str_to_buf(str, buf, buf_len, radix, NULL);
+ int ret = str_to_buf(str, buf, buf_len, 0, NULL);
if (ret == ERROR_OK)
return ret;
/* Provide a clear error message to the user */
if (ret == ERROR_INVALID_NUMBER) {
- if (radix == 0) {
- /* Any radix is accepted, so don't include it in the error message. */
- command_print(CMD, "'%s' is not a valid number", str);
- } else {
- /* Specific radix is required - tell the user what it is. */
- command_print(CMD, "'%s' is not a valid number (requiring %s number)",
- str, radix_to_str(radix));
- }
+ command_print(CMD, "'%s' is not a valid number", str);
} else if (ret == ERROR_NUMBER_EXCEEDS_BUFFER) {
command_print(CMD, "Number %s exceeds %u bits", str, buf_len);
} else {
diff --git a/src/helper/command.h b/src/helper/command.h
index 7a044e619..b224bd022 100644
--- a/src/helper/command.h
+++ b/src/helper/command.h
@@ -519,14 +519,12 @@ COMMAND_HELPER(handle_command_parse_bool, bool *out, const char *label);
/**
* Parse a number (base 10, base 16 or base 8) and store the result
- * into a bit buffer.
+ * into a bit buffer. Use the prefixes '0' and '0x' for base 8 and 16,
+ * otherwise defaults to base 10.
*
* In case of parsing error, a user-readable error message is produced.
- *
- * If radix = 0 is given, the function guesses the radix by looking at the number prefix.
*/
-COMMAND_HELPER(command_parse_str_to_buf, const char *str, void *buf, unsigned int buf_len,
- unsigned int radix);
+COMMAND_HELPER(command_parse_str_to_buf, const char *str, void *buf, unsigned int buf_len);
/** parses an on/off command argument */
#define COMMAND_PARSE_ON_OFF(in, out) \
diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c
index 10a7dd3f8..624b4e4c2 100644
--- a/src/jtag/tcl.c
+++ b/src/jtag/tcl.c
@@ -89,7 +89,7 @@ static COMMAND_HELPER(handle_jtag_command_drscan_fields, struct scan_field *fiel
}
fields[field_count].out_value = t;
- int ret = CALL_COMMAND_HANDLER(command_parse_str_to_buf, CMD_ARGV[i + 1], t, bits, 0);
+ int ret = CALL_COMMAND_HANDLER(command_parse_str_to_buf, CMD_ARGV[i + 1], t, bits);
if (ret != ERROR_OK)
return ret;
fields[field_count].in_value = t;
diff --git a/src/target/target.c b/src/target/target.c
index b6159c72b..09396d878 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -3133,7 +3133,7 @@ COMMAND_HANDLER(handle_reg_command)
return ERROR_FAIL;
}
- int retval = CALL_COMMAND_HANDLER(command_parse_str_to_buf, CMD_ARGV[1], buf, reg->size, 0);
+ int retval = CALL_COMMAND_HANDLER(command_parse_str_to_buf, CMD_ARGV[1], buf, reg->size);
if (retval != ERROR_OK) {
free(buf);
return retval;
@@ -4835,8 +4835,7 @@ COMMAND_HANDLER(handle_set_reg_command)
return ERROR_FAIL;
}
- int retval = CALL_COMMAND_HANDLER(command_parse_str_to_buf,
- reg_value, buf, reg->size, 0);
+ int retval = CALL_COMMAND_HANDLER(command_parse_str_to_buf, reg_value, buf, reg->size);
if (retval != ERROR_OK) {
free(buf);
return retval;
-----------------------------------------------------------------------
Summary of changes:
src/helper/binarybuffer.c | 42 +++++++++++++++---------------------------
src/helper/binarybuffer.h | 9 ++++-----
src/helper/command.c | 25 +++----------------------
src/helper/command.h | 8 +++-----
src/jtag/tcl.c | 2 +-
src/target/target.c | 5 ++---
6 files changed, 28 insertions(+), 63 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-08-25 12:36:11
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via a414ffaf65171bf2d1ed289397befca3cbf8b967 (commit)
from ac63cd00d792331914db0b6edd3f427c30eec3fa (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 a414ffaf65171bf2d1ed289397befca3cbf8b967
Author: Antonio Borneo <bor...@gm...>
Date: Mon Aug 12 13:39:36 2024 +0200
doc: document command 'ms'
Add documentation for the commands 'ms'.
Change-Id: I247adce1c586c4f4cd36d044d48298c370635e67
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8432
Tested-by: jenkins
diff --git a/doc/openocd.texi b/doc/openocd.texi
index 794762fa2..c78638276 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -9621,6 +9621,12 @@ Add or replace help text on the given @var{command_name}.
Add or replace usage text on the given @var{command_name}.
@end deffn
+@deffn {Command} {ms}
+Returns current time since the Epoch in ms
+(See: @url{https://en.wikipedia.org/wiki/Epoch_(computing)}).
+Useful to compute delays in TCL.
+@end deffn
+
@node Architecture and Core Commands
@chapter Architecture and Core Commands
@cindex Architecture Specific Commands
-----------------------------------------------------------------------
Summary of changes:
doc/openocd.texi | 6 ++++++
1 file changed, 6 insertions(+)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-08-16 04:45:45
|
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 ac63cd00d792331914db0b6edd3f427c30eec3fa (commit)
from efe90221979458960618a5a5c8f90b116e91f011 (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 ac63cd00d792331914db0b6edd3f427c30eec3fa
Author: Tomas Vanek <va...@fb...>
Date: Fri Aug 2 19:45:09 2024 +0200
tcl/interface/raspberrypi5-gpiod: fix string match pattern escaping
Use correct TCL syntax and save string map operation.
Change-Id: Ic2a522bd57cf6610b7df1d9cddd0fbdc2076ed62
Signed-off-by: Tomas Vanek <va...@fb...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8426
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/tcl/interface/raspberrypi5-gpiod.cfg b/tcl/interface/raspberrypi5-gpiod.cfg
index f3fdde0f2..9624ad511 100644
--- a/tcl/interface/raspberrypi5-gpiod.cfg
+++ b/tcl/interface/raspberrypi5-gpiod.cfg
@@ -19,8 +19,7 @@ proc read_file { name } {
}
set pcie_aspm [read_file /sys/module/pcie_aspm/parameters/policy]
-# escaping [ ] characters in string match pattern does not work in Jim-Tcl
-if {![string match "*<performance>*" [string map { "\[" < "\]" > } $pcie_aspm]]} {
+if {![string match {*\[performance\]*} $pcie_aspm]} {
echo "Warn : Switch PCIe power saving off or the first couple of pulses gets clocked as fast as 20 MHz"
echo "Warn : Issue 'echo performance | sudo tee /sys/module/pcie_aspm/parameters/policy'"
}
-----------------------------------------------------------------------
Summary of changes:
tcl/interface/raspberrypi5-gpiod.cfg | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-08-06 14:32:06
|
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 efe90221979458960618a5a5c8f90b116e91f011 (commit)
from b9224c0c0f2a3d1ec52aab6ca985d1affa9a18b9 (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 efe90221979458960618a5a5c8f90b116e91f011
Author: Marc Schink <de...@za...>
Date: Mon Jun 24 16:26:46 2024 +0200
server/telnet: Always allow 'exit' command
The telnet 'exit' command is only available in the execution phase of
OpenOCD. Thus, a telnet session cannot be closed via 'exit' if OpenOCD
is started with 'noinit'. Make the 'exit' command always available.
Change-Id: I14447ecde63e579f1c523d606f048ad29cc84a35
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8379
Reviewed-by: Tomas Vanek <va...@fb...>
Tested-by: jenkins
diff --git a/src/server/telnet_server.c b/src/server/telnet_server.c
index 72171cb3f..02d450fbd 100644
--- a/src/server/telnet_server.c
+++ b/src/server/telnet_server.c
@@ -982,7 +982,7 @@ static const struct command_registration telnet_command_handlers[] = {
{
.name = "exit",
.handler = handle_exit_command,
- .mode = COMMAND_EXEC,
+ .mode = COMMAND_ANY,
.usage = "",
.help = "exit telnet session",
},
-----------------------------------------------------------------------
Summary of changes:
src/server/telnet_server.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-08-02 16:09: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 b9224c0c0f2a3d1ec52aab6ca985d1affa9a18b9 (commit)
from d5adab697fd8b65934acc2ffef105e9ab9804bcf (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 b9224c0c0f2a3d1ec52aab6ca985d1affa9a18b9
Author: Marc Schink <de...@za...>
Date: Mon Apr 15 21:02:43 2024 +0200
transport: Remove echo in transport selection
Do not echo the selected transport to avoid stray and confusing
messages in the output of OpenOCD. For example, the "swd" line here:
Open On-Chip Debugger 0.12.0+dev-00559-ge02f6c1b9-dirty
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
swd
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
While at it, fix some small documentation style issues.
Change-Id: Ie85426c441289bbaa35615dbb7b53f0b5c46cfc0
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8217
Reviewed-by: Antonio Borneo <bor...@gm...>
Tested-by: jenkins
diff --git a/doc/openocd.texi b/doc/openocd.texi
index fa0ffc731..794762fa2 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -3693,20 +3693,18 @@ displays the names of the transports supported by this
version of OpenOCD.
@end deffn
-@deffn {Command} {transport select} @option{transport_name}
+@deffn {Command} {transport select} [transport_name]
Select which of the supported transports to use in this OpenOCD session.
When invoked with @option{transport_name}, attempts to select the named
-transport. The transport must be supported by the debug adapter
+transport. The transport must be supported by the debug adapter
hardware and by the version of OpenOCD you are using (including the
adapter's driver).
-
-If no transport has been selected and no @option{transport_name} is
-provided, @command{transport select} auto-selects the first transport
-supported by the debug adapter.
-
-@command{transport select} always returns the name of the session's selected
-transport, if any.
+When invoked with no transport name:
+@itemize @minus
+@item if no transport has been selected yet, it auto-selects the first transport supported by the debug adapter
+@item it returns the name of the session's selected transport
+@end itemize
@end deffn
@subsection JTAG Transport
diff --git a/src/transport/transport.c b/src/transport/transport.c
index 81d3d583b..bf306e731 100644
--- a/src/transport/transport.c
+++ b/src/transport/transport.c
@@ -278,7 +278,6 @@ COMMAND_HANDLER(handle_transport_select)
if (session) {
if (!strcmp(session->name, CMD_ARGV[0])) {
LOG_WARNING("Transport \"%s\" was already selected", session->name);
- command_print(CMD, "%s", session->name);
return ERROR_OK;
}
command_print(CMD, "Can't change session's transport after the initial selection was made");
@@ -301,7 +300,6 @@ COMMAND_HANDLER(handle_transport_select)
int retval = transport_select(CMD_CTX, CMD_ARGV[0]);
if (retval != ERROR_OK)
return retval;
- command_print(CMD, "%s", session->name);
return ERROR_OK;
}
}
-----------------------------------------------------------------------
Summary of changes:
doc/openocd.texi | 16 +++++++---------
src/transport/transport.c | 2 --
2 files changed, 7 insertions(+), 11 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-08-02 16:08:03
|
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 d5adab697fd8b65934acc2ffef105e9ab9804bcf (commit)
from 5b3d503e2e62d98ef107813af82bd573bda41239 (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 d5adab697fd8b65934acc2ffef105e9ab9804bcf
Author: Marc Schink <de...@za...>
Date: Sun Apr 21 20:00:28 2024 +0200
target/breakpoints: Fix 'orig_instr' output
The 'orig_instr' information of software breakpoints is incorrect
because buf_to_hex_str() expects the length of the buffer to be
converted in bits and not bytes.
Change-Id: I9a9ed383a8c25200d461b899749d5259ee4c6e3d
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8218
Reviewed-by: Antonio Borneo <bor...@gm...>
Tested-by: jenkins
diff --git a/src/target/target.c b/src/target/target.c
index bd2638f2d..b6159c72b 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -3921,7 +3921,7 @@ static int handle_bp_command_list(struct command_invocation *cmd)
while (breakpoint) {
if (breakpoint->type == BKPT_SOFT) {
char *buf = buf_to_hex_str(breakpoint->orig_instr,
- breakpoint->length);
+ breakpoint->length * 8);
command_print(cmd, "Software breakpoint(IVA): addr=" TARGET_ADDR_FMT ", len=0x%x, orig_instr=0x%s",
breakpoint->address,
breakpoint->length,
-----------------------------------------------------------------------
Summary of changes:
src/target/target.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-08-02 16:06: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 5b3d503e2e62d98ef107813af82bd573bda41239 (commit)
from 4cab20b599885885cdcba850af6b57310e695412 (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 5b3d503e2e62d98ef107813af82bd573bda41239
Author: Marc Schink <de...@za...>
Date: Wed Jul 24 20:56:38 2024 +0200
doc: Add 'jlink targetpower' command
Change-Id: I7e6c9e75f3c70675a3ea55fd5f0d7de1a35f2c4b
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8418
Reviewed-by: Antonio Borneo <bor...@gm...>
Tested-by: jenkins
diff --git a/doc/openocd.texi b/doc/openocd.texi
index a8a1892db..fa0ffc731 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -2958,6 +2958,11 @@ Display free device internal memory.
Set the JTAG command version to be used. Without argument, show the actual JTAG
command version.
@end deffn
+@deffn {Command} {jlink targetpower} [@option{0}|@option{1}|@option{on}|@option{off}]
+Switch the 5@ V target power supply on or off.
+Without argument, show the state of the target power supply.
+The target power supply is usually connected to pin 19 of the 20-pin connector.
+@end deffn
@deffn {Command} {jlink config}
Display the device configuration.
@end deffn
-----------------------------------------------------------------------
Summary of changes:
doc/openocd.texi | 5 +++++
1 file changed, 5 insertions(+)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-08-02 16:06:44
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via 4cab20b599885885cdcba850af6b57310e695412 (commit)
from fc0ec6cf0bf257e9304f9b57d4db8a22957e3755 (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 4cab20b599885885cdcba850af6b57310e695412
Author: Marc Schink <de...@za...>
Date: Wed Jul 24 20:39:57 2024 +0200
adapter/jlink: Allow to determine the target power state
Change-Id: I0b4f543e0ba0e48c43f78e32e4fa41d7dec9d7b8
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8417
Reviewed-by: Antonio Borneo <bor...@gm...>
Tested-by: jenkins
diff --git a/src/jtag/drivers/jlink.c b/src/jtag/drivers/jlink.c
index f9b500e6b..a94f3a4ab 100644
--- a/src/jtag/drivers/jlink.c
+++ b/src/jtag/drivers/jlink.c
@@ -1069,7 +1069,7 @@ COMMAND_HANDLER(jlink_handle_jlink_jtag_command)
COMMAND_HANDLER(jlink_handle_target_power_command)
{
- if (CMD_ARGC != 1)
+ if (CMD_ARGC > 1)
return ERROR_COMMAND_SYNTAX_ERROR;
if (!jaylink_has_cap(caps, JAYLINK_DEV_CAP_SET_TARGET_POWER)) {
@@ -1078,6 +1078,20 @@ COMMAND_HANDLER(jlink_handle_target_power_command)
return ERROR_OK;
}
+ if (!CMD_ARGC) {
+ uint32_t state;
+ int ret = jaylink_get_hardware_info(devh, JAYLINK_HW_INFO_TARGET_POWER,
+ &state);
+
+ if (ret != JAYLINK_OK) {
+ command_print(CMD, "Failed to retrieve target power state");
+ return ERROR_FAIL;
+ }
+
+ command_print(CMD, "%d", (bool)state);
+ return ERROR_OK;
+ }
+
bool enable;
COMMAND_PARSE_ON_OFF(CMD_ARGV[0], enable);
@@ -1859,7 +1873,7 @@ static const struct command_registration jlink_subcommand_handlers[] = {
.handler = &jlink_handle_target_power_command,
.mode = COMMAND_EXEC,
.help = "set the target power supply",
- .usage = "<0|1|on|off>"
+ .usage = "[0|1|on|off]"
},
{
.name = "freemem",
-----------------------------------------------------------------------
Summary of changes:
src/jtag/drivers/jlink.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-08-02 16:06:03
|
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 fc0ec6cf0bf257e9304f9b57d4db8a22957e3755 (commit)
from 2b6d63a44da445f601f53b1bf40c97199987cfc2 (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 fc0ec6cf0bf257e9304f9b57d4db8a22957e3755
Author: Marc Schink <de...@za...>
Date: Mon Jul 22 17:56:55 2024 +0200
adapter/jlink: Use COMMAND_PARSE_* instead of sscanf()
While at it, apply some coding style fixes.
Change-Id: I77a6917a045af733ebe9211ca338952dbd49c89b
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8416
Reviewed-by: Antonio Borneo <bor...@gm...>
Tested-by: jenkins
diff --git a/src/jtag/drivers/jlink.c b/src/jtag/drivers/jlink.c
index 21a5da887..f9b500e6b 100644
--- a/src/jtag/drivers/jlink.c
+++ b/src/jtag/drivers/jlink.c
@@ -961,23 +961,18 @@ static int jlink_reset_safe(int trst, int srst)
COMMAND_HANDLER(jlink_usb_command)
{
- int tmp;
-
if (CMD_ARGC != 1)
return ERROR_COMMAND_SYNTAX_ERROR;
- if (sscanf(CMD_ARGV[0], "%i", &tmp) != 1) {
- command_print(CMD, "Invalid USB address: %s", CMD_ARGV[0]);
- return ERROR_COMMAND_ARGUMENT_INVALID;
- }
+ unsigned int tmp;
+ COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], tmp);
- if (tmp < JAYLINK_USB_ADDRESS_0 || tmp > JAYLINK_USB_ADDRESS_3) {
+ if (tmp > JAYLINK_USB_ADDRESS_3) {
command_print(CMD, "Invalid USB address: %s", CMD_ARGV[0]);
return ERROR_COMMAND_ARGUMENT_INVALID;
}
usb_address = tmp;
-
use_usb_address = true;
return ERROR_OK;
@@ -1035,38 +1030,35 @@ COMMAND_HANDLER(jlink_handle_free_memory_command)
COMMAND_HANDLER(jlink_handle_jlink_jtag_command)
{
- int tmp;
- int version;
-
if (!CMD_ARGC) {
+ unsigned int version;
+
switch (jtag_command_version) {
- case JAYLINK_JTAG_VERSION_2:
- version = 2;
- break;
- case JAYLINK_JTAG_VERSION_3:
- version = 3;
- break;
- default:
- return ERROR_FAIL;
+ case JAYLINK_JTAG_VERSION_2:
+ version = 2;
+ break;
+ case JAYLINK_JTAG_VERSION_3:
+ version = 3;
+ break;
+ default:
+ return ERROR_FAIL;
}
- command_print(CMD, "JTAG command version: %i", version);
+ command_print(CMD, "JTAG command version: %u", version);
} else if (CMD_ARGC == 1) {
- if (sscanf(CMD_ARGV[0], "%i", &tmp) != 1) {
- command_print(CMD, "Invalid argument: %s", CMD_ARGV[0]);
- return ERROR_COMMAND_ARGUMENT_INVALID;
- }
+ uint8_t tmp;
+ COMMAND_PARSE_NUMBER(u8, CMD_ARGV[0], tmp);
switch (tmp) {
- case 2:
- jtag_command_version = JAYLINK_JTAG_VERSION_2;
- break;
- case 3:
- jtag_command_version = JAYLINK_JTAG_VERSION_3;
- break;
- default:
- command_print(CMD, "Invalid argument: %s", CMD_ARGV[0]);
- return ERROR_COMMAND_ARGUMENT_INVALID;
+ case 2:
+ jtag_command_version = JAYLINK_JTAG_VERSION_2;
+ break;
+ case 3:
+ jtag_command_version = JAYLINK_JTAG_VERSION_3;
+ break;
+ default:
+ command_print(CMD, "Invalid argument: %s", CMD_ARGV[0]);
+ return ERROR_COMMAND_ARGUMENT_INVALID;
}
} else {
return ERROR_COMMAND_SYNTAX_ERROR;
@@ -1077,9 +1069,6 @@ COMMAND_HANDLER(jlink_handle_jlink_jtag_command)
COMMAND_HANDLER(jlink_handle_target_power_command)
{
- int ret;
- int enable;
-
if (CMD_ARGC != 1)
return ERROR_COMMAND_SYNTAX_ERROR;
@@ -1089,16 +1078,10 @@ COMMAND_HANDLER(jlink_handle_target_power_command)
return ERROR_OK;
}
- if (!strcmp(CMD_ARGV[0], "on")) {
- enable = true;
- } else if (!strcmp(CMD_ARGV[0], "off")) {
- enable = false;
- } else {
- command_print(CMD, "Invalid argument: %s", CMD_ARGV[0]);
- return ERROR_FAIL;
- }
+ bool enable;
+ COMMAND_PARSE_ON_OFF(CMD_ARGV[0], enable);
- ret = jaylink_set_target_power(devh, enable);
+ int ret = jaylink_set_target_power(devh, enable);
if (ret != JAYLINK_OK) {
command_print(CMD, "jaylink_set_target_power() failed: %s",
@@ -1407,8 +1390,6 @@ static int config_trace(bool enabled, enum tpiu_pin_protocol pin_protocol,
COMMAND_HANDLER(jlink_handle_config_usb_address_command)
{
- uint8_t tmp;
-
if (!jaylink_has_cap(caps, JAYLINK_DEV_CAP_READ_CONFIG)) {
command_print(CMD, "Reading configuration is not supported by the "
"device");
@@ -1418,10 +1399,8 @@ COMMAND_HANDLER(jlink_handle_config_usb_address_command)
if (!CMD_ARGC) {
show_config_usb_address(CMD);
} else if (CMD_ARGC == 1) {
- if (sscanf(CMD_ARGV[0], "%" SCNd8, &tmp) != 1) {
- command_print(CMD, "Invalid USB address: %s", CMD_ARGV[0]);
- return ERROR_COMMAND_ARGUMENT_INVALID;
- }
+ uint8_t tmp;
+ COMMAND_PARSE_NUMBER(u8, CMD_ARGV[0], tmp);
if (tmp > JAYLINK_USB_ADDRESS_3) {
command_print(CMD, "Invalid USB address: %u", tmp);
@@ -1880,7 +1859,7 @@ static const struct command_registration jlink_subcommand_handlers[] = {
.handler = &jlink_handle_target_power_command,
.mode = COMMAND_EXEC,
.help = "set the target power supply",
- .usage = "<on|off>"
+ .usage = "<0|1|on|off>"
},
{
.name = "freemem",
-----------------------------------------------------------------------
Summary of changes:
src/jtag/drivers/jlink.c | 83 ++++++++++++++++++------------------------------
1 file changed, 31 insertions(+), 52 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-08-02 16:05:40
|
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 2b6d63a44da445f601f53b1bf40c97199987cfc2 (commit)
from 7d56407ba7b43fddbbce412de2d1eddb51c46bfa (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 2b6d63a44da445f601f53b1bf40c97199987cfc2
Author: Marc Schink <de...@za...>
Date: Mon Jul 22 09:30:42 2024 +0200
jtag: Use 'unsigned int' data type
This patch modifies as little code as possible in order to simplify the
review. Data types that are affected by these changes will be addresses
in following patches.
While at it, apply coding style fixes if these are not too extensive.
Change-Id: I364467b88f193f8387623a19e6994ef77899d117
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8414
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/jtag/commands.c b/src/jtag/commands.c
index a15af68db..1bca4e8df 100644
--- a/src/jtag/commands.c
+++ b/src/jtag/commands.c
@@ -178,9 +178,9 @@ enum scan_type jtag_scan_type(const struct scan_command *cmd)
return type;
}
-int jtag_scan_size(const struct scan_command *cmd)
+unsigned int jtag_scan_size(const struct scan_command *cmd)
{
- int bit_count = 0;
+ unsigned int bit_count = 0;
/* count bits in scan command */
for (unsigned int i = 0; i < cmd->num_fields; i++)
@@ -191,9 +191,7 @@ int jtag_scan_size(const struct scan_command *cmd)
int jtag_build_buffer(const struct scan_command *cmd, uint8_t **buffer)
{
- int bit_count = 0;
-
- bit_count = jtag_scan_size(cmd);
+ unsigned int bit_count = jtag_scan_size(cmd);
*buffer = calloc(1, DIV_ROUND_UP(bit_count, 8));
bit_count = 0;
diff --git a/src/jtag/commands.h b/src/jtag/commands.h
index 885e6a360..29fa8426e 100644
--- a/src/jtag/commands.h
+++ b/src/jtag/commands.h
@@ -157,7 +157,7 @@ struct jtag_command *jtag_command_queue_get(void);
void jtag_scan_field_clone(struct scan_field *dst, const struct scan_field *src);
enum scan_type jtag_scan_type(const struct scan_command *cmd);
-int jtag_scan_size(const struct scan_command *cmd);
+unsigned int jtag_scan_size(const struct scan_command *cmd);
int jtag_read_buffer(uint8_t *buffer, const struct scan_command *cmd);
int jtag_build_buffer(const struct scan_command *cmd, uint8_t **buffer);
diff --git a/src/jtag/core.c b/src/jtag/core.c
index 261de9861..9eae5e74b 100644
--- a/src/jtag/core.c
+++ b/src/jtag/core.c
@@ -39,7 +39,7 @@
#include "server/ipdbg.h"
/** The number of JTAG queue flushes (for profiling and debugging purposes). */
-static int jtag_flush_queue_count;
+static unsigned int jtag_flush_queue_count;
/* Sleep this # of ms after flushing the queue */
static int jtag_flush_queue_sleep;
@@ -92,10 +92,10 @@ static bool jtag_verify = true;
/* how long the OpenOCD should wait before attempting JTAG communication after reset lines
*deasserted (in ms) */
-static int adapter_nsrst_delay; /* default to no nSRST delay */
-static int jtag_ntrst_delay;/* default to no nTRST delay */
-static int adapter_nsrst_assert_width; /* width of assertion */
-static int jtag_ntrst_assert_width; /* width of assertion */
+static unsigned int adapter_nsrst_delay; /* default to no nSRST delay */
+static unsigned int jtag_ntrst_delay;/* default to no nTRST delay */
+static unsigned int adapter_nsrst_assert_width; /* width of assertion */
+static unsigned int jtag_ntrst_assert_width; /* width of assertion */
/**
* Contains a single callback along with a pointer that will be passed
@@ -186,10 +186,10 @@ struct jtag_tap *jtag_all_taps(void)
return __jtag_all_taps;
};
-unsigned jtag_tap_count(void)
+unsigned int jtag_tap_count(void)
{
struct jtag_tap *t = jtag_all_taps();
- unsigned n = 0;
+ unsigned int n = 0;
while (t) {
n++;
t = t->next_tap;
@@ -197,10 +197,10 @@ unsigned jtag_tap_count(void)
return n;
}
-unsigned jtag_tap_count_enabled(void)
+unsigned int jtag_tap_count_enabled(void)
{
struct jtag_tap *t = jtag_all_taps();
- unsigned n = 0;
+ unsigned int n = 0;
while (t) {
if (t->enabled)
n++;
@@ -499,7 +499,7 @@ void jtag_add_tlr(void)
*
* @todo Update naming conventions to stop assuming everything is JTAG.
*/
-int jtag_add_tms_seq(unsigned nbits, const uint8_t *seq, enum tap_state state)
+int jtag_add_tms_seq(unsigned int nbits, const uint8_t *seq, enum tap_state state)
{
int retval;
@@ -567,12 +567,12 @@ int jtag_add_statemove(tap_state_t goal_state)
/* nothing to do */;
else if (tap_is_state_stable(cur_state) && tap_is_state_stable(goal_state)) {
- unsigned tms_bits = tap_get_tms_path(cur_state, goal_state);
- unsigned tms_count = tap_get_tms_path_len(cur_state, goal_state);
+ unsigned int tms_bits = tap_get_tms_path(cur_state, goal_state);
+ unsigned int tms_count = tap_get_tms_path_len(cur_state, goal_state);
tap_state_t moves[8];
assert(tms_count < ARRAY_SIZE(moves));
- for (unsigned i = 0; i < tms_count; i++, tms_bits >>= 1) {
+ for (unsigned int i = 0; i < tms_count; i++, tms_bits >>= 1) {
bool bit = tms_bits & 1;
cur_state = tap_state_transition(cur_state, bit);
@@ -1029,7 +1029,7 @@ void jtag_execute_queue_noclear(void)
}
}
-int jtag_get_flush_queue_count(void)
+unsigned int jtag_get_flush_queue_count(void)
{
return jtag_flush_queue_count;
}
@@ -1081,7 +1081,7 @@ void jtag_sleep(uint32_t us)
/* a larger IR length than we ever expect to autoprobe */
#define JTAG_IRLEN_MAX 60
-static int jtag_examine_chain_execute(uint8_t *idcode_buffer, unsigned num_idcode)
+static int jtag_examine_chain_execute(uint8_t *idcode_buffer, unsigned int num_idcode)
{
struct scan_field field = {
.num_bits = num_idcode * 32,
@@ -1090,7 +1090,7 @@ static int jtag_examine_chain_execute(uint8_t *idcode_buffer, unsigned num_idcod
};
/* initialize to the end of chain ID value */
- for (unsigned i = 0; i < num_idcode; i++)
+ for (unsigned int i = 0; i < num_idcode; i++)
buf_set_u32(idcode_buffer, i * 32, 32, END_OF_CHAIN_FLAG);
jtag_add_plain_dr_scan(field.num_bits, field.out_value, field.in_value, TAP_DRPAUSE);
@@ -1098,12 +1098,12 @@ static int jtag_examine_chain_execute(uint8_t *idcode_buffer, unsigned num_idcod
return jtag_execute_queue();
}
-static bool jtag_examine_chain_check(uint8_t *idcodes, unsigned count)
+static bool jtag_examine_chain_check(uint8_t *idcodes, unsigned int count)
{
uint8_t zero_check = 0x0;
uint8_t one_check = 0xff;
- for (unsigned i = 0; i < count * 4; i++) {
+ for (unsigned int i = 0; i < count * 4; i++) {
zero_check |= idcodes[i];
one_check &= idcodes[i];
}
@@ -1158,7 +1158,8 @@ static bool jtag_idcode_is_final(uint32_t idcode)
* with the JTAG chain earlier, gives more helpful/explicit error messages.
* Returns TRUE iff garbage was found.
*/
-static bool jtag_examine_chain_end(uint8_t *idcodes, unsigned count, unsigned max)
+static bool jtag_examine_chain_end(uint8_t *idcodes, unsigned int count,
+ unsigned int max)
{
bool triggered = false;
for (; count < max - 31; count += 32) {
@@ -1185,26 +1186,26 @@ static bool jtag_examine_chain_match_tap(const struct jtag_tap *tap)
uint32_t idcode = tap->idcode & mask;
/* Loop over the expected identification codes and test for a match */
- for (unsigned ii = 0; ii < tap->expected_ids_cnt; ii++) {
- uint32_t expected = tap->expected_ids[ii] & mask;
+ for (unsigned int i = 0; i < tap->expected_ids_cnt; i++) {
+ uint32_t expected = tap->expected_ids[i] & mask;
if (idcode == expected)
return true;
/* treat "-expected-id 0" as a "don't-warn" wildcard */
- if (tap->expected_ids[ii] == 0)
+ if (tap->expected_ids[i] == 0)
return true;
}
/* If none of the expected ids matched, warn */
jtag_examine_chain_display(LOG_LVL_WARNING, "UNEXPECTED",
tap->dotted_name, tap->idcode);
- for (unsigned ii = 0; ii < tap->expected_ids_cnt; ii++) {
+ for (unsigned int i = 0; i < tap->expected_ids_cnt; i++) {
char msg[32];
- snprintf(msg, sizeof(msg), "expected %u of %u", ii + 1, tap->expected_ids_cnt);
+ snprintf(msg, sizeof(msg), "expected %u of %u", i + 1, tap->expected_ids_cnt);
jtag_examine_chain_display(LOG_LVL_ERROR, msg,
- tap->dotted_name, tap->expected_ids[ii]);
+ tap->dotted_name, tap->expected_ids[i]);
}
return false;
}
@@ -1215,7 +1216,7 @@ static bool jtag_examine_chain_match_tap(const struct jtag_tap *tap)
static int jtag_examine_chain(void)
{
int retval;
- unsigned max_taps = jtag_tap_count();
+ unsigned int max_taps = jtag_tap_count();
/* Autoprobe up to this many. */
if (max_taps < JTAG_MAX_AUTO_TAPS)
@@ -1243,9 +1244,9 @@ static int jtag_examine_chain(void)
/* Point at the 1st predefined tap, if any */
struct jtag_tap *tap = jtag_tap_next_enabled(NULL);
- unsigned bit_count = 0;
- unsigned autocount = 0;
- for (unsigned i = 0; i < max_taps; i++) {
+ unsigned int bit_count = 0;
+ unsigned int autocount = 0;
+ for (unsigned int i = 0; i < max_taps; i++) {
assert(bit_count < max_taps * 32);
uint32_t idcode = buf_get_u32(idcode_buffer, bit_count, 32);
@@ -1445,8 +1446,8 @@ done:
void jtag_tap_init(struct jtag_tap *tap)
{
- unsigned ir_len_bits;
- unsigned ir_len_bytes;
+ unsigned int ir_len_bits;
+ unsigned int ir_len_bytes;
/* if we're autoprobing, cope with potentially huge ir_length */
ir_len_bits = tap->ir_length ? tap->ir_length : JTAG_IRLEN_MAX;
@@ -1749,37 +1750,36 @@ int jtag_get_srst(void)
return jtag_srst == 1;
}
-void jtag_set_nsrst_delay(unsigned delay)
+void jtag_set_nsrst_delay(unsigned int delay)
{
adapter_nsrst_delay = delay;
}
-unsigned jtag_get_nsrst_delay(void)
+unsigned int jtag_get_nsrst_delay(void)
{
return adapter_nsrst_delay;
}
-void jtag_set_ntrst_delay(unsigned delay)
+void jtag_set_ntrst_delay(unsigned int delay)
{
jtag_ntrst_delay = delay;
}
-unsigned jtag_get_ntrst_delay(void)
+unsigned int jtag_get_ntrst_delay(void)
{
return jtag_ntrst_delay;
}
-
-void jtag_set_nsrst_assert_width(unsigned delay)
+void jtag_set_nsrst_assert_width(unsigned int delay)
{
adapter_nsrst_assert_width = delay;
}
-unsigned jtag_get_nsrst_assert_width(void)
+unsigned int jtag_get_nsrst_assert_width(void)
{
return adapter_nsrst_assert_width;
}
-void jtag_set_ntrst_assert_width(unsigned delay)
+void jtag_set_ntrst_assert_width(unsigned int delay)
{
jtag_ntrst_assert_width = delay;
}
-unsigned jtag_get_ntrst_assert_width(void)
+unsigned int jtag_get_ntrst_assert_width(void)
{
return jtag_ntrst_assert_width;
}
diff --git a/src/jtag/drivers/vdebug.c b/src/jtag/drivers/vdebug.c
index 31f50b561..691e576e5 100644
--- a/src/jtag/drivers/vdebug.c
+++ b/src/jtag/drivers/vdebug.c
@@ -970,8 +970,8 @@ static int vdebug_jtag_scan(struct scan_command *cmd, uint8_t f_flush)
uint8_t num_pre = tap_get_tms_path_len(cur, state);
uint8_t tms_post = tap_get_tms_path(state, cmd->end_state);
uint8_t num_post = tap_get_tms_path_len(state, cmd->end_state);
- int num_bits = jtag_scan_size(cmd);
- LOG_DEBUG_IO("scan len:%d fields:%u ir/!dr:%d state cur:%x end:%x",
+ const unsigned int num_bits = jtag_scan_size(cmd);
+ LOG_DEBUG_IO("scan len:%u fields:%u ir/!dr:%d state cur:%x end:%x",
num_bits, cmd->num_fields, cmd->ir_scan, cur, cmd->end_state);
for (unsigned int i = 0; i < cmd->num_fields; i++) {
uint8_t cur_num_pre = i == 0 ? num_pre : 0;
diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h
index f0a0fe5e1..b9d37b32a 100644
--- a/src/jtag/jtag.h
+++ b/src/jtag/jtag.h
@@ -152,8 +152,8 @@ struct jtag_tap *jtag_tap_by_string(const char *dotted_name);
struct jtag_tap *jtag_tap_by_jim_obj(Jim_Interp *interp, Jim_Obj *obj);
struct jtag_tap *jtag_tap_by_position(unsigned int abs_position);
struct jtag_tap *jtag_tap_next_enabled(struct jtag_tap *p);
-unsigned jtag_tap_count_enabled(void);
-unsigned jtag_tap_count(void);
+unsigned int jtag_tap_count_enabled(void);
+unsigned int jtag_tap_count(void);
/*
* - TRST_ASSERTED triggers two sets of callbacks, after operations to
@@ -229,17 +229,17 @@ enum reset_types {
enum reset_types jtag_get_reset_config(void);
void jtag_set_reset_config(enum reset_types type);
-void jtag_set_nsrst_delay(unsigned delay);
-unsigned jtag_get_nsrst_delay(void);
+void jtag_set_nsrst_delay(unsigned int delay);
+unsigned int jtag_get_nsrst_delay(void);
-void jtag_set_ntrst_delay(unsigned delay);
-unsigned jtag_get_ntrst_delay(void);
+void jtag_set_ntrst_delay(unsigned int delay);
+unsigned int jtag_get_ntrst_delay(void);
-void jtag_set_nsrst_assert_width(unsigned delay);
-unsigned jtag_get_nsrst_assert_width(void);
+void jtag_set_nsrst_assert_width(unsigned int delay);
+unsigned int jtag_get_nsrst_assert_width(void);
-void jtag_set_ntrst_assert_width(unsigned delay);
-unsigned jtag_get_ntrst_assert_width(void);
+void jtag_set_ntrst_assert_width(unsigned int delay);
+unsigned int jtag_get_ntrst_assert_width(void);
/** @returns The current state of TRST. */
int jtag_get_trst(void);
@@ -488,7 +488,7 @@ void jtag_add_reset(int req_tlr_or_trst, int srst);
void jtag_add_sleep(uint32_t us);
-int jtag_add_tms_seq(unsigned nbits, const uint8_t *seq, enum tap_state t);
+int jtag_add_tms_seq(unsigned int nbits, const uint8_t *seq, enum tap_state t);
/**
* Function jtag_add_clocks
@@ -523,7 +523,7 @@ int jtag_execute_queue(void);
void jtag_execute_queue_noclear(void);
/** @returns the number of times the scan queue has been flushed */
-int jtag_get_flush_queue_count(void);
+unsigned int jtag_get_flush_queue_count(void);
/** Report Tcl event to all TAPs */
void jtag_notify_event(enum jtag_event);
diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c
index 4bfbeeb42..10a7dd3f8 100644
--- a/src/jtag/tcl.c
+++ b/src/jtag/tcl.c
@@ -212,8 +212,8 @@ COMMAND_HANDLER(handle_jtag_flush_count)
if (CMD_ARGC != 0)
return ERROR_COMMAND_SYNTAX_ERROR;
- int count = jtag_get_flush_queue_count();
- command_print_sameline(CMD, "%d", count);
+ const unsigned int count = jtag_get_flush_queue_count();
+ command_print_sameline(CMD, "%u", count);
return ERROR_OK;
}
-----------------------------------------------------------------------
Summary of changes:
src/jtag/commands.c | 8 ++---
src/jtag/commands.h | 2 +-
src/jtag/core.c | 80 +++++++++++++++++++++++------------------------
src/jtag/drivers/vdebug.c | 4 +--
src/jtag/jtag.h | 24 +++++++-------
src/jtag/tcl.c | 4 +--
6 files changed, 60 insertions(+), 62 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-08-02 16:05:28
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via 7d56407ba7b43fddbbce412de2d1eddb51c46bfa (commit)
from 9ef59daef00fbf79985c2f4801c55e6116d475d3 (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 7d56407ba7b43fddbbce412de2d1eddb51c46bfa
Author: Marc Schink <de...@za...>
Date: Sun Jul 21 20:28:17 2024 +0200
jtag: Use 'unsigned int' for 'scan_field.num_bits'
This patch modifies as little code as possible in order to simplify the
review. Data types that are affected by these changes will be addresses
in following patches.
While at it, apply coding style fixes if these are not too extensive.
Change-Id: Idcbbbbbea2705512201eb326c3e6cef110dbc674
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8413
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/jtag/commands.c b/src/jtag/commands.c
index c679c56c5..a15af68db 100644
--- a/src/jtag/commands.c
+++ b/src/jtag/commands.c
@@ -210,14 +210,14 @@ int jtag_build_buffer(const struct scan_command *cmd, uint8_t **buffer)
? DEBUG_JTAG_IOZ
: cmd->fields[i].num_bits);
- LOG_DEBUG("fields[%u].out_value[%i]: 0x%s", i,
+ LOG_DEBUG("fields[%u].out_value[%u]: 0x%s", i,
cmd->fields[i].num_bits, char_buf);
free(char_buf);
}
buf_set_buf(cmd->fields[i].out_value, 0, *buffer,
bit_count, cmd->fields[i].num_bits);
} else {
- LOG_DEBUG_IO("fields[%u].out_value[%i]: NULL",
+ LOG_DEBUG_IO("fields[%u].out_value[%u]: NULL",
i, cmd->fields[i].num_bits);
}
@@ -242,7 +242,7 @@ int jtag_read_buffer(uint8_t *buffer, const struct scan_command *cmd)
* are specified we don't have to examine this field
*/
if (cmd->fields[i].in_value) {
- int num_bits = cmd->fields[i].num_bits;
+ const unsigned int num_bits = cmd->fields[i].num_bits;
uint8_t *captured = buf_set_buf(buffer, bit_count,
malloc(DIV_ROUND_UP(num_bits, 8)), 0, num_bits);
@@ -252,7 +252,7 @@ int jtag_read_buffer(uint8_t *buffer, const struct scan_command *cmd)
? DEBUG_JTAG_IOZ
: num_bits);
- LOG_DEBUG("fields[%u].in_value[%i]: 0x%s",
+ LOG_DEBUG("fields[%u].in_value[%u]: 0x%s",
i, num_bits, char_buf);
free(char_buf);
}
diff --git a/src/jtag/core.c b/src/jtag/core.c
index a8190dd23..261de9861 100644
--- a/src/jtag/core.c
+++ b/src/jtag/core.c
@@ -964,12 +964,12 @@ int default_interface_jtag_execute_queue(void)
struct scan_field *field = cmd->cmd.scan->fields + i;
if (field->out_value) {
char *str = buf_to_hex_str(field->out_value, field->num_bits);
- LOG_DEBUG_IO(" %db out: %s", field->num_bits, str);
+ LOG_DEBUG_IO(" %ub out: %s", field->num_bits, str);
free(str);
}
if (field->in_value) {
char *str = buf_to_hex_str(field->in_value, field->num_bits);
- LOG_DEBUG_IO(" %db in: %s", field->num_bits, str);
+ LOG_DEBUG_IO(" %ub in: %s", field->num_bits, str);
free(str);
}
}
@@ -1337,7 +1337,7 @@ static int jtag_validate_ircapture(void)
int retval;
/* when autoprobing, accommodate huge IR lengths */
- int total_ir_length = 0;
+ unsigned int total_ir_length = 0;
for (tap = jtag_tap_next_enabled(NULL); tap; tap = jtag_tap_next_enabled(tap)) {
if (tap->ir_length == 0)
total_ir_length += JTAG_IRLEN_MAX;
diff --git a/src/jtag/drivers/bitq.c b/src/jtag/drivers/bitq.c
index 6816b9b86..ef870e648 100644
--- a/src/jtag/drivers/bitq.c
+++ b/src/jtag/drivers/bitq.c
@@ -19,7 +19,7 @@ struct bitq_interface *bitq_interface; /* low level bit queue interface */
struct bitq_state {
struct jtag_command *cmd; /* command currently processed */
unsigned int field_idx; /* index of field currently being processed */
- int bit_pos; /* position of bit currently being processed */
+ unsigned int bit_pos; /* position of bit currently being processed */
int status; /* processing status */
};
static struct bitq_state bitq_in_state;
@@ -142,11 +142,10 @@ static void bitq_runtest(unsigned int num_cycles)
static void bitq_scan_field(struct scan_field *field, int do_pause)
{
- int bit_cnt;
int tdo_req;
const uint8_t *out_ptr;
- uint8_t out_mask;
+ uint8_t out_mask;
if (field->in_value)
tdo_req = 1;
@@ -155,7 +154,7 @@ static void bitq_scan_field(struct scan_field *field, int do_pause)
if (!field->out_value) {
/* just send zeros and request data from TDO */
- for (bit_cnt = field->num_bits; bit_cnt > 1; bit_cnt--)
+ for (unsigned int i = 0; i < (field->num_bits - 1); i++)
bitq_io(0, 0, tdo_req);
bitq_io(do_pause, 0, tdo_req);
@@ -163,7 +162,7 @@ static void bitq_scan_field(struct scan_field *field, int do_pause)
/* send data, and optionally request TDO */
out_mask = 0x01;
out_ptr = field->out_value;
- for (bit_cnt = field->num_bits; bit_cnt > 1; bit_cnt--) {
+ for (unsigned int i = 0; i < (field->num_bits - 1); i++) {
bitq_io(0, ((*out_ptr) & out_mask) != 0, tdo_req);
if (out_mask == 0x80) {
out_mask = 0x01;
diff --git a/src/jtag/drivers/cmsis_dap.c b/src/jtag/drivers/cmsis_dap.c
index 243b01c63..a6dcfcd3d 100644
--- a/src/jtag/drivers/cmsis_dap.c
+++ b/src/jtag/drivers/cmsis_dap.c
@@ -1772,11 +1772,11 @@ static void cmsis_dap_execute_scan(struct jtag_command *cmd)
cmsis_dap_end_state(cmd->cmd.scan->end_state);
struct scan_field *field = cmd->cmd.scan->fields;
- unsigned scan_size = 0;
+ unsigned int scan_size = 0;
for (unsigned int i = 0; i < cmd->cmd.scan->num_fields; i++, field++) {
scan_size += field->num_bits;
- LOG_DEBUG_IO("%s%s field %u/%u %d bits",
+ LOG_DEBUG_IO("%s%s field %u/%u %u bits",
field->in_value ? "in" : "",
field->out_value ? "out" : "",
i,
diff --git a/src/jtag/drivers/ftdi.c b/src/jtag/drivers/ftdi.c
index 4f253fa6d..82117f12c 100644
--- a/src/jtag/drivers/ftdi.c
+++ b/src/jtag/drivers/ftdi.c
@@ -451,7 +451,7 @@ static void ftdi_execute_scan(struct jtag_command *cmd)
for (unsigned int i = 0; i < cmd->cmd.scan->num_fields; i++, field++) {
scan_size += field->num_bits;
- LOG_DEBUG_IO("%s%s field %u/%u %d bits",
+ LOG_DEBUG_IO("%s%s field %u/%u %u bits",
field->in_value ? "in" : "",
field->out_value ? "out" : "",
i,
diff --git a/src/jtag/drivers/jlink.c b/src/jtag/drivers/jlink.c
index ff3916735..21a5da887 100644
--- a/src/jtag/drivers/jlink.c
+++ b/src/jtag/drivers/jlink.c
@@ -183,7 +183,7 @@ static void jlink_execute_scan(struct jtag_command *cmd)
for (unsigned int i = 0; i < cmd->cmd.scan->num_fields; i++, field++) {
scan_size += field->num_bits;
- LOG_DEBUG_IO("%s%s field %u/%u %d bits",
+ LOG_DEBUG_IO("%s%s field %u/%u %u bits",
field->in_value ? "in" : "",
field->out_value ? "out" : "",
i,
diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h
index 520b5b8c0..f0a0fe5e1 100644
--- a/src/jtag/jtag.h
+++ b/src/jtag/jtag.h
@@ -86,7 +86,7 @@ extern tap_state_t cmd_queue_cur_state;
*/
struct scan_field {
/** The number of bits this field specifies */
- int num_bits;
+ unsigned int num_bits;
/** A pointer to value to be scanned into the device */
const uint8_t *out_value;
/** A pointer to a 32-bit memory location for data scanned out */
diff --git a/src/target/riscv/batch.c b/src/target/riscv/batch.c
index d39967e4d..d4bdadf17 100644
--- a/src/target/riscv/batch.c
+++ b/src/target/riscv/batch.c
@@ -211,12 +211,12 @@ void dump_field(int idle, const struct scan_field *field)
log_printf_lf(LOG_LVL_DEBUG,
__FILE__, __LINE__, __PRETTY_FUNCTION__,
- "%db %s %08x @%02x -> %s %08x @%02x; %di",
+ "%ub %s %08x @%02x -> %s %08x @%02x; %di",
field->num_bits, op_string[out_op], out_data, out_address,
status_string[in_op], in_data, in_address, idle);
} else {
log_printf_lf(LOG_LVL_DEBUG,
- __FILE__, __LINE__, __PRETTY_FUNCTION__, "%db %s %08x @%02x -> ?; %di",
+ __FILE__, __LINE__, __PRETTY_FUNCTION__, "%ub %s %08x @%02x -> ?; %di",
field->num_bits, op_string[out_op], out_data, out_address, idle);
}
}
diff --git a/src/target/riscv/riscv-011.c b/src/target/riscv/riscv-011.c
index be296cdd8..565721c28 100644
--- a/src/target/riscv/riscv-011.c
+++ b/src/target/riscv/riscv-011.c
@@ -412,7 +412,7 @@ static void dump_field(const struct scan_field *field)
log_printf_lf(LOG_LVL_DEBUG,
__FILE__, __LINE__, "scan",
- "%db %s %c%c:%08x @%02x -> %s %c%c:%08x @%02x",
+ "%ub %s %c%c:%08x @%02x -> %s %c%c:%08x @%02x",
field->num_bits,
op_string[out_op], out_interrupt, out_haltnot, out_data,
out_address,
diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c
index 0aa82031c..dbf9aad1d 100644
--- a/src/target/riscv/riscv-013.c
+++ b/src/target/riscv/riscv-013.c
@@ -389,7 +389,7 @@ static void dump_field(int idle, const struct scan_field *field)
log_printf_lf(LOG_LVL_DEBUG,
__FILE__, __LINE__, "scan",
- "%db %s %08x @%02x -> %s %08x @%02x; %di",
+ "%ub %s %08x @%02x -> %s %08x @%02x; %di",
field->num_bits, op_string[out_op], out_data, out_address,
status_string[in_op], in_data, in_address, idle);
-----------------------------------------------------------------------
Summary of changes:
src/jtag/commands.c | 8 ++++----
src/jtag/core.c | 6 +++---
src/jtag/drivers/bitq.c | 9 ++++-----
src/jtag/drivers/cmsis_dap.c | 4 ++--
src/jtag/drivers/ftdi.c | 2 +-
src/jtag/drivers/jlink.c | 2 +-
src/jtag/jtag.h | 2 +-
src/target/riscv/batch.c | 4 ++--
src/target/riscv/riscv-011.c | 2 +-
src/target/riscv/riscv-013.c | 2 +-
10 files changed, 20 insertions(+), 21 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-08-02 16:04:53
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via 9ef59daef00fbf79985c2f4801c55e6116d475d3 (commit)
from 0847a4d7fb9809a9bb36ba0965f43cb9d43ca2f3 (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 9ef59daef00fbf79985c2f4801c55e6116d475d3
Author: Marc Schink <de...@za...>
Date: Sun Jul 21 17:43:08 2024 +0200
target/avrt: Remove unused parameter 'rti'
Change-Id: Ib6957b89190188f5c15fadc3d4036709f19a6cea
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8412
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/target/avrt.c b/src/target/avrt.c
index ccce7e5e5..8886a4677 100644
--- a/src/target/avrt.c
+++ b/src/target/avrt.c
@@ -31,10 +31,10 @@ static int avr_assert_reset(struct target *target);
static int avr_deassert_reset(struct target *target);
/* IR and DR functions */
-static int mcu_write_ir(struct jtag_tap *tap, uint8_t *ir_in, uint8_t *ir_out, int ir_len, int rti);
-static int mcu_write_dr(struct jtag_tap *tap, uint8_t *dr_in, uint8_t *dr_out, int dr_len, int rti);
-static int mcu_write_ir_u8(struct jtag_tap *tap, uint8_t *ir_in, uint8_t ir_out, int ir_len, int rti);
-static int mcu_write_dr_u32(struct jtag_tap *tap, uint32_t *ir_in, uint32_t ir_out, int dr_len, int rti);
+static int mcu_write_ir(struct jtag_tap *tap, uint8_t *ir_in, uint8_t *ir_out, int ir_len);
+static int mcu_write_dr(struct jtag_tap *tap, uint8_t *dr_in, uint8_t *dr_out, int dr_len);
+static int mcu_write_ir_u8(struct jtag_tap *tap, uint8_t *ir_in, uint8_t ir_out, int ir_len);
+static int mcu_write_dr_u32(struct jtag_tap *tap, uint32_t *ir_in, uint32_t ir_out, int dr_len);
struct target_type avr_target = {
.name = "avr",
@@ -137,17 +137,17 @@ static int avr_deassert_reset(struct target *target)
int avr_jtag_senddat(struct jtag_tap *tap, uint32_t *dr_in, uint32_t dr_out,
int len)
{
- return mcu_write_dr_u32(tap, dr_in, dr_out, len, 1);
+ return mcu_write_dr_u32(tap, dr_in, dr_out, len);
}
int avr_jtag_sendinstr(struct jtag_tap *tap, uint8_t *ir_in, uint8_t ir_out)
{
- return mcu_write_ir_u8(tap, ir_in, ir_out, AVR_JTAG_INS_LEN, 1);
+ return mcu_write_ir_u8(tap, ir_in, ir_out, AVR_JTAG_INS_LEN);
}
/* IR and DR functions */
static int mcu_write_ir(struct jtag_tap *tap, uint8_t *ir_in, uint8_t *ir_out,
- int ir_len, int rti)
+ int ir_len)
{
if (!tap) {
LOG_ERROR("invalid tap");
@@ -166,7 +166,7 @@ static int mcu_write_ir(struct jtag_tap *tap, uint8_t *ir_in, uint8_t *ir_out,
}
static int mcu_write_dr(struct jtag_tap *tap, uint8_t *dr_in, uint8_t *dr_out,
- int dr_len, int rti)
+ int dr_len)
{
if (!tap) {
LOG_ERROR("invalid tap");
@@ -181,27 +181,27 @@ static int mcu_write_dr(struct jtag_tap *tap, uint8_t *dr_in, uint8_t *dr_out,
}
static int mcu_write_ir_u8(struct jtag_tap *tap, uint8_t *ir_in,
- uint8_t ir_out, int ir_len, int rti)
+ uint8_t ir_out, int ir_len)
{
if (ir_len > 8) {
LOG_ERROR("ir_len overflow, maximum is 8");
return ERROR_FAIL;
}
- mcu_write_ir(tap, ir_in, &ir_out, ir_len, rti);
+ mcu_write_ir(tap, ir_in, &ir_out, ir_len);
return ERROR_OK;
}
static int mcu_write_dr_u32(struct jtag_tap *tap, uint32_t *dr_in,
- uint32_t dr_out, int dr_len, int rti)
+ uint32_t dr_out, int dr_len)
{
if (dr_len > 32) {
LOG_ERROR("dr_len overflow, maximum is 32");
return ERROR_FAIL;
}
- mcu_write_dr(tap, (uint8_t *)dr_in, (uint8_t *)&dr_out, dr_len, rti);
+ mcu_write_dr(tap, (uint8_t *)dr_in, (uint8_t *)&dr_out, dr_len);
return ERROR_OK;
}
-----------------------------------------------------------------------
Summary of changes:
src/target/avrt.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-08-02 16:04:03
|
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 0847a4d7fb9809a9bb36ba0965f43cb9d43ca2f3 (commit)
from 42450345dd0cc2eb9fb18d8f794a6b57107bb242 (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 0847a4d7fb9809a9bb36ba0965f43cb9d43ca2f3
Author: Marc Schink <de...@za...>
Date: Wed Jul 17 17:35:42 2024 +0200
jtag/commands: Use 'unsigned int' data type
This patch modifies as little code as possible in order to simplify the
review. Data types that are affected by these changes will be addresses
in following patches.
While at it, apply coding style fixes if these are not too extensive.
Change-Id: Ie048b3d472f546fecb6733f17f9d0f17fda40187
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8404
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/jtag/commands.c b/src/jtag/commands.c
index a60684c88..c679c56c5 100644
--- a/src/jtag/commands.c
+++ b/src/jtag/commands.c
@@ -166,10 +166,9 @@ void jtag_scan_field_clone(struct scan_field *dst, const struct scan_field *src)
enum scan_type jtag_scan_type(const struct scan_command *cmd)
{
- int i;
int type = 0;
- for (i = 0; i < cmd->num_fields; i++) {
+ for (unsigned int i = 0; i < cmd->num_fields; i++) {
if (cmd->fields[i].in_value)
type |= SCAN_IN;
if (cmd->fields[i].out_value)
@@ -182,10 +181,9 @@ enum scan_type jtag_scan_type(const struct scan_command *cmd)
int jtag_scan_size(const struct scan_command *cmd)
{
int bit_count = 0;
- int i;
/* count bits in scan command */
- for (i = 0; i < cmd->num_fields; i++)
+ for (unsigned int i = 0; i < cmd->num_fields; i++)
bit_count += cmd->fields[i].num_bits;
return bit_count;
@@ -194,18 +192,17 @@ int jtag_scan_size(const struct scan_command *cmd)
int jtag_build_buffer(const struct scan_command *cmd, uint8_t **buffer)
{
int bit_count = 0;
- int i;
bit_count = jtag_scan_size(cmd);
*buffer = calloc(1, DIV_ROUND_UP(bit_count, 8));
bit_count = 0;
- LOG_DEBUG_IO("%s num_fields: %i",
+ LOG_DEBUG_IO("%s num_fields: %u",
cmd->ir_scan ? "IRSCAN" : "DRSCAN",
cmd->num_fields);
- for (i = 0; i < cmd->num_fields; i++) {
+ for (unsigned int i = 0; i < cmd->num_fields; i++) {
if (cmd->fields[i].out_value) {
if (LOG_LEVEL_IS(LOG_LVL_DEBUG_IO)) {
char *char_buf = buf_to_hex_str(cmd->fields[i].out_value,
@@ -213,14 +210,14 @@ int jtag_build_buffer(const struct scan_command *cmd, uint8_t **buffer)
? DEBUG_JTAG_IOZ
: cmd->fields[i].num_bits);
- LOG_DEBUG("fields[%i].out_value[%i]: 0x%s", i,
+ LOG_DEBUG("fields[%u].out_value[%i]: 0x%s", i,
cmd->fields[i].num_bits, char_buf);
free(char_buf);
}
buf_set_buf(cmd->fields[i].out_value, 0, *buffer,
bit_count, cmd->fields[i].num_bits);
} else {
- LOG_DEBUG_IO("fields[%i].out_value[%i]: NULL",
+ LOG_DEBUG_IO("fields[%u].out_value[%i]: NULL",
i, cmd->fields[i].num_bits);
}
@@ -234,14 +231,13 @@ int jtag_build_buffer(const struct scan_command *cmd, uint8_t **buffer)
int jtag_read_buffer(uint8_t *buffer, const struct scan_command *cmd)
{
- int i;
int bit_count = 0;
int retval;
/* we return ERROR_OK, unless a check fails, or a handler reports a problem */
retval = ERROR_OK;
- for (i = 0; i < cmd->num_fields; i++) {
+ for (unsigned int i = 0; i < cmd->num_fields; i++) {
/* if neither in_value nor in_handler
* are specified we don't have to examine this field
*/
@@ -256,7 +252,7 @@ int jtag_read_buffer(uint8_t *buffer, const struct scan_command *cmd)
? DEBUG_JTAG_IOZ
: num_bits);
- LOG_DEBUG("fields[%i].in_value[%i]: 0x%s",
+ LOG_DEBUG("fields[%u].in_value[%i]: 0x%s",
i, num_bits, char_buf);
free(char_buf);
}
diff --git a/src/jtag/commands.h b/src/jtag/commands.h
index 825907733..885e6a360 100644
--- a/src/jtag/commands.h
+++ b/src/jtag/commands.h
@@ -36,7 +36,7 @@ struct scan_command {
/** instruction/not data scan */
bool ir_scan;
/** number of fields in *fields array */
- int num_fields;
+ unsigned int num_fields;
/** pointer to an array of data scan fields */
struct scan_field *fields;
/** state in which JTAG commands should finish */
@@ -50,14 +50,14 @@ struct statemove_command {
struct pathmove_command {
/** number of states in *path */
- int num_states;
+ unsigned int num_states;
/** states that have to be passed */
tap_state_t *path;
};
struct runtest_command {
/** number of cycles to spend in Run-Test/Idle state */
- int num_cycles;
+ unsigned int num_cycles;
/** state in which JTAG commands should finish */
tap_state_t end_state;
};
@@ -65,7 +65,7 @@ struct runtest_command {
struct stableclocks_command {
/** number of clock cycles that should be sent */
- int num_cycles;
+ unsigned int num_cycles;
};
@@ -100,7 +100,7 @@ struct sleep_command {
*/
struct tms_command {
/** How many bits should be clocked out. */
- unsigned num_bits;
+ unsigned int num_bits;
/** The bits to clock out; the LSB is bit 0 of bits[0]. */
const uint8_t *bits;
};
diff --git a/src/jtag/core.c b/src/jtag/core.c
index 9aa755769..a8190dd23 100644
--- a/src/jtag/core.c
+++ b/src/jtag/core.c
@@ -514,7 +514,7 @@ int jtag_add_tms_seq(unsigned nbits, const uint8_t *seq, enum tap_state state)
return retval;
}
-void jtag_add_pathmove(int num_states, const tap_state_t *path)
+void jtag_add_pathmove(unsigned int num_states, const tap_state_t *path)
{
tap_state_t cur_state = cmd_queue_cur_state;
@@ -525,7 +525,7 @@ void jtag_add_pathmove(int num_states, const tap_state_t *path)
return;
}
- for (int i = 0; i < num_states; i++) {
+ for (unsigned int i = 0; i < num_states; i++) {
if (path[i] == TAP_RESET) {
LOG_ERROR("BUG: TAP_RESET is not a valid state for pathmove sequences");
jtag_set_error(ERROR_JTAG_STATE_INVALID);
@@ -589,14 +589,14 @@ int jtag_add_statemove(tap_state_t goal_state)
return ERROR_OK;
}
-void jtag_add_runtest(int num_cycles, tap_state_t state)
+void jtag_add_runtest(unsigned int num_cycles, tap_state_t state)
{
jtag_prelude(state);
jtag_set_error(interface_jtag_add_runtest(num_cycles, state));
}
-void jtag_add_clocks(int num_cycles)
+void jtag_add_clocks(unsigned int num_cycles)
{
if (!tap_is_state_stable(cmd_queue_cur_state)) {
LOG_ERROR("jtag_add_clocks() called with TAP in unstable state \"%s\"",
@@ -960,7 +960,7 @@ int default_interface_jtag_execute_queue(void)
LOG_DEBUG_IO("JTAG %s SCAN to %s",
cmd->cmd.scan->ir_scan ? "IR" : "DR",
tap_state_name(cmd->cmd.scan->end_state));
- for (int i = 0; i < cmd->cmd.scan->num_fields; i++) {
+ for (unsigned int i = 0; i < cmd->cmd.scan->num_fields; i++) {
struct scan_field *field = cmd->cmd.scan->fields + i;
if (field->out_value) {
char *str = buf_to_hex_str(field->out_value, field->num_bits);
diff --git a/src/jtag/drivers/amt_jtagaccel.c b/src/jtag/drivers/amt_jtagaccel.c
index b28ce62ff..489cb2471 100644
--- a/src/jtag/drivers/amt_jtagaccel.c
+++ b/src/jtag/drivers/amt_jtagaccel.c
@@ -203,7 +203,7 @@ static void amt_jtagaccel_state_move(void)
tap_set_state(end_state);
}
-static void amt_jtagaccel_runtest(int num_cycles)
+static void amt_jtagaccel_runtest(unsigned int num_cycles)
{
int i = 0;
uint8_t aw_scan_tms_5;
diff --git a/src/jtag/drivers/angie.c b/src/jtag/drivers/angie.c
index 81dd1af82..47628fef7 100644
--- a/src/jtag/drivers/angie.c
+++ b/src/jtag/drivers/angie.c
@@ -1836,15 +1836,17 @@ static int angie_reset(int trst, int srst)
*/
static int angie_queue_pathmove(struct angie *device, struct jtag_command *cmd)
{
- int ret, i, num_states, batch_size, state_count;
+ int ret, state_count;
tap_state_t *path;
uint8_t tms_sequence;
- num_states = cmd->cmd.pathmove->num_states;
+ unsigned int num_states = cmd->cmd.pathmove->num_states;
path = cmd->cmd.pathmove->path;
state_count = 0;
while (num_states > 0) {
+ unsigned int batch_size;
+
tms_sequence = 0;
/* Determine batch size */
@@ -1853,7 +1855,7 @@ static int angie_queue_pathmove(struct angie *device, struct jtag_command *cmd)
else
batch_size = num_states;
- for (i = 0; i < batch_size; i++) {
+ for (unsigned int i = 0; i < batch_size; i++) {
if (tap_state_transition(tap_get_state(), false) == path[state_count]) {
/* Append '0' transition: clear bit 'i' in tms_sequence */
buf_set_u32(&tms_sequence, i, 1, 0x0);
@@ -1908,14 +1910,13 @@ static int angie_queue_sleep(struct angie *device, struct jtag_command *cmd)
static int angie_queue_stableclocks(struct angie *device, struct jtag_command *cmd)
{
int ret;
- unsigned int num_cycles;
if (!tap_is_state_stable(tap_get_state())) {
LOG_ERROR("JTAG_STABLECLOCKS: state not stable");
return ERROR_FAIL;
}
- num_cycles = cmd->cmd.stableclocks->num_cycles;
+ unsigned int num_cycles = cmd->cmd.stableclocks->num_cycles;
/* TMS stays either high (Test Logic Reset state) or low (all other states) */
if (tap_get_state() == TAP_RESET)
diff --git a/src/jtag/drivers/arm-jtag-ew.c b/src/jtag/drivers/arm-jtag-ew.c
index 4c50c54c9..aaed16db6 100644
--- a/src/jtag/drivers/arm-jtag-ew.c
+++ b/src/jtag/drivers/arm-jtag-ew.c
@@ -44,8 +44,8 @@ static uint8_t usb_out_buffer[ARMJTAGEW_OUT_BUFFER_SIZE];
/* Queue command functions */
static void armjtagew_end_state(tap_state_t state);
static void armjtagew_state_move(void);
-static void armjtagew_path_move(int num_states, tap_state_t *path);
-static void armjtagew_runtest(int num_cycles);
+static void armjtagew_path_move(unsigned int num_states, tap_state_t *path);
+static void armjtagew_runtest(unsigned int num_cycles);
static void armjtagew_scan(bool ir_scan,
enum scan_type type,
uint8_t *buffer,
@@ -95,7 +95,7 @@ static int armjtagew_execute_queue(struct jtag_command *cmd_queue)
while (cmd) {
switch (cmd->type) {
case JTAG_RUNTEST:
- LOG_DEBUG_IO("runtest %i cycles, end in %i",
+ LOG_DEBUG_IO("runtest %u cycles, end in %i",
cmd->cmd.runtest->num_cycles,
cmd->cmd.runtest->end_state);
@@ -111,7 +111,7 @@ static int armjtagew_execute_queue(struct jtag_command *cmd_queue)
break;
case JTAG_PATHMOVE:
- LOG_DEBUG_IO("pathmove: %i states, end in %i",
+ LOG_DEBUG_IO("pathmove: %u states, end in %i",
cmd->cmd.pathmove->num_states,
cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]);
@@ -279,11 +279,9 @@ static void armjtagew_state_move(void)
tap_set_state(tap_get_end_state());
}
-static void armjtagew_path_move(int num_states, tap_state_t *path)
+static void armjtagew_path_move(unsigned int num_states, tap_state_t *path)
{
- int i;
-
- for (i = 0; i < num_states; i++) {
+ for (unsigned int i = 0; i < num_states; i++) {
/*
* TODO: The ARM-JTAG-EW hardware delays TDI with 3 TCK cycles when in RTCK mode.
* Either handle that here, or update the documentation with examples
@@ -305,10 +303,8 @@ static void armjtagew_path_move(int num_states, tap_state_t *path)
tap_set_end_state(tap_get_state());
}
-static void armjtagew_runtest(int num_cycles)
+static void armjtagew_runtest(unsigned int num_cycles)
{
- int i;
-
tap_state_t saved_end_state = tap_get_end_state();
/* only do a state_move when we're not already in IDLE */
@@ -318,7 +314,7 @@ static void armjtagew_runtest(int num_cycles)
}
/* execute num_cycles */
- for (i = 0; i < num_cycles; i++)
+ for (unsigned int i = 0; i < num_cycles; i++)
armjtagew_tap_append_step(0, 0);
/* finish in end_state */
diff --git a/src/jtag/drivers/bitbang.c b/src/jtag/drivers/bitbang.c
index 3d839e65d..e41659263 100644
--- a/src/jtag/drivers/bitbang.c
+++ b/src/jtag/drivers/bitbang.c
@@ -33,7 +33,7 @@
* this function checks the current stable state to decide on the value of TMS
* to use.
*/
-static int bitbang_stableclocks(int num_cycles);
+static int bitbang_stableclocks(unsigned int num_cycles);
static void bitbang_swd_write_reg(uint8_t cmd, uint32_t value, uint32_t ap_delay_clk);
@@ -95,7 +95,7 @@ static int bitbang_execute_tms(struct jtag_command *cmd)
unsigned num_bits = cmd->cmd.tms->num_bits;
const uint8_t *bits = cmd->cmd.tms->bits;
- LOG_DEBUG_IO("TMS: %d bits", num_bits);
+ LOG_DEBUG_IO("TMS: %u bits", num_bits);
int tms = 0;
for (unsigned i = 0; i < num_bits; i++) {
@@ -113,7 +113,7 @@ static int bitbang_execute_tms(struct jtag_command *cmd)
static int bitbang_path_move(struct pathmove_command *cmd)
{
- int num_states = cmd->num_states;
+ unsigned int num_states = cmd->num_states;
int state_count;
int tms = 0;
@@ -147,10 +147,8 @@ static int bitbang_path_move(struct pathmove_command *cmd)
return ERROR_OK;
}
-static int bitbang_runtest(int num_cycles)
+static int bitbang_runtest(unsigned int num_cycles)
{
- int i;
-
tap_state_t saved_end_state = tap_get_end_state();
/* only do a state_move when we're not already in IDLE */
@@ -161,7 +159,7 @@ static int bitbang_runtest(int num_cycles)
}
/* execute num_cycles */
- for (i = 0; i < num_cycles; i++) {
+ for (unsigned int i = 0; i < num_cycles; i++) {
if (bitbang_interface->write(0, 0, 0) != ERROR_OK)
return ERROR_FAIL;
if (bitbang_interface->write(1, 0, 0) != ERROR_OK)
@@ -179,13 +177,12 @@ static int bitbang_runtest(int num_cycles)
return ERROR_OK;
}
-static int bitbang_stableclocks(int num_cycles)
+static int bitbang_stableclocks(unsigned int num_cycles)
{
int tms = (tap_get_state() == TAP_RESET ? 1 : 0);
- int i;
/* send num_cycles clocks onto the cable */
- for (i = 0; i < num_cycles; i++) {
+ for (unsigned int i = 0; i < num_cycles; i++) {
if (bitbang_interface->write(1, tms, 0) != ERROR_OK)
return ERROR_FAIL;
if (bitbang_interface->write(0, tms, 0) != ERROR_OK)
@@ -319,7 +316,7 @@ int bitbang_execute_queue(struct jtag_command *cmd_queue)
while (cmd) {
switch (cmd->type) {
case JTAG_RUNTEST:
- LOG_DEBUG_IO("runtest %i cycles, end in %s",
+ LOG_DEBUG_IO("runtest %u cycles, end in %s",
cmd->cmd.runtest->num_cycles,
tap_state_name(cmd->cmd.runtest->end_state));
bitbang_end_state(cmd->cmd.runtest->end_state);
@@ -343,7 +340,7 @@ int bitbang_execute_queue(struct jtag_command *cmd_queue)
return ERROR_FAIL;
break;
case JTAG_PATHMOVE:
- LOG_DEBUG_IO("pathmove: %i states, end in %s",
+ LOG_DEBUG_IO("pathmove: %u states, end in %s",
cmd->cmd.pathmove->num_states,
tap_state_name(cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]));
if (bitbang_path_move(cmd->cmd.pathmove) != ERROR_OK)
diff --git a/src/jtag/drivers/bitq.c b/src/jtag/drivers/bitq.c
index 2e5cca2a4..6816b9b86 100644
--- a/src/jtag/drivers/bitq.c
+++ b/src/jtag/drivers/bitq.c
@@ -18,7 +18,7 @@ struct bitq_interface *bitq_interface; /* low level bit queue interface */
/* state of input queue */
struct bitq_state {
struct jtag_command *cmd; /* command currently processed */
- int field_idx; /* index of field currently being processed */
+ unsigned int field_idx; /* index of field currently being processed */
int bit_pos; /* position of bit currently being processed */
int status; /* processing status */
};
@@ -108,9 +108,7 @@ static void bitq_state_move(tap_state_t new_state)
static void bitq_path_move(struct pathmove_command *cmd)
{
- int i;
-
- for (i = 0; i < cmd->num_states; i++) {
+ for (unsigned int i = 0; i < cmd->num_states; i++) {
if (tap_state_transition(tap_get_state(), false) == cmd->path[i])
bitq_io(0, 0, 0);
else if (tap_state_transition(tap_get_state(), true) == cmd->path[i])
@@ -127,16 +125,14 @@ static void bitq_path_move(struct pathmove_command *cmd)
tap_set_end_state(tap_get_state());
}
-static void bitq_runtest(int num_cycles)
+static void bitq_runtest(unsigned int num_cycles)
{
- int i;
-
/* only do a state_move when we're not already in IDLE */
if (tap_get_state() != TAP_IDLE)
bitq_state_move(TAP_IDLE);
/* execute num_cycles */
- for (i = 0; i < num_cycles; i++)
+ for (unsigned int i = 0; i < num_cycles; i++)
bitq_io(0, 0, 0);
/* finish in end_state */
@@ -190,13 +186,12 @@ static void bitq_scan_field(struct scan_field *field, int do_pause)
static void bitq_scan(struct scan_command *cmd)
{
- int i;
-
if (cmd->ir_scan)
bitq_state_move(TAP_IRSHIFT);
else
bitq_state_move(TAP_DRSHIFT);
+ unsigned int i;
for (i = 0; i < cmd->num_fields - 1; i++)
bitq_scan_field(&cmd->fields[i], 0);
@@ -226,7 +221,7 @@ int bitq_execute_queue(struct jtag_command *cmd_queue)
break;
case JTAG_RUNTEST:
- LOG_DEBUG_IO("runtest %i cycles, end in %i", cmd->cmd.runtest->num_cycles, cmd->cmd.runtest->end_state);
+ LOG_DEBUG_IO("runtest %u cycles, end in %i", cmd->cmd.runtest->num_cycles, cmd->cmd.runtest->end_state);
bitq_end_state(cmd->cmd.runtest->end_state);
bitq_runtest(cmd->cmd.runtest->num_cycles);
break;
@@ -238,7 +233,7 @@ int bitq_execute_queue(struct jtag_command *cmd_queue)
break;
case JTAG_PATHMOVE:
- LOG_DEBUG_IO("pathmove: %i states, end in %i", cmd->cmd.pathmove->num_states,
+ LOG_DEBUG_IO("pathmove: %u states, end in %i", cmd->cmd.pathmove->num_states,
cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]);
bitq_path_move(cmd->cmd.pathmove);
break;
diff --git a/src/jtag/drivers/buspirate.c b/src/jtag/drivers/buspirate.c
index 3b03337c9..b01a79644 100644
--- a/src/jtag/drivers/buspirate.c
+++ b/src/jtag/drivers/buspirate.c
@@ -27,11 +27,11 @@ static int buspirate_reset(int trst, int srst);
static void buspirate_end_state(tap_state_t state);
static void buspirate_state_move(void);
-static void buspirate_path_move(int num_states, tap_state_t *path);
-static void buspirate_runtest(int num_cycles);
+static void buspirate_path_move(unsigned int num_states, tap_state_t *path);
+static void buspirate_runtest(unsigned int num_cycles);
static void buspirate_scan(bool ir_scan, enum scan_type type,
uint8_t *buffer, int scan_size, struct scan_command *command);
-static void buspirate_stableclocks(int num_cycles);
+static void buspirate_stableclocks(unsigned int num_cycles);
#define CMD_UNKNOWN 0x00
#define CMD_PORT_MODE 0x01
@@ -162,7 +162,7 @@ static int buspirate_execute_queue(struct jtag_command *cmd_queue)
while (cmd) {
switch (cmd->type) {
case JTAG_RUNTEST:
- LOG_DEBUG_IO("runtest %i cycles, end in %s",
+ LOG_DEBUG_IO("runtest %u cycles, end in %s",
cmd->cmd.runtest->num_cycles,
tap_state_name(cmd->cmd.runtest
->end_state));
@@ -180,7 +180,7 @@ static int buspirate_execute_queue(struct jtag_command *cmd_queue)
buspirate_state_move();
break;
case JTAG_PATHMOVE:
- LOG_DEBUG_IO("pathmove: %i states, end in %s",
+ LOG_DEBUG_IO("pathmove: %u states, end in %s",
cmd->cmd.pathmove->num_states,
tap_state_name(cmd->cmd.pathmove
->path[cmd->cmd.pathmove
@@ -210,7 +210,7 @@ static int buspirate_execute_queue(struct jtag_command *cmd_queue)
jtag_sleep(cmd->cmd.sleep->us);
break;
case JTAG_STABLECLOCKS:
- LOG_DEBUG_IO("stable clock %i cycles", cmd->cmd.stableclocks->num_cycles);
+ LOG_DEBUG_IO("stable clock %u cycles", cmd->cmd.stableclocks->num_cycles);
buspirate_stableclocks(cmd->cmd.stableclocks->num_cycles);
break;
default:
@@ -580,11 +580,9 @@ static void buspirate_state_move(void)
tap_set_state(tap_get_end_state());
}
-static void buspirate_path_move(int num_states, tap_state_t *path)
+static void buspirate_path_move(unsigned int num_states, tap_state_t *path)
{
- int i;
-
- for (i = 0; i < num_states; i++) {
+ for (unsigned int i = 0; i < num_states; i++) {
if (tap_state_transition(tap_get_state(), false) == path[i]) {
buspirate_tap_append(0, 0);
} else if (tap_state_transition(tap_get_state(), true)
@@ -604,10 +602,8 @@ static void buspirate_path_move(int num_states, tap_state_t *path)
tap_set_end_state(tap_get_state());
}
-static void buspirate_runtest(int num_cycles)
+static void buspirate_runtest(unsigned int num_cycles)
{
- int i;
-
tap_state_t saved_end_state = tap_get_end_state();
/* only do a state_move when we're not already in IDLE */
@@ -616,7 +612,7 @@ static void buspirate_runtest(int num_cycles)
buspirate_state_move();
}
- for (i = 0; i < num_cycles; i++)
+ for (unsigned int i = 0; i < num_cycles; i++)
buspirate_tap_append(0, 0);
LOG_DEBUG_IO("runtest: cur_state %s end_state %s",
@@ -658,14 +654,13 @@ static void buspirate_scan(bool ir_scan, enum scan_type type,
buspirate_state_move();
}
-static void buspirate_stableclocks(int num_cycles)
+static void buspirate_stableclocks(unsigned int num_cycles)
{
- int i;
int tms = (tap_get_state() == TAP_RESET ? 1 : 0);
buspirate_tap_make_space(0, num_cycles);
- for (i = 0; i < num_cycles; i++)
+ for (unsigned int i = 0; i < num_cycles; i++)
buspirate_tap_append(tms, 0);
}
diff --git a/src/jtag/drivers/cmsis_dap.c b/src/jtag/drivers/cmsis_dap.c
index d7367d813..243b01c63 100644
--- a/src/jtag/drivers/cmsis_dap.c
+++ b/src/jtag/drivers/cmsis_dap.c
@@ -1752,7 +1752,7 @@ static void cmsis_dap_execute_scan(struct jtag_command *cmd)
LOG_DEBUG("discarding trailing empty field");
}
- if (cmd->cmd.scan->num_fields == 0) {
+ if (!cmd->cmd.scan->num_fields) {
LOG_DEBUG("empty scan, doing nothing");
return;
}
@@ -1774,9 +1774,9 @@ static void cmsis_dap_execute_scan(struct jtag_command *cmd)
struct scan_field *field = cmd->cmd.scan->fields;
unsigned scan_size = 0;
- for (int i = 0; i < cmd->cmd.scan->num_fields; i++, field++) {
+ for (unsigned int i = 0; i < cmd->cmd.scan->num_fields; i++, field++) {
scan_size += field->num_bits;
- LOG_DEBUG_IO("%s%s field %d/%d %d bits",
+ LOG_DEBUG_IO("%s%s field %u/%u %d bits",
field->in_value ? "in" : "",
field->out_value ? "out" : "",
i,
@@ -1872,16 +1872,16 @@ static void cmsis_dap_execute_pathmove(struct jtag_command *cmd)
cmsis_dap_pathmove(cmd->cmd.pathmove->num_states, cmd->cmd.pathmove->path);
}
-static void cmsis_dap_stableclocks(int num_cycles)
+static void cmsis_dap_stableclocks(unsigned int num_cycles)
{
uint8_t tms = tap_get_state() == TAP_RESET;
/* TODO: Perform optimizations? */
/* Execute num_cycles. */
- for (int i = 0; i < num_cycles; i++)
+ for (unsigned int i = 0; i < num_cycles; i++)
cmsis_dap_add_tms_sequence(&tms, 1);
}
-static void cmsis_dap_runtest(int num_cycles)
+static void cmsis_dap_runtest(unsigned int num_cycles)
{
tap_state_t saved_end_state = tap_get_end_state();
@@ -1901,7 +1901,7 @@ static void cmsis_dap_runtest(int num_cycles)
static void cmsis_dap_execute_runtest(struct jtag_command *cmd)
{
- LOG_DEBUG_IO("runtest %i cycles, end in %i", cmd->cmd.runtest->num_cycles,
+ LOG_DEBUG_IO("runtest %u cycles, end in %i", cmd->cmd.runtest->num_cycles,
cmd->cmd.runtest->end_state);
cmsis_dap_end_state(cmd->cmd.runtest->end_state);
@@ -1910,13 +1910,13 @@ static void cmsis_dap_execute_runtest(struct jtag_command *cmd)
static void cmsis_dap_execute_stableclocks(struct jtag_command *cmd)
{
- LOG_DEBUG_IO("stableclocks %i cycles", cmd->cmd.runtest->num_cycles);
+ LOG_DEBUG_IO("stableclocks %u cycles", cmd->cmd.runtest->num_cycles);
cmsis_dap_stableclocks(cmd->cmd.runtest->num_cycles);
}
static void cmsis_dap_execute_tms(struct jtag_command *cmd)
{
- LOG_DEBUG_IO("TMS: %d bits", cmd->cmd.tms->num_bits);
+ LOG_DEBUG_IO("TMS: %u bits", cmd->cmd.tms->num_bits);
cmsis_dap_cmd_dap_swj_sequence(cmd->cmd.tms->num_bits, cmd->cmd.tms->bits);
}
diff --git a/src/jtag/drivers/driver.c b/src/jtag/drivers/driver.c
index e52816d3a..2aad4a0c1 100644
--- a/src/jtag/drivers/driver.c
+++ b/src/jtag/drivers/driver.c
@@ -259,7 +259,7 @@ int interface_add_tms_seq(unsigned num_bits, const uint8_t *seq, enum tap_state
return ERROR_OK;
}
-int interface_jtag_add_pathmove(int num_states, const tap_state_t *path)
+int interface_jtag_add_pathmove(unsigned int num_states, const tap_state_t *path)
{
/* allocate memory for a new list member */
struct jtag_command *cmd = cmd_queue_alloc(sizeof(struct jtag_command));
@@ -272,13 +272,13 @@ int interface_jtag_add_pathmove(int num_states, const tap_state_t *path)
cmd->cmd.pathmove->num_states = num_states;
cmd->cmd.pathmove->path = cmd_queue_alloc(sizeof(tap_state_t) * num_states);
- for (int i = 0; i < num_states; i++)
+ for (unsigned int i = 0; i < num_states; i++)
cmd->cmd.pathmove->path[i] = path[i];
return ERROR_OK;
}
-int interface_jtag_add_runtest(int num_cycles, tap_state_t state)
+int interface_jtag_add_runtest(unsigned int num_cycles, tap_state_t state)
{
/* allocate memory for a new list member */
struct jtag_command *cmd = cmd_queue_alloc(sizeof(struct jtag_command));
@@ -294,7 +294,7 @@ int interface_jtag_add_runtest(int num_cycles, tap_state_t state)
return ERROR_OK;
}
-int interface_jtag_add_clocks(int num_cycles)
+int interface_jtag_add_clocks(unsigned int num_cycles)
{
/* allocate memory for a new list member */
struct jtag_command *cmd = cmd_queue_alloc(sizeof(struct jtag_command));
diff --git a/src/jtag/drivers/ft232r.c b/src/jtag/drivers/ft232r.c
index 766f6ddb5..a4d072cd7 100644
--- a/src/jtag/drivers/ft232r.c
+++ b/src/jtag/drivers/ft232r.c
@@ -657,7 +657,7 @@ static int syncbb_execute_tms(struct jtag_command *cmd)
unsigned num_bits = cmd->cmd.tms->num_bits;
const uint8_t *bits = cmd->cmd.tms->bits;
- LOG_DEBUG_IO("TMS: %d bits", num_bits);
+ LOG_DEBUG_IO("TMS: %u bits", num_bits);
int tms = 0;
for (unsigned i = 0; i < num_bits; i++) {
@@ -672,7 +672,7 @@ static int syncbb_execute_tms(struct jtag_command *cmd)
static void syncbb_path_move(struct pathmove_command *cmd)
{
- int num_states = cmd->num_states;
+ unsigned int num_states = cmd->num_states;
int state_count;
int tms = 0;
@@ -702,9 +702,8 @@ static void syncbb_path_move(struct pathmove_command *cmd)
tap_set_end_state(tap_get_state());
}
-static void syncbb_runtest(int num_cycles)
+static void syncbb_runtest(unsigned int num_cycles)
{
- int i;
tap_state_t saved_end_state = tap_get_end_state();
@@ -715,7 +714,7 @@ static void syncbb_runtest(int num_cycles)
}
/* execute num_cycles */
- for (i = 0; i < num_cycles; i++) {
+ for (unsigned int i = 0; i < num_cycles; i++) {
ft232r_write(0, 0, 0);
ft232r_write(1, 0, 0);
}
@@ -735,13 +734,12 @@ static void syncbb_runtest(int num_cycles)
* this function checks the current stable state to decide on the value of TMS
* to use.
*/
-static void syncbb_stableclocks(int num_cycles)
+static void syncbb_stableclocks(unsigned int num_cycles)
{
int tms = (tap_get_state() == TAP_RESET ? 1 : 0);
- int i;
/* send num_cycles clocks onto the cable */
- for (i = 0; i < num_cycles; i++) {
+ for (unsigned int i = 0; i < num_cycles; i++) {
ft232r_write(1, tms, 0);
ft232r_write(0, tms, 0);
}
@@ -832,7 +830,7 @@ static int syncbb_execute_queue(struct jtag_command *cmd_queue)
break;
case JTAG_RUNTEST:
- LOG_DEBUG_IO("runtest %i cycles, end in %s", cmd->cmd.runtest->num_cycles,
+ LOG_DEBUG_IO("runtest %u cycles, end in %s", cmd->cmd.runtest->num_cycles,
tap_state_name(cmd->cmd.runtest->end_state));
syncbb_end_state(cmd->cmd.runtest->end_state);
@@ -854,7 +852,7 @@ static int syncbb_execute_queue(struct jtag_command *cmd_queue)
break;
case JTAG_PATHMOVE:
- LOG_DEBUG_IO("pathmove: %i states, end in %s", cmd->cmd.pathmove->num_states,
+ LOG_DEBUG_IO("pathmove: %u states, end in %s", cmd->cmd.pathmove->num_states,
tap_state_name(cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]));
syncbb_path_move(cmd->cmd.pathmove);
diff --git a/src/jtag/drivers/ftdi.c b/src/jtag/drivers/ftdi.c
index 661300506..4f253fa6d 100644
--- a/src/jtag/drivers/ftdi.c
+++ b/src/jtag/drivers/ftdi.c
@@ -311,10 +311,9 @@ static void ftdi_end_state(tap_state_t state)
static void ftdi_execute_runtest(struct jtag_command *cmd)
{
- int i;
uint8_t zero = 0;
- LOG_DEBUG_IO("runtest %i cycles, end in %s",
+ LOG_DEBUG_IO("runtest %u cycles, end in %s",
cmd->cmd.runtest->num_cycles,
tap_state_name(cmd->cmd.runtest->end_state));
@@ -322,7 +321,7 @@ static void ftdi_execute_runtest(struct jtag_command *cmd)
move_to_state(TAP_IDLE);
/* TODO: Reuse ftdi_execute_stableclocks */
- i = cmd->cmd.runtest->num_cycles;
+ unsigned int i = cmd->cmd.runtest->num_cycles;
while (i > 0) {
/* there are no state transitions in this code, so omit state tracking */
unsigned this_len = i > 7 ? 7 : i;
@@ -335,7 +334,7 @@ static void ftdi_execute_runtest(struct jtag_command *cmd)
if (tap_get_state() != tap_get_end_state())
move_to_state(tap_get_end_state());
- LOG_DEBUG_IO("runtest: %i, end in %s",
+ LOG_DEBUG_IO("runtest: %u, end in %s",
cmd->cmd.runtest->num_cycles,
tap_state_name(tap_get_end_state()));
}
@@ -358,7 +357,7 @@ static void ftdi_execute_statemove(struct jtag_command *cmd)
*/
static void ftdi_execute_tms(struct jtag_command *cmd)
{
- LOG_DEBUG_IO("TMS: %d bits", cmd->cmd.tms->num_bits);
+ LOG_DEBUG_IO("TMS: %u bits", cmd->cmd.tms->num_bits);
/* TODO: Missing tap state tracking, also missing from ft2232.c! */
mpsse_clock_tms_cs_out(mpsse_ctx,
@@ -372,9 +371,9 @@ static void ftdi_execute_tms(struct jtag_command *cmd)
static void ftdi_execute_pathmove(struct jtag_command *cmd)
{
tap_state_t *path = cmd->cmd.pathmove->path;
- int num_states = cmd->cmd.pathmove->num_states;
+ unsigned int num_states = cmd->cmd.pathmove->num_states;
- LOG_DEBUG_IO("pathmove: %i states, current: %s end: %s", num_states,
+ LOG_DEBUG_IO("pathmove: %u states, current: %s end: %s", num_states,
tap_state_name(tap_get_state()),
tap_state_name(path[num_states-1]));
@@ -432,7 +431,7 @@ static void ftdi_execute_scan(struct jtag_command *cmd)
LOG_DEBUG_IO("discarding trailing empty field");
}
- if (cmd->cmd.scan->num_fields == 0) {
+ if (!cmd->cmd.scan->num_fields) {
LOG_DEBUG_IO("empty scan, doing nothing");
return;
}
@@ -450,9 +449,9 @@ static void ftdi_execute_scan(struct jtag_command *cmd)
struct scan_field *field = cmd->cmd.scan->fields;
unsigned scan_size = 0;
- for (int i = 0; i < cmd->cmd.scan->num_fields; i++, field++) {
+ for (unsigned int i = 0; i < cmd->cmd.scan->num_fields; i++, field++) {
scan_size += field->num_bits;
- LOG_DEBUG_IO("%s%s field %d/%d %d bits",
+ LOG_DEBUG_IO("%s%s field %u/%u %d bits",
field->in_value ? "in" : "",
field->out_value ? "out" : "",
i,
@@ -576,7 +575,7 @@ static void ftdi_execute_stableclocks(struct jtag_command *cmd)
/* this is only allowed while in a stable state. A check for a stable
* state was done in jtag_add_clocks()
*/
- int num_cycles = cmd->cmd.stableclocks->num_cycles;
+ unsigned int num_cycles = cmd->cmd.stableclocks->num_cycles;
/* 7 bits of either ones or zeros. */
uint8_t tms = tap_get_state() == TAP_RESET ? 0x7f : 0x00;
@@ -590,7 +589,7 @@ static void ftdi_execute_stableclocks(struct jtag_command *cmd)
num_cycles -= this_len;
}
- LOG_DEBUG_IO("clocks %i while in %s",
+ LOG_DEBUG_IO("clocks %u while in %s",
cmd->cmd.stableclocks->num_cycles,
tap_state_name(tap_get_state()));
}
diff --git a/src/jtag/drivers/gw16012.c b/src/jtag/drivers/gw16012.c
index a4c6fd0f0..d0fe43fdb 100644
--- a/src/jtag/drivers/gw16012.c
+++ b/src/jtag/drivers/gw16012.c
@@ -185,10 +185,9 @@ static void gw16012_path_move(struct pathmove_command *cmd)
tap_set_end_state(tap_get_state());
}
-static void gw16012_runtest(int num_cycles)
+static void gw16012_runtest(unsigned int num_cycles)
{
tap_state_t saved_end_state = tap_get_end_state();
- int i;
/* only do a state_move when we're not already in IDLE */
if (tap_get_state() != TAP_IDLE) {
@@ -196,7 +195,7 @@ static void gw16012_runtest(int num_cycles)
gw16012_state_move();
}
- for (i = 0; i < num_cycles; i++) {
+ for (unsigned int i = 0; i < num_cycles; i++) {
gw16012_control(0x0); /* single-bit mode */
gw16012_data(0x0); /* TMS cycle with TMS low */
}
@@ -292,7 +291,7 @@ static int gw16012_execute_queue(struct jtag_command *cmd_queue)
gw16012_reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst);
break;
case JTAG_RUNTEST:
- LOG_DEBUG_IO("runtest %i cycles, end in %i", cmd->cmd.runtest->num_cycles,
+ LOG_DEBUG_IO("runtest %u cycles, end in %i", cmd->cmd.runtest->num_cycles,
cmd->cmd.runtest->end_state);
gw16012_end_state(cmd->cmd.runtest->end_state);
gw16012_runtest(cmd->cmd.runtest->num_cycles);
diff --git a/src/jtag/drivers/jlink.c b/src/jtag/drivers/jlink.c
index 1874557dc..ff3916735 100644
--- a/src/jtag/drivers/jlink.c
+++ b/src/jtag/drivers/jlink.c
@@ -80,9 +80,9 @@ static struct device_config tmp_config;
/* Queue command functions */
static void jlink_end_state(tap_state_t state);
static void jlink_state_move(void);
-static void jlink_path_move(int num_states, tap_state_t *path);
-static void jlink_stableclocks(int num_cycles);
-static void jlink_runtest(int num_cycles);
+static void jlink_path_move(unsigned int num_states, tap_state_t *path);
+static void jlink_stableclocks(unsigned int num_cycles);
+static void jlink_runtest(unsigned int num_cycles);
static void jlink_reset(int trst, int srst);
static int jlink_reset_safe(int trst, int srst);
static int jlink_swd_run_queue(void);
@@ -140,7 +140,7 @@ static void jlink_execute_statemove(struct jtag_command *cmd)
static void jlink_execute_pathmove(struct jtag_command *cmd)
{
- LOG_DEBUG_IO("pathmove: %i states, end in %i",
+ LOG_DEBUG_IO("pathmove: %u states, end in %i",
cmd->cmd.pathmove->num_states,
cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]);
@@ -159,7 +159,7 @@ static void jlink_execute_scan(struct jtag_command *cmd)
LOG_DEBUG("discarding trailing empty field");
}
- if (cmd->cmd.scan->num_fields == 0) {
+ if (!cmd->cmd.scan->num_fields) {
LOG_DEBUG("empty scan, doing nothing");
return;
}
@@ -181,9 +181,9 @@ static void jlink_execute_scan(struct jtag_command *cmd)
struct scan_field *field = cmd->cmd.scan->fields;
unsigned scan_size = 0;
- for (int i = 0; i < cmd->cmd.scan->num_fields; i++, field++) {
+ for (unsigned int i = 0; i < cmd->cmd.scan->num_fields; i++, field++) {
scan_size += field->num_bits;
- LOG_DEBUG_IO("%s%s field %d/%d %d bits",
+ LOG_DEBUG_IO("%s%s field %u/%u %d bits",
field->in_value ? "in" : "",
field->out_value ? "out" : "",
i,
@@ -885,12 +885,11 @@ static void jlink_state_move(void)
tap_set_state(tap_get_end_state());
}
-static void jlink_path_move(int num_states, tap_state_t *path)
+static void jlink_path_move(unsigned int num_states, tap_state_t *path)
{
- int i;
uint8_t tms = 0xff;
- for (i = 0; i < num_states; i++) {
+ for (unsigned int i = 0; i < num_states; i++) {
if (path[i] == tap_state_transition(tap_get_state(), false))
jlink_clock_data(NULL, 0, NULL, 0, NULL, 0, 1);
else if (path[i] == tap_state_transition(tap_get_state(), true))
@@ -907,17 +906,15 @@ static void jlink_path_move(int num_states, tap_state_t *path)
tap_set_end_state(tap_get_state());
}
-static void jlink_stableclocks(int num_cycles)
+static void jlink_stableclocks(unsigned int num_cycles)
{
- int i;
-
uint8_t tms = tap_get_state() == TAP_RESET;
/* Execute num_cycles. */
- for (i = 0; i < num_cycles; i++)
+ for (unsigned int i = 0; i < num_cycles; i++)
jlink_clock_data(NULL, 0, &tms, 0, NULL, 0, 1);
}
-static void jlink_runtest(int num_cycles)
+static void jlink_runtest(unsigned int num_cycles)
{
tap_state_t saved_end_state = tap_get_end_state();
diff --git a/src/jtag/drivers/jtag_dpi.c b/src/jtag/drivers/jtag_dpi.c
index 285f96e4b..046186a61 100644
--- a/src/jtag/drivers/jtag_dpi.c
+++ b/src/jtag/drivers/jtag_dpi.c
@@ -163,7 +163,7 @@ out:
return ret;
}
-static int jtag_dpi_runtest(int cycles)
+static int jtag_dpi_runtest(unsigned int num_cycles)
{
char buf[20];
uint8_t *data_buf = last_ir_buf, *read_scan;
@@ -189,7 +189,7 @@ static int jtag_dpi_runtest(int cycles)
return ERROR_FAIL;
}
snprintf(buf, sizeof(buf), "ib %d\n", num_bits);
- while (cycles > 0) {
+ while (num_cycles > 0) {
ret = write_sock(buf, strlen(buf));
if (ret != ERROR_OK) {
LOG_ERROR("write_sock() fail, file %s, line %d",
@@ -209,7 +209,7 @@ static int jtag_dpi_runtest(int cycles)
goto out;
}
- cycles -= num_bits + 6;
+ num_cycles -= num_bits + 6;
}
out:
@@ -217,9 +217,9 @@ out:
return ret;
}
-static int jtag_dpi_stableclocks(int cycles)
+static int jtag_dpi_stableclocks(unsigned int num_cycles)
{
- return jtag_dpi_runtest(cycles);
+ return jtag_dpi_runtest(num_cycles);
}
static int jtag_dpi_execute_queue(struct jtag_command *cmd_queue)
diff --git a/src/jtag/drivers/jtag_vpi.c b/src/jtag/drivers/jtag_vpi.c
index 9dec0d19d..5745a2cd0 100644
--- a/src/jtag/drivers/jtag_vpi.c
+++ b/src/jtag/drivers/jtag_vpi.c
@@ -254,7 +254,7 @@ static int jtag_vpi_path_move(struct pathmove_command *cmd)
memset(trans, 0, DIV_ROUND_UP(cmd->num_states, 8));
- for (int i = 0; i < cmd->num_states; i++) {
+ for (unsigned int i = 0; i < cmd->num_states; i++) {
if (tap_state_transition(tap_get_state(), true) == cmd->path[i])
buf_set_u32(trans, i, 1, 1);
tap_set_state(cmd->path[i]);
@@ -440,7 +440,7 @@ static int jtag_vpi_scan(struct scan_command *cmd)
return ERROR_OK;
}
-static int jtag_vpi_runtest(int cycles, tap_state_t state)
+static int jtag_vpi_runtest(unsigned int num_cycles, tap_state_t state)
{
int retval;
@@ -448,23 +448,21 @@ static int jtag_vpi_runtest(int cycles, tap_state_t state)
if (retval != ERROR_OK)
return retval;
- retval = jtag_vpi_queue_tdi(NULL, cycles, NO_TAP_SHIFT);
+ retval = jtag_vpi_queue_tdi(NULL, num_cycles, NO_TAP_SHIFT);
if (retval != ERROR_OK)
return retval;
return jtag_vpi_state_move(state);
}
-static int jtag_vpi_stableclocks(int cycles)
+static int jtag_vpi_stableclocks(unsigned int num_cycles)
{
uint8_t tms_bits[4];
- int cycles_remain = cycles;
+ unsigned int cycles_remain = num_cycles;
int nb_bits;
int retval;
const int CYCLES_ONE_BATCH = sizeof(tms_bits) * 8;
- assert(cycles >= 0);
-
/* use TMS=1 in TAP RESET state, TMS=0 in all other stable states */
memset(&tms_bits, (tap_get_state() == TAP_RESET) ? 0xff : 0x00, sizeof(tms_bits));
diff --git a/src/jtag/drivers/opendous.c b/src/jtag/drivers/opendous.c
index 81b74d40e..e828d46d0 100644
--- a/src/jtag/drivers/opendous.c
+++ b/src/jtag/drivers/opendous.c
@@ -106,8 +106,8 @@ static int opendous_quit(void);
/* Queue command functions */
static void opendous_end_state(tap_state_t state);
static void opendous_state_move(void);
-static void opendous_path_move(int num_states, tap_state_t *path);
-static void opendous_runtest(int num_cycles);
+static void opendous_path_move(unsigned int num_states, tap_state_t *path);
+static void opendous_runtest(unsigned int num_cycles);
static void opendous_scan(int ir_scan, enum scan_type type, uint8_t *buffer,
int scan_size, struct scan_command *command);
static void opendous_reset(int trst, int srst);
@@ -248,7 +248,7 @@ static int opendous_execute_queue(struct jtag_command *cmd_queue)
while (cmd) {
switch (cmd->type) {
case JTAG_RUNTEST:
- LOG_DEBUG_IO("runtest %i cycles, end in %i", cmd->cmd.runtest->num_cycles,
+ LOG_DEBUG_IO("runtest %u cycles, end in %i", cmd->cmd.runtest->num_cycles,
cmd->cmd.runtest->end_state);
if (cmd->cmd.runtest->end_state != -1)
@@ -265,7 +265,7 @@ static int opendous_execute_queue(struct jtag_command *cmd_queue)
break;
case JTAG_PATHMOVE:
- LOG_DEBUG_IO("pathmove: %i states, end in %i",
+ LOG_DEBUG_IO("pathmove: %u states, end in %i",
cmd->cmd.pathmove->num_states,
cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]);
@@ -419,11 +419,9 @@ void opendous_state_move(void)
tap_set_state(tap_get_end_state());
}
-void opendous_path_move(int num_states, tap_state_t *path)
+void opendous_path_move(unsigned int num_states, tap_state_t *path)
{
- int i;
-
- for (i = 0; i < num_states; i++) {
+ for (unsigned int i = 0; i < num_states; i++) {
if (path[i] == tap_state_transition(tap_get_state(), false))
opendous_tap_append_step(0, 0);
else if (path[i] == tap_state_transition(tap_get_state(), true))
@@ -440,10 +438,8 @@ void opendous_path_move(int num_states, tap_state_t *path)
tap_set_end_state(tap_get_state());
}
-void opendous_runtest(int num_cycles)
+void opendous_runtest(unsigned int num_cycles)
{
- int i;
-
tap_state_t saved_end_state = tap_get_end_state();
/* only do a state_move when we're not already in IDLE */
@@ -453,7 +449,7 @@ void opendous_runtest(int num_cycles)
}
/* execute num_cycles */
- for (i = 0; i < num_cycles; i++)
+ for (unsigned int i = 0; i < num_cycles; i++)
opendous_tap_append_step(0, 0);
/* finish in end_state */
diff --git a/src/jtag/drivers/openjtag.c b/src/jtag/drivers/openjtag.c
index ea78ca8fd..0ae885e87 100644
--- a/src/jtag/drivers/openjtag.c
+++ b/src/jtag/drivers/openjtag.c
@@ -760,15 +760,17 @@ static void openjtag_execute_runtest(struct jtag_command *cmd)
if (openjtag_variant != OPENJTAG_VARIANT_CY7C65215 ||
cmd->cmd.runtest->num_cycles) {
uint8_t command;
- int cycles = cmd->cmd.runtest->num_cycles;
+ unsigned int num_cycles = cmd->cmd.runtest->num_cycles;
do {
+ const unsigned int num_cycles_cmd = MIN(num_cycles, 16);
+
command = 7;
- command |= (((cycles > 16 ? 16 : cycles) - 1) & 0x0F) << 4;
+ command |= ((num_cycles_cmd - 1) & 0x0F) << 4;
openjtag_add_byte(command);
- cycles -= 16;
- } while (cycles > 0);
+ num_cycles -= num_cycles_cmd;
+ } while (num_cycles > 0);
}
tap_set_end_state(end_state);
diff --git a/src/jtag/drivers/osbdm.c b/src/jtag/drivers/osbdm.c
index 8d4fc90d8..c41a0e13c 100644
--- a/src/jtag/drivers/osbdm.c
+++ b/src/jtag/drivers/osbdm.c
@@ -381,7 +381,7 @@ static int osbdm_quit(void)
static int osbdm_add_pathmove(
struct queue *queue,
tap_state_t *path,
- int num_states)
+ unsigned int num_states)
{
assert(num_states <= 32);
@@ -392,7 +392,7 @@ static int osbdm_add_pathmove(
}
uint32_t tms = 0;
- for (int i = 0; i < num_states; i++) {
+ for (unsigned int i = 0; i < num_states; i++) {
if (tap_state_transition(tap_get_state(), 1) == path[i]) {
tms |= (1 << i);
} else if (tap_state_transition(tap_get_state(), 0) == path[i]) {
@@ -451,7 +451,7 @@ static int osbdm_add_statemove(
static int osbdm_add_stableclocks(
struct queue *queue,
- int count)
+ unsigned int count)
{
if (!tap_is_state_stable(tap_get_state())) {
LOG_ERROR("BUG: current state (%s) is not stable",
@@ -489,7 +489,7 @@ static int osbdm_add_tms(
static int osbdm_add_scan(
struct queue *queue,
struct scan_field *fields,
- int num_fields,
+ unsigned int num_fields,
tap_state_t end_state,
bool ir_scan)
{
@@ -508,7 +508,7 @@ static int osbdm_add_scan(
/* Add scan */
tap_set_end_state(end_state);
- for (int idx = 0; idx < num_fields; idx++) {
+ for (unsigned int idx = 0; idx < num_fields; idx++) {
struct sequence *next = queue_add_tail(queue, fields[idx].num_bits);
if (!next) {
LOG_ERROR("Can't allocate bit sequence");
@@ -536,7 +536,7 @@ static int osbdm_add_scan(
static int osbdm_add_runtest(
struct queue *queue,
- int num_cycles,
+ unsigned int num_cycles,
tap_state_t end_state)
{
if (osbdm_add_statemove(queue, TAP_IDLE, 0) != ERROR_OK)
diff --git a/src/jtag/drivers/rlink.c b/src/jtag/drivers/rlink.c
index afdf16e58..f4a4fcba9 100644
--- a/src/jtag/drivers/rlink.c
+++ b/src/jtag/drivers/rlink.c
@@ -869,7 +869,7 @@ static void rlink_state_move(void)
static void rlink_path_move(struct pathmove_command *cmd)
{
- int num_states = cmd->num_states;
+ unsigned int num_states = cmd->num_states;
int state_count;
int tms = 0;
@@ -896,10 +896,8 @@ static void rlink_path_move(struct pathmove_command *cmd)
tap_set_end_state(tap_get_state());
}
-static void rlink_runtest(int num_cycles)
+static void rlink_runtest(unsigned int num_cycles)
{
- int i;
-
tap_state_t saved_end_state = tap_get_end_state();
/* only do a state_move when we're not already in RTI */
@@ -909,7 +907,7 @@ static void rlink_runtest(int num_cycles)
}
/* execute num_cycles */
- for (i = 0; i < num_cycles; i++)
+ for (unsigned int i = 0; i < num_cycles; i++)
tap_state_queue_append(0);
/* finish in end_state */
@@ -1323,7 +1321,7 @@ static int rlink_execute_queue(struct jtag_command *cmd_queue)
rlink_state_move();
break;
case JTAG_PATHMOVE:
- LOG_DEBUG_IO("pathmove: %i states, end in %i",
+ LOG_DEBUG_IO("pathmove: %u states, end in %i",
cmd->cmd.pathmove->num_states,
cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]);
rlink_path_move(cmd->cmd.pathmove);
diff --git a/src/jtag/drivers/ulink.c b/src/jtag/drivers/ulink.c
index 0fe8989b9..ad3bc6e37 100644
--- a/src/jtag/drivers/ulink.c
+++ b/src/jtag/drivers/ulink.c
@@ -1701,15 +1701,17 @@ static int ulink_queue_reset(struct ulink *device, struct jtag_command *cmd)
*/
static int ulink_queue_pathmove(struct ulink *device, struct jtag_command *cmd)
{
- int ret, i, num_states, batch_size, state_count;
+ int ret, state_count;
tap_state_t *path;
uint8_t tms_sequence;
- num_states = cmd->cmd.pathmove->num_states;
+ unsigned int num_states = cmd->cmd.pathmove->num_states;
path = cmd->cmd.pathmove->path;
state_count = 0;
while (num_states > 0) {
+ unsigned int batch_size;
+
tms_sequence = 0;
/* Determine batch size */
@@ -1718,7 +1720,7 @@ static int ulink_queue_pathmove(struct ulink *device, struct jtag_command *cmd)
else
batch_size = num_states;
- for (i = 0; i < batch_size; i++) {
+ for (unsigned int i = 0; i < batch_size; i++) {
if (tap_state_transition(tap_get_state(), false) == path[state_count]) {
/* Append '0' transition: clear bit 'i' in tms_sequence */
buf_set_u32(&tms_sequence, i, 1, 0x0);
@@ -1774,14 +1776,13 @@ static int ulink_queue_sleep(struct ulink *device, struct jtag_command *cmd)
static int ulink_queue_stableclocks(struct ulink *device, struct jtag_command *cmd)
{
int ret;
- unsigned num_cycles;
if (!tap_is_state_stable(tap_get_state())) {
LOG_ERROR("JTAG_STABLECLOCKS: state not stable");
return ERROR_FAIL;
}
- num_cycles = cmd->cmd.stableclocks->num_cycles;
+ unsigned int num_cycles = cmd->cmd.stableclocks->num_cycles;
/* TMS stays either high (Test Logic Reset state) or low (all other states) */
if (tap_get_state() == TAP_RESET)
diff --git a/src/jtag/drivers/usb_blaster/usb_blaster.c b/src/jtag/drivers/usb_blaster/usb_blaster.c
index c84055c4a..53dd158f6 100644
--- a/src/jtag/drivers/usb_blaster/usb_blaster.c
+++ b/src/jtag/drivers/usb_blaster/usb_blaster.c
@@ -474,11 +474,9 @@ static void ublast_tms(struct tms_command *cmd)
*/
static void ublast_path_move(struct pathmove_command *cmd)
{
- int i;
-
- LOG_DEBUG_IO("(num_states=%d, last_state=%d)",
+ LOG_DEBUG_IO("(num_states=%u, last_state=%d)",
cmd->num_states, cmd->path[cmd->num_states - 1]);
- for (i = 0; i < cmd->num_states; i++) {
+ for (unsigned int i = 0; i < cmd->num_states; i++) {
if (tap_state_transition(tap_get_state(), false) == cmd->path[i])
ublast_clock_tms(0);
if (tap_state_transition(tap_get_state(), true) == cmd->path[i])
@@ -675,19 +673,19 @@ static void ublast_queue_tdi(uint8_t *bits, int nb_bits, enum scan_type scan)
ublast_idle_clock();
}
-static void ublast_runtest(int cycles, tap_state_t state)
+static void ublast_runtest(unsigned int num_cycles, tap_state_t state)
{
- LOG_DEBUG_IO("%s(cycles=%i, end_state=%d)", __func__, cycles, state);
+ LOG_DEBUG_IO("%s(cycles=%u, end_state=%d)", __func__, num_cycles, state);
ublast_state_move(TAP_IDLE, 0);
- ublast_queue_tdi(NULL, cycles, SCAN_OUT);
+ ublast_queue_tdi(NULL, num_cycles, SCAN_OUT);
ublast_state_move(state, 0);
}
-static void ublast_stableclocks(int cycles)
+static void ublast_stableclocks(unsigned int num_cycles)
{
- LOG_DEBUG_IO("%s(cycles=%i)", __func__, cycles);
- ublast_queue_tdi(NULL, cycles, SCAN_OUT);
+ LOG_DEBUG_IO("%s(cycles=%u)", __func__, num_cycles);
+ ublast_queue_tdi(NULL, num_cycles, SCAN_OUT);
}
/**
diff --git a/src/jtag/drivers/usbprog.c b/src/jtag/drivers/usbprog.c
index 2d666d072..6e3b3ba24 100644
--- a/src/jtag/drivers/usbprog.c
+++ b/src/jtag/drivers/usbprog.c
@@ -37,7 +37,7 @@
static void usbprog_end_state(tap_state_t state);
static void usbprog_state_move(void);
static void usbprog_path_move(struct pathmove_command *cmd);
-static void usbprog_runtest(int num_cycles);
+static void usbprog_runtest(unsigned int num_cycles);
static void usbprog_scan(bool ir_scan, enum scan_type type, uint8_t *buffer, int scan_size);
#define UNKNOWN_COMMAND 0x00
@@ -101,7 +101,7 @@ static int usbprog_execute_queue(struct jtag_command *cmd_queue)
usbprog_reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst);
break;
case JTAG_RUNTEST:
- LOG_DEBUG_IO("runtest %i cycles, end in %i",
+ LOG_DEBUG_IO("runtest %u cycles, end in %i",
cmd->cmd.runtest->num_cycles,
cmd->cmd.runtest->end_state);
usbprog_end_state(cmd->cmd.runtest->end_state);
@@ -113,7 +113,7 @@ static int usbprog_execute_queue(struct jtag_command *cmd_queue)
usbprog_state_move();
break;
case JTAG_PATHMOVE:
- LOG_DEBUG_IO("pathmove: %i states, end in %i",
+ LOG_DEBUG_IO("pathmove: %u states, end in %i",
cmd->cmd.pathmove->num_states,
cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]);
usbprog_path_move(cmd->cmd.pathmove);
@@ -189,7 +189,7 @@ static void usbprog_state_move(void)
static void usbprog_path_move(struct pathmove_command *cmd)
{
- int num_states = cmd->num_states;
+ unsigned int num_states = cmd->num_states;
int state_count;
/* There may be queued transitions, and before following a specified
@@ -222,10 +222,8 @@ static void usbprog_path_move(struct pathmove_command *cmd)
tap_set_end_state(tap_get_state());
}
-static void usbprog_runtest(int num_cycles)
+static void usbprog_runtest(unsigned int num_cycles)
{
- int i;
-
/* only do a state_move when we're not already in IDLE */
if (tap_get_state() != TAP_IDLE) {
usbprog_end_state(TAP_IDLE);
@@ -241,7 +239,7 @@ static void usbprog_runtest(int num_cycles)
/* LOG_INFO("NUM CYCLES %i",num_cycles); */
}
- for (i = 0; i < num_cycles; i++) {
+ for (unsigned int i = 0; i < num_cycles; i++) {
usbprog_write(1, 0, 0);
usbprog_write(0, 0, 0);
}
diff --git a/src/jtag/drivers/vdebug.c b/src/jtag/drivers/vdebug.c
index f1fc4535f..31f50b561 100644
--- a/src/jtag/drivers/vdebug.c
+++ b/src/jtag/drivers/vdebug.c
@@ -931,11 +931,11 @@ static int vdebug_jtag_tms_seq(const uint8_t *tms, int num, uint8_t f_flush)
static int vdebug_jtag_path_move(struct pathmove_command *cmd, uint8_t f_flush)
{
uint8_t tms[DIV_ROUND_UP(cmd->num_states, 8)];
- LOG_DEBUG_IO("path num states %d", cmd->num_states);
+ LOG_DEBUG_IO("path num states %u", cmd->num_states);
memset(tms, 0, DIV_ROUND_UP(cmd->num_states, 8));
- for (uint8_t i = 0; i < cmd->num_states; i++) {
+ for (unsigned int i = 0; i < cmd->num_states; i++) {
if (tap_state_transition(tap_get_state(), true) == cmd->path[i])
buf_set_u32(tms, i, 1, 1);
tap_set_state(cmd->path[i]);
@@ -971,9 +971,9 @@ static int vdebug_jtag_scan(struct scan_command *cmd, uint8_t f_flush)
uint8_t tms_post = tap_get_tms_path(state, cmd->end_state);
uint8_t num_post = tap_get_tms_path_len(state, cmd->end_state);
int num_bits = jtag_scan_size(cmd);
- LOG_DEBUG_IO("scan len:%d fields:%d ir/!dr:%d state cur:%x end:%x",
+ LOG_DEBUG_IO("scan len:%d fields:%u ir/!dr:%d state cur:%x end:%x",
num_bits, cmd->num_fields, cmd->ir_scan, cur, cmd->end_state);
- for (int i = 0; i < cmd->num_fields; i++) {
+ for (unsigned int i = 0; i < cmd->num_fields; i++) {
uint8_t cur_num_pre = i == 0 ? num_pre : 0;
uint8_t cur_tms_pre = i == 0 ? tms_pre : 0;
uint8_t cur_num_post = i == cmd->num_fields - 1 ? num_post : 0;
@@ -992,24 +992,24 @@ static int vdebug_jtag_scan(struct scan_command *cmd, uint8_t f_flush)
return rc;
}
-static int vdebug_jtag_runtest(int cycles, tap_state_t state, uint8_t f_flush)
+static int vdebug_jtag_runtest(unsigned int num_cycles, tap_state_t state, uint8_t f_flush)
{
tap_state_t cur = tap_get_state();
uint8_t tms_pre = tap_get_tms_path(cur, state);
uint8_t num_pre = tap_get_tms_path_len(cur, state);
- LOG_DEBUG_IO("idle len:%d state cur:%x end:%x", cycles, cur, state);
- int rc = vdebug_jtag_shift_tap(vdc.hsocket, pbuf, num_pre, tms_pre, cycles, NULL, 0, 0, NULL, f_flush);
+ LOG_DEBUG_IO("idle len:%u state cur:%x end:%x", num_cycles, cur, state);
+ int rc = vdebug_jtag_shift_tap(vdc.hsocket, pbuf, num_pre, tms_pre, num_cycles, NULL, 0, 0, NULL, f_flush);
if (cur != state)
tap_set_state(state);
return rc;
}
-static int vdebug_jtag_stableclocks(int num, uint8_t f_flush)
+static int vdebug_jtag_stableclocks(unsigned int num_cycles, uint8_t f_flush)
{
- LOG_DEBUG("stab len:%d state cur:%x", num, tap_get_state());
+ LOG_DEBUG("stab len:%u state cur:%x", num_cycles, tap_get_state());
- return vdebug_jtag_shift_tap(vdc.hsocket, pbuf, 0, 0, num, NULL, 0, 0, NULL, f_flush);
+ return vdebug_jtag_shift_tap(vdc.hsocket, pbuf, 0, 0, num_cycles, NULL, 0, 0, NULL, f_flush);
}
static int vdebug_sleep(int us)
diff --git a/src/jtag/drivers/vsllink.c b/src/jtag/drivers/vsllink.c
index 34525d546..ca142177e 100644
--- a/src/jtag/drivers/vsllink.c
+++ b/src/jtag/drivers/vsllink.c
@@ -43,10 +43,10 @@ static struct pending_scan_result
/* Queue command functions */
static void vsllink_end_state(tap_state_t state);
static void vsllink_state_move(void);
-static void vsllink_path_move(int num_states, tap_state_t *path);
+static void vsllink_path_move(unsigned int num_states, tap_state_t *path);
static void vsllink_tms(int num_bits, const uint8_t *bits);
-static void vsllink_runtest(int num_cycles);
-static void vsllink_stableclocks(int num_cycles, int tms);
+static void vsllink_runtest(unsigned int num_cycles);
+static void vsllink_stableclocks(unsigned int num_cycles, int tms);
static void vsllink_scan(bool ir_scan, enum scan_type type,
uint8_t *buffer, int scan_size, struct scan_command *command);
static int vsllink_reset(int trst, int srst);
@@ -98,7 +98,7 @@ static int vsllink_execute_queue(struct jtag_command *cmd_queue)
while (cmd) {
switch (cmd->type) {
case JTAG_RUNTEST:
- LOG_DEBUG_IO("runtest %i cycles, end in %s",
+ LOG_DEBUG_IO("runtest %u cycles, end in %s",
cmd->cmd.runtest->num_cycles,
tap_state_name(cmd->cmd.runtest->end_state));
@@ -115,7 +115,7 @@ static int vsllink_execute_queue(struct jtag_command *cmd_queue)
break;
case JTAG_PATHMOVE:
- LOG_DEBUG_IO("pathmove: %i states, end in %s",
+ LOG_DEBUG_IO("pathmove: %u states, end in %s",
cmd->cmd.pathmove->num_states,
tap_state_name(cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]));
@@ -161,7 +161,7 @@ static int vsllink_execute_queue(struct jtag_command *cmd_queue)
break;
case JTAG_STABLECLOCKS:
- LOG_DEBUG_IO("add %d clocks",
+ LOG_DEBUG_IO("add %u clocks",
cmd->cmd.stableclocks->num_cycles);
switch (tap_get_state()) {
@@ -371,9 +371,9 @@ static void vsllink_state_move(void)
tap_set_state(tap_get_end_state());
}
-static void vsllink_path_move(int num_states, tap_state_t *path)
+static void vsllink_path_move(unsigned int num_states, tap_state_t *path)
{
- for (int i = 0; i < num_states; i++) {
+ for (unsigned int i = 0; i < num_states; i++) {
if (path[i] == tap_state_transition(tap_get_state(), false))
vsllink_tap_append_step(0, 0);
else if (path[i] == tap_state_transition(tap_get_state(), true))
@@ -397,7 +397,7 @@ static void vsllink_tms(int num_bits, const uint8_t *bits)
vsllink_tap_append_step((bits[i / 8] >> (i % 8)) & 1, 0);
}
-static void vsllink_stableclocks(int num_cycles, int tms)
+static void vsllink_stableclocks(unsigned int num_cycles, int tms)
{
while (num_cycles > 0) {
vsllink_tap_append_step(tms, 0);
@@ -405,7 +405,7 @@ static void vsllink_stableclocks(int num_cycles, int tms)
}
}
-static void vsllink_runtest(int num_cycles)
+static void vsllink_runtest(unsigned int num_cycles)
{
tap_state_t saved_end_state = tap_get_end_state();
diff --git a/src/jtag/drivers/xds110.c b/src/jtag/drivers/xds110.c
index 11fbaaab2..f25208774 100644
--- a/src/jtag/drivers/xds110.c
+++ b/src/jtag/drivers/xds110.c
@@ -1669,7 +1669,6 @@ static void xds110_execute_tlr_reset(struct jtag_command *cmd)
static void xds110_execute_pathmove(struct jtag_command *cmd)
{
- uint32_t i;
uint32_t num_states;
uint8_t *path;
@@ -1685,7 +1684,7 @@ static void xds110_execute_pathmove(struct jtag_command *cmd)
}
/* Convert requested path states into XDS API states */
- for (i = 0; i < num_states; i++)
+ for (unsigned int i = 0; i < num_states; i++)
path[i] = (uint8_t)xds_jtag_state[cmd->cmd.pathmove->path[i]];
if (xds110.firmware >= OCD_FIRMWARE_VERSION) {
@@ -1704,7 +1703,6 @@ static void xds110_execute_pathmove(struct jtag_command *cmd)
static void xds110_queue_scan(struct jtag_command *cmd)
{
- int i;
uint32_t offset;
uint32_t total_fields;
uint32_t total_bits;
@@ -1715,7 +1713,7 @@ static void xds110_queue_scan(struct jtag_command *cmd)
/* Calculate the total number of bits to scan */
total_bits = 0;
total_fields = 0;
- for (i = 0; i < cmd->cmd.scan->num_fields; i++) {
+ for (unsigned int i = 0; i < cmd->cmd.scan->num_fields; i++) {
total_fields++;
total_bits += (uint32_t)cmd->cmd.scan->fields[i].num_bits;
}
@@ -1756,7 +1754,7 @@ static void xds110_queue_scan(struct jtag_command *cmd)
buffer = &xds110.txn_requests[xds110.txn_request_size];
/* Clear data out buffer to default value of all zeros */
memset((void *)buffer, 0x00, total_bytes);
- for (i = 0; i < cmd->cmd.scan->num_fields; i++) {
+ for (unsigned int i = 0; i < cmd->cmd.scan->num_fields; i++) {
if (cmd->cmd.scan->fields[i].out_value) {
/* Copy over data to scan out into request buffer */
bit_copy(buffer, offset, cmd->cmd.scan->fields[i].out_value, 0,
@@ -1775,7 +1773,7 @@ static void xds110_queue_scan(struct jtag_command *cmd)
static void xds110_queue_runtest(struct jtag_command *cmd)
{
- uint32_t clocks = (uint32_t)cmd->cmd.stableclocks->num_cycles;
+ uint32_t clocks = cmd->cmd.stableclocks->num_cycles;
uint8_t end_state = (uint8_t)xds_jtag_state[cmd->cmd.runtest->end_state];
/* Check if new request would be too large to fit */
@@ -1794,7 +1792,7 @@ static void xds110_queue_runtest(struct jtag_command *cmd)
static void xds110_queue_stableclocks(struct jtag_command *cmd)
{
- uint32_t clocks = (uint32_t)cmd->cmd.stableclocks->num_cycles;
+ uint32_t clocks = cmd->cmd.stableclocks->num_cycles;
/* Check if new request would be too large to fit */
if ((xds110.txn_request_size + 1 + sizeof(clocks) + 1) > MAX_DATA_BLOCK)
diff --git a/src/jtag/drivers/xlnx-pcie-xvc.c b/src/jtag/drivers/xlnx-pcie-xvc.c
index 233ade3f8..b5c7e2fd6 100644
--- a/src/jtag/drivers/xlnx-pcie-xvc.c
+++ b/src/jtag/drivers/xlnx-pcie-xvc.c
@@ -128,7 +128,7 @@ static int xlnx_pcie_xvc_execute_stableclocks(struct jtag_command *cmd)
size_t write;
int err;
- LOG_DEBUG("stableclocks %i cycles", cmd->cmd.runtest->num_cycles);
+ LOG_DEBUG("stableclocks %u cycles", cmd->cmd.runtest->num_cycles);
while (left) {
write = MIN(XLNX_XVC_MAX_BITS, left);
@@ -167,7 +167,7 @@ static int xlnx_pcie_xvc_execute_runtest(struct jtag_command *cmd)
{
int err = ERROR_OK;
- LOG_DEBUG("runtest %i cycles, end in %i",
+ LOG_DEBUG("runtest %u cycles, end in %i",
cmd->cmd.runtest->num_cycles,
cmd->cmd.runtest->end_state);
@@ -200,16 +200,15 @@ static int xlnx_pcie_xvc_execute_runtest(struct jtag_command *cmd)
static int xlnx_pcie_xvc_execute_pathmove(struct jtag_command *cmd)
{
- size_t num_states = cmd->cmd.pathmove->num_states;
+ unsigned int num_states = cmd->cmd.pathmove->num_states;
tap_state_t *path = cmd->cmd.pathmove->path;
int err = ERROR_OK;
- size_t i;
- LOG_DEBUG("pathmove: %i s...
[truncated message content] |
|
From: openocd-gerrit <ope...@us...> - 2024-08-02 16:02:51
|
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 42450345dd0cc2eb9fb18d8f794a6b57107bb242 (commit)
from 4fac13827feaf95554a54719278fbd890df40c67 (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 42450345dd0cc2eb9fb18d8f794a6b57107bb242
Author: Marc Schink <de...@za...>
Date: Wed Jul 17 16:59:51 2024 +0200
jtag: Use 'unsigned int' for 'ir_length'
This patch modifies as little code as possible in order to simplify the
review. Data types that are affected by these changes will be modified
in following patches.
Change-Id: I83921d70e017095d63547e0bc9fe61779191d9d0
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8403
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/jtag/core.c b/src/jtag/core.c
index 939199462..9aa755769 100644
--- a/src/jtag/core.c
+++ b/src/jtag/core.c
@@ -1396,7 +1396,7 @@ static int jtag_validate_ircapture(void)
&& tap->ir_length < JTAG_IRLEN_MAX) {
tap->ir_length++;
}
- LOG_WARNING("AUTO %s - use \"jtag newtap %s %s -irlen %d "
+ LOG_WARNING("AUTO %s - use \"jtag newtap %s %s -irlen %u "
"-expected-id 0x%08" PRIx32 "\"",
tap->dotted_name, tap->chip, tap->tapname, tap->ir_length, tap->idcode);
}
@@ -1472,7 +1472,7 @@ void jtag_tap_init(struct jtag_tap *tap)
jtag_tap_add(tap);
LOG_DEBUG("Created Tap: %s @ abs position %u, "
- "irlen %d, capture: 0x%x mask: 0x%x", tap->dotted_name,
+ "irlen %u, capture: 0x%x mask: 0x%x", tap->dotted_name,
tap->abs_chain_position, tap->ir_length,
(unsigned) tap->ir_capture_value,
(unsigned) tap->ir_capture_mask);
diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h
index 46ab584d9..76bfdf157 100644
--- a/src/jtag/jtag.h
+++ b/src/jtag/jtag.h
@@ -107,7 +107,7 @@ struct jtag_tap {
bool disabled_after_reset;
/** Is this TAP currently enabled? */
bool enabled;
- int ir_length; /**< size of instruction register */
+ unsigned int ir_length; /**< size of instruction register */
uint32_t ir_capture_value;
uint8_t *expected; /**< Capture-IR expected value */
uint32_t ir_capture_mask;
diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c
index 7e4d6725a..4bfbeeb42 100644
--- a/src/jtag/tcl.c
+++ b/src/jtag/tcl.c
@@ -448,11 +448,11 @@ static COMMAND_HELPER(handle_jtag_newtap_args, struct jtag_tap *tap)
if (!CMD_ARGC)
return ERROR_COMMAND_ARGUMENT_INVALID;
- COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], tap->ir_length);
+ COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], tap->ir_length);
CMD_ARGC--;
CMD_ARGV++;
- if (tap->ir_length > (int)(8 * sizeof(tap->ir_capture_value)))
- LOG_WARNING("%s: huge IR length %d", tap->dotted_name, tap->ir_length);
+ if (tap->ir_length > (8 * sizeof(tap->ir_capture_value)))
+ LOG_WARNING("%s: huge IR length %u", tap->dotted_name, tap->ir_length);
break;
case NTAP_OPT_IRMASK:
@@ -814,13 +814,13 @@ COMMAND_HANDLER(handle_scan_chain_command)
expected_mask = buf_get_u32(tap->expected_mask, 0, tap->ir_length);
command_print(CMD,
- "%2u %-18s %c 0x%08x %s %5d 0x%02x 0x%02x",
+ "%2u %-18s %c 0x%08x %s %5u 0x%02x 0x%02x",
tap->abs_chain_position,
tap->dotted_name,
tap->enabled ? 'Y' : 'n',
(unsigned int)(tap->idcode),
expected_id,
- (unsigned int)(tap->ir_length),
+ tap->ir_length,
(unsigned int)(expected),
(unsigned int)(expected_mask));
@@ -972,7 +972,7 @@ COMMAND_HANDLER(handle_irscan_command)
if (retval != ERROR_OK)
goto error_return;
- int field_size = tap->ir_length;
+ unsigned int field_size = tap->ir_length;
fields[i].num_bits = field_size;
uint8_t *v = calloc(1, DIV_ROUND_UP(field_size, 8));
if (!v) {
diff --git a/src/target/avrt.c b/src/target/avrt.c
index 61bef329f..ccce7e5e5 100644
--- a/src/target/avrt.c
+++ b/src/target/avrt.c
@@ -153,7 +153,7 @@ static int mcu_write_ir(struct jtag_tap *tap, uint8_t *ir_in, uint8_t *ir_out,
LOG_ERROR("invalid tap");
return ERROR_FAIL;
}
- if (ir_len != tap->ir_length) {
+ if ((unsigned int)ir_len != tap->ir_length) {
LOG_ERROR("invalid ir_len");
return ERROR_FAIL;
}
diff --git a/src/target/lakemont.c b/src/target/lakemont.c
index 6c0964bfa..1fcd6426a 100644
--- a/src/target/lakemont.c
+++ b/src/target/lakemont.c
@@ -224,10 +224,10 @@ static int irscan(struct target *t, uint8_t *out,
if (ir_len != t->tap->ir_length) {
retval = ERROR_FAIL;
if (t->tap->enabled)
- LOG_ERROR("%s tap enabled but tap irlen=%d",
+ LOG_ERROR("%s tap enabled but tap irlen=%u",
__func__, t->tap->ir_length);
else
- LOG_ERROR("%s tap not enabled and irlen=%d",
+ LOG_ERROR("%s tap not enabled and irlen=%u",
__func__, t->tap->ir_length);
return retval;
}
-----------------------------------------------------------------------
Summary of changes:
src/jtag/core.c | 4 ++--
src/jtag/jtag.h | 2 +-
src/jtag/tcl.c | 12 ++++++------
src/target/avrt.c | 2 +-
src/target/lakemont.c | 4 ++--
5 files changed, 12 insertions(+), 12 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|