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-01-13 14:51:49
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via ea2e26f7d521f5755b4bfda7bf12d99650277421 (commit)
from b9f5262d42f00c563750bfacea97640cda9afbdc (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 ea2e26f7d521f5755b4bfda7bf12d99650277421
Author: Antonio Borneo <bor...@gm...>
Date: Sun Aug 6 23:14:15 2023 +0200
jtag: rewrite jim_jtag_configure() as COMMAND_HANDLER
The function is used for commands:
- jtag configure
- jtag cget
While there, add the missing .usage field.
Change-Id: I97ddc4898259ddb7fd2d057a997f33a6f4b0e2a8
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8058
Tested-by: jenkins
diff --git a/src/jtag/hla/hla_transport.c b/src/jtag/hla/hla_transport.c
index c0443d835..b826eb0fe 100644
--- a/src/jtag/hla/hla_transport.c
+++ b/src/jtag/hla/hla_transport.c
@@ -127,7 +127,8 @@ static const struct command_registration hl_transport_jtag_subcommand_handlers[]
{
.name = "cget",
.mode = COMMAND_EXEC,
- .jim_handler = jim_jtag_configure,
+ .handler = handle_jtag_configure,
+ .usage = "",
},
{
.name = "names",
diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c
index 407aeb1d8..163edfa19 100644
--- a/src/jtag/tcl.c
+++ b/src/jtag/tcl.c
@@ -41,7 +41,7 @@
* Holds support for accessing JTAG-specific mechanisms from TCl scripts.
*/
-static const struct jim_nvp nvp_jtag_tap_event[] = {
+static const struct nvp nvp_jtag_tap_event[] = {
{ .value = JTAG_TRST_ASSERTED, .name = "post-reset" },
{ .value = JTAG_TAP_EVENT_SETUP, .name = "setup" },
{ .value = JTAG_TAP_EVENT_ENABLE, .name = "tap-enable" },
@@ -259,123 +259,104 @@ enum jtag_tap_cfg_param {
JCFG_IDCODE,
};
-static struct jim_nvp nvp_config_opts[] = {
+static struct nvp nvp_config_opts[] = {
{ .name = "-event", .value = JCFG_EVENT },
{ .name = "-idcode", .value = JCFG_IDCODE },
{ .name = NULL, .value = -1 }
};
-static int jtag_tap_configure_event(struct jim_getopt_info *goi, struct jtag_tap *tap)
+static int jtag_tap_set_event(struct command_context *cmd_ctx, struct jtag_tap *tap,
+ const struct nvp *event, Jim_Obj *body)
{
- if (goi->argc == 0) {
- Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "-event <event-name> ...");
- return JIM_ERR;
- }
-
- struct jim_nvp *n;
- int e = jim_getopt_nvp(goi, nvp_jtag_tap_event, &n);
- if (e != JIM_OK) {
- jim_getopt_nvp_unknown(goi, nvp_jtag_tap_event, 1);
- return e;
- }
-
- if (goi->isconfigure) {
- if (goi->argc != 1) {
- Jim_WrongNumArgs(goi->interp,
- goi->argc,
- goi->argv,
- "-event <event-name> <event-body>");
- return JIM_ERR;
- }
- } else {
- if (goi->argc != 0) {
- Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "-event <event-name>");
- return JIM_ERR;
- }
- }
+ struct jtag_tap_event_action *jteap = tap->event_action;
- struct jtag_tap_event_action *jteap = tap->event_action;
- /* replace existing event body */
- bool found = false;
while (jteap) {
- if (jteap->event == (enum jtag_event)n->value) {
- found = true;
+ if (jteap->event == (enum jtag_event)event->value)
break;
- }
jteap = jteap->next;
}
- Jim_SetEmptyResult(goi->interp);
-
- if (goi->isconfigure) {
- if (!found)
- jteap = calloc(1, sizeof(*jteap));
- else if (jteap->body)
- Jim_DecrRefCount(goi->interp, jteap->body);
+ if (!jteap) {
+ jteap = calloc(1, sizeof(*jteap));
+ if (!jteap) {
+ LOG_ERROR("Out of memory");
+ return ERROR_FAIL;
+ }
- jteap->interp = goi->interp;
- jteap->event = n->value;
+ /* add to head of event list */
+ jteap->next = tap->event_action;
+ tap->event_action = jteap;
+ } else {
+ Jim_DecrRefCount(cmd_ctx->interp, jteap->body);
+ }
- Jim_Obj *o;
- jim_getopt_obj(goi, &o);
- jteap->body = Jim_DuplicateObj(goi->interp, o);
- Jim_IncrRefCount(jteap->body);
+ jteap->interp = cmd_ctx->interp;
+ jteap->event = (enum jtag_event)event->value;
+ jteap->body = Jim_DuplicateObj(cmd_ctx->interp, body);
+ Jim_IncrRefCount(jteap->body);
- if (!found) {
- /* add to head of event list */
- jteap->next = tap->event_action;
- tap->event_action = jteap;
- }
- } else if (found) {
- jteap->interp = goi->interp;
- Jim_SetResult(goi->interp,
- Jim_DuplicateObj(goi->interp, jteap->body));
- }
- return JIM_OK;
+ return ERROR_OK;
}
-static int jtag_tap_configure_cmd(struct jim_getopt_info *goi, struct jtag_tap *tap)
+__COMMAND_HANDLER(handle_jtag_configure)
{
- /* parse config or cget options */
- while (goi->argc > 0) {
- Jim_SetEmptyResult(goi->interp);
-
- struct jim_nvp *n;
- int e = jim_getopt_nvp(goi, nvp_config_opts, &n);
- if (e != JIM_OK) {
- jim_getopt_nvp_unknown(goi, nvp_config_opts, 0);
- return e;
- }
+ bool is_configure = !strcmp(CMD_NAME, "configure");
+
+ if (CMD_ARGC < (is_configure ? 3 : 2))
+ return ERROR_COMMAND_SYNTAX_ERROR;
+ /* FIXME: rework jtag_tap_by_jim_obj */
+ struct jtag_tap *tap = jtag_tap_by_jim_obj(CMD_CTX->interp, CMD_JIMTCL_ARGV[0]);
+ if (!tap)
+ return ERROR_FAIL;
+
+ for (unsigned int i = 1; i < CMD_ARGC; i++) {
+ const struct nvp *n = nvp_name2value(nvp_config_opts, CMD_ARGV[i]);
switch (n->value) {
- case JCFG_EVENT:
- e = jtag_tap_configure_event(goi, tap);
- if (e != JIM_OK)
- return e;
- break;
- case JCFG_IDCODE:
- if (goi->isconfigure) {
- Jim_SetResultFormatted(goi->interp,
- "not settable: %s", n->name);
- return JIM_ERR;
- } else {
- if (goi->argc != 0) {
- Jim_WrongNumArgs(goi->interp,
- goi->argc, goi->argv,
- "NO PARAMS");
- return JIM_ERR;
+ case JCFG_EVENT:
+ if (i + (is_configure ? 3 : 2) >= CMD_ARGC) {
+ command_print(CMD, "wrong # args: should be \"-event <event-name>%s\"",
+ is_configure ? " <event-body>" : "");
+ return ERROR_COMMAND_ARGUMENT_INVALID;
+ }
+
+ const struct nvp *event = nvp_name2value(nvp_jtag_tap_event, CMD_ARGV[i + 1]);
+ if (!event->name) {
+ nvp_unknown_command_print(CMD, nvp_jtag_tap_event, CMD_ARGV[i], CMD_ARGV[i + 1]);
+ return ERROR_COMMAND_ARGUMENT_INVALID;
+ }
+
+ if (is_configure) {
+ int retval = jtag_tap_set_event(CMD_CTX, tap, event, CMD_JIMTCL_ARGV[i + 2]);
+ if (retval != ERROR_OK)
+ return retval;
+ } else {
+ struct jtag_tap_event_action *jteap = tap->event_action;
+ while (jteap) {
+ if (jteap->event == (enum jtag_event)event->value) {
+ command_print(CMD, "%s", Jim_GetString(jteap->body, NULL));
+ break;
}
+ jteap = jteap->next;
}
- Jim_SetResult(goi->interp, Jim_NewIntObj(goi->interp, tap->idcode));
- break;
- default:
- Jim_SetResultFormatted(goi->interp, "unknown value: %s", n->name);
- return JIM_ERR;
+ }
+
+ i += is_configure ? 2 : 1;
+ break;
+ case JCFG_IDCODE:
+ if (is_configure) {
+ command_print(CMD, "not settable: %s", n->name);
+ return ERROR_COMMAND_ARGUMENT_INVALID;
+ }
+ command_print(CMD, "0x%08x", tap->idcode);
+ break;
+ default:
+ nvp_unknown_command_print(CMD, nvp_config_opts, NULL, CMD_ARGV[i]);
+ return ERROR_COMMAND_ARGUMENT_INVALID;
}
}
-
- return JIM_OK;
+ return ERROR_OK;
}
#define NTAP_OPT_IRLEN 0
@@ -558,7 +539,7 @@ static void jtag_tap_handle_event(struct jtag_tap *tap, enum jtag_event e)
if (jteap->event != e)
continue;
- struct jim_nvp *nvp = jim_nvp_value2name_simple(nvp_jtag_tap_event, e);
+ const struct nvp *nvp = nvp_value2name(nvp_jtag_tap_event, e);
LOG_DEBUG("JTAG tap: %s event: %d (%s)\n\taction: %s",
tap->dotted_name, e, nvp->name,
Jim_GetString(jteap->body, NULL));
@@ -675,30 +656,6 @@ __COMMAND_HANDLER(handle_jtag_tap_enabler)
return ERROR_OK;
}
-int jim_jtag_configure(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
-{
- struct command *c = jim_to_command(interp);
- const char *cmd_name = c->name;
- struct jim_getopt_info goi;
- jim_getopt_setup(&goi, interp, argc-1, argv + 1);
- goi.isconfigure = !strcmp(cmd_name, "configure");
- if (goi.argc < 2 + goi.isconfigure) {
- Jim_WrongNumArgs(goi.interp, 0, NULL,
- "<tap_name> <attribute> ...");
- return JIM_ERR;
- }
-
- struct jtag_tap *t;
-
- Jim_Obj *o;
- jim_getopt_obj(&goi, &o);
- t = jtag_tap_by_jim_obj(goi.interp, o);
- if (!t)
- return JIM_ERR;
-
- return jtag_tap_configure_cmd(&goi, t);
-}
-
COMMAND_HANDLER(handle_jtag_names)
{
if (CMD_ARGC != 0)
@@ -793,7 +750,7 @@ static const struct command_registration jtag_subcommand_handlers[] = {
{
.name = "configure",
.mode = COMMAND_ANY,
- .jim_handler = jim_jtag_configure,
+ .handler = handle_jtag_configure,
.help = "Provide a Tcl handler for the specified "
"TAP event.",
.usage = "tap_name '-event' event_name handler",
@@ -801,7 +758,7 @@ static const struct command_registration jtag_subcommand_handlers[] = {
{
.name = "cget",
.mode = COMMAND_EXEC,
- .jim_handler = jim_jtag_configure,
+ .handler = handle_jtag_configure,
.help = "Return any Tcl handler for the specified "
"TAP event.",
.usage = "tap_name '-event' event_name",
diff --git a/src/jtag/tcl.h b/src/jtag/tcl.h
index 66867ab0f..4e49e8579 100644
--- a/src/jtag/tcl.h
+++ b/src/jtag/tcl.h
@@ -20,8 +20,7 @@
#include <helper/command.h>
-int jim_jtag_configure(Jim_Interp *interp, int argc,
- Jim_Obj * const *argv);
+__COMMAND_HANDLER(handle_jtag_configure);
__COMMAND_HANDLER(handle_jtag_tap_enabler);
#endif /* OPENOCD_JTAG_TCL_H */
diff --git a/src/target/adi_v5_dapdirect.c b/src/target/adi_v5_dapdirect.c
index f3a90c0b1..d198dacf3 100644
--- a/src/target/adi_v5_dapdirect.c
+++ b/src/target/adi_v5_dapdirect.c
@@ -118,7 +118,8 @@ static const struct command_registration dapdirect_jtag_subcommand_handlers[] =
{
.name = "cget",
.mode = COMMAND_EXEC,
- .jim_handler = jim_jtag_configure,
+ .handler = handle_jtag_configure,
+ .usage = "",
},
{
.name = "names",
-----------------------------------------------------------------------
Summary of changes:
src/jtag/hla/hla_transport.c | 3 +-
src/jtag/tcl.c | 197 +++++++++++++++++-------------------------
src/jtag/tcl.h | 3 +-
src/target/adi_v5_dapdirect.c | 3 +-
4 files changed, 82 insertions(+), 124 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-01-13 14:49: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 b9f5262d42f00c563750bfacea97640cda9afbdc (commit)
from b50a8dbe4116c4fa18ab066f961f04d2fb075224 (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 b9f5262d42f00c563750bfacea97640cda9afbdc
Author: Ahmed BOUDJELIDA <abo...@na...>
Date: Fri Dec 22 10:59:52 2023 +0100
contrib/firmware: Change USB interruption handling for JTAG/I2C communications
Before this change, when we send an I2C Bulk data at the same
time while Jtag bitbanging functions execute, the microcontroller
puts JTAG bitbanging on wait and executes all I2C bitbanging
function, which causes problems like loss of Ack in DAP responses
and other errors.
With this commit, When I2C interruption occurs, it sets a variable
to true and continues JTAG bitbanging, when it finish it executes
the I2C bitbang.
Change-Id: Ia80bac21f8a259f4a1176b5346bf74ed0aa6e38b
Signed-off-by: Ahmed BOUDJELIDA <abo...@na...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8074
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/contrib/firmware/angie/c/include/usb.h b/contrib/firmware/angie/c/include/usb.h
index e10947d33..ad8be787e 100644
--- a/contrib/firmware/angie/c/include/usb.h
+++ b/contrib/firmware/angie/c/include/usb.h
@@ -129,6 +129,7 @@ struct setup_data {
* the USB module */
extern volatile bool ep1_out;
extern volatile bool ep1_in;
+extern volatile bool ep6_out;
extern volatile __xdata __at 0xE6B8 struct setup_data setup_data;
diff --git a/contrib/firmware/angie/c/src/protocol.c b/contrib/firmware/angie/c/src/protocol.c
index d84534bf2..e32808db8 100644
--- a/contrib/firmware/angie/c/src/protocol.c
+++ b/contrib/firmware/angie/c/src/protocol.c
@@ -157,30 +157,36 @@ void command_loop(void)
cmd_id_index = 0;
payload_index_in = 0;
- /* Wait until host sends EP1 Bulk-OUT packet */
- while (!ep1_out)
+ /* Wait until host sends Bulk-OUT packet */
+ while ((!ep1_out) && (!ep6_out))
;
- ep1_out = false;
-
- /* Execute the commands */
- last_command = false;
- while (!last_command)
- last_command = execute_command();
-
- /* Send back EP6 Bulk-IN packet if required */
- if (payload_index_in > 0) {
- EP1INBC = payload_index_in;
+ if (ep6_out) {
+ /* Execute I2C command */
+ i2c_recieve();
+ ep6_out = false;
+ }
+ if (ep1_out) {
+ ep1_out = false;
+ /* Execute the commands */
+ last_command = false;
+ while (!last_command)
+ last_command = execute_command();
+
+ /* Send back EP1 Bulk-IN packet if required */
+ if (payload_index_in > 0) {
+ EP1INBC = payload_index_in;
+ syncdelay(3);
+
+ while (!ep1_in)
+ ;
+ ep1_in = false;
+ }
+
+ /* Re-arm EP1-OUT after command execution */
+ EP1OUTBC = 0;
+ syncdelay(3);
+ EP1OUTBC = 0;
syncdelay(3);
-
- while (!ep1_in)
- ;
- ep1_in = false;
}
-
- /* Re-arm EP1-OUT after command execution */
- EP1OUTBC = 0;
- syncdelay(3);
- EP1OUTBC = 0;
- syncdelay(3);
}
}
diff --git a/contrib/firmware/angie/c/src/usb.c b/contrib/firmware/angie/c/src/usb.c
index a137d3d37..ed23dcfa5 100644
--- a/contrib/firmware/angie/c/src/usb.c
+++ b/contrib/firmware/angie/c/src/usb.c
@@ -25,6 +25,7 @@
*/
volatile bool ep1_out;
volatile bool ep1_in;
+volatile bool ep6_out;
volatile __xdata __at 0xE6B8 struct setup_data setup_data;
@@ -195,27 +196,24 @@ void ep0out_isr(void)__interrupt EP0OUT_ISR
void ep1in_isr(void)__interrupt EP1IN_ISR
{
ep1_in = true;
-
EXIF &= ~0x10; /* Clear USBINT: Main global interrupt */
EPIRQ = 0x04; /* Clear individual EP1IN IRQ */
}
void ep1out_isr(void)__interrupt EP1OUT_ISR
{
ep1_out = true;
-
EXIF &= ~0x10; /* Clear USBINT: Main global interrupt */
EPIRQ = 0x08; /* Clear individual EP1OUT IRQ */
}
void ep2_isr(void)__interrupt EP2_ISR
{
- ep1_out = false; /* Does nothing but required by the compiler */
}
void ep4_isr(void)__interrupt EP4_ISR
{
}
void ep6_isr(void)__interrupt EP6_ISR
{
- i2c_recieve();
+ ep6_out = true;
EXIF &= ~0x10; /* Clear USBINT: Main global interrupt */
EPIRQ = 0x40; /* Clear individual EP6OUT IRQ */
diff --git a/src/jtag/drivers/angie/angie_firmware.bin b/src/jtag/drivers/angie/angie_firmware.bin
index bc8520841..68486ef8f 100644
Binary files a/src/jtag/drivers/angie/angie_firmware.bin and b/src/jtag/drivers/angie/angie_firmware.bin differ
-----------------------------------------------------------------------
Summary of changes:
contrib/firmware/angie/c/include/usb.h | 1 +
contrib/firmware/angie/c/src/protocol.c | 50 +++++++++++++++++-------------
contrib/firmware/angie/c/src/usb.c | 6 ++--
src/jtag/drivers/angie/angie_firmware.bin | Bin 10248 -> 10216 bytes
4 files changed, 31 insertions(+), 26 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-01-13 14:49:12
|
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 b50a8dbe4116c4fa18ab066f961f04d2fb075224 (commit)
from 868700e72073ca04ab71e8d03f56e5df031d5a7b (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 b50a8dbe4116c4fa18ab066f961f04d2fb075224
Author: Ahmed BOUDJELIDA <abo...@na...>
Date: Mon Dec 11 14:39:57 2023 +0100
jtag/drivers: Add GPIO extender configuration function to ANGIE driver
Add GPIO extender initial configuration that is needed to configure
some important GPIOs and ensure that the dev board is ready to work.
Add i2c_write function that make a write transfer to any slave device.
Give a new Product ID to ANGIE to make it different than the non
programmed ANGIE.
Change-Id: I0a8dacb7fe218145b7d3ed1cb75f106ed6256714
Signed-off-by: Ahmed BOUDJELIDA <abo...@na...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8072
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/contrib/firmware/angie/c/include/usb.h b/contrib/firmware/angie/c/include/usb.h
index 07cb12ae6..e10947d33 100644
--- a/contrib/firmware/angie/c/include/usb.h
+++ b/contrib/firmware/angie/c/include/usb.h
@@ -32,7 +32,6 @@
#define DESCRIPTOR_TYPE_STRING 0x03
#define DESCRIPTOR_TYPE_INTERFACE 0x04
#define DESCRIPTOR_TYPE_ENDPOINT 0x05
-#define DESCRIPTOR_TYPE_INTERFACE_ASSOCIATION 0x0B
#define STR_DESCR(len, ...) { (len) * 2 + 2, DESCRIPTOR_TYPE_STRING, { __VA_ARGS__ } }
diff --git a/contrib/firmware/angie/c/src/usb.c b/contrib/firmware/angie/c/src/usb.c
index a1b72e2d6..a137d3d37 100644
--- a/contrib/firmware/angie/c/src/usb.c
+++ b/contrib/firmware/angie/c/src/usb.c
@@ -65,17 +65,6 @@ __code struct usb_config_descriptor config_descriptor = {
.maxpower = 50 /* 100 mA */
};
-__code struct usb_interface_association_descriptor interface_association_descriptor = {
- .blength = sizeof(struct usb_interface_association_descriptor),
- .bdescriptortype = DESCRIPTOR_TYPE_INTERFACE_ASSOCIATION,
- .bfirstinterface = 0x01,
- .binterfacecount = 0x02,
- .bfunctionclass = 0x02,
- .bfunctionsubclass = 0x00,
- .bfunctionprotocol = 0x00,
- .ifunction = 0x00
-};
-
__code struct usb_interface_descriptor interface_descriptor00 = {
.blength = sizeof(struct usb_interface_descriptor),
.bdescriptortype = DESCRIPTOR_TYPE_INTERFACE,
diff --git a/doc/usb_adapters/angie/584e_424e_angie.txt b/doc/usb_adapters/angie/584e_414f_angie.txt
similarity index 89%
rename from doc/usb_adapters/angie/584e_424e_angie.txt
rename to doc/usb_adapters/angie/584e_414f_angie.txt
index d68657a98..6c25f43b3 100644
--- a/doc/usb_adapters/angie/584e_424e_angie.txt
+++ b/doc/usb_adapters/angie/584e_414f_angie.txt
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-or-later OR GFDL-1.2-no-invariants-or-later
-Bus 001 Device 029: ID 584e:424e NanoXplore, SAS. ANGIE Adapter
+Bus 002 Device 105: ID 584e:414f NanoXplore, SAS. ANGIE Adapter
Device Descriptor:
bLength 18
bDescriptorType 1
@@ -10,7 +10,7 @@ Device Descriptor:
bDeviceProtocol 1 Interface Association
bMaxPacketSize0 64
idVendor 0x584e
- idProduct 0x424e
+ idProduct 0x414f
bcdDevice 0.00
iManufacturer 1 NanoXplore, SAS.
iProduct 2 ANGIE Adapter
@@ -26,15 +26,6 @@ Device Descriptor:
bmAttributes 0x80
(Bus Powered)
MaxPower 100mA
- Interface Association:
- bLength 8
- bDescriptorType 11
- bFirstInterface 1
- bInterfaceCount 2
- bFunctionClass 2 Communications
- bFunctionSubClass 0
- bFunctionProtocol 0
- iFunction 0
Interface Descriptor:
bLength 9
bDescriptorType 4
diff --git a/src/jtag/drivers/angie.c b/src/jtag/drivers/angie.c
index d4219d3c5..dfe65a208 100644
--- a/src/jtag/drivers/angie.c
+++ b/src/jtag/drivers/angie.c
@@ -167,7 +167,8 @@ static int angie_load_firmware_and_renumerate(struct angie *device, const char *
uint32_t delay_us);
static int angie_load_firmware(struct angie *device, const char *filename);
static int angie_load_bitstream(struct angie *device, const char *filename);
-
+static int angie_i2c_write(struct angie *device, uint8_t *i2c_data, uint8_t i2c_data_size);
+static void angie_io_extender_config(struct angie *device, uint8_t i2c_adr, uint8_t cfg_value, uint8_t value);
static int angie_write_firmware_section(struct angie *device,
struct image *firmware_image, int section_index);
@@ -338,7 +339,15 @@ static int angie_load_firmware_and_renumerate(struct angie *device,
usleep(delay_us);
- return angie_usb_open(device);
+ ret = angie_usb_open(device);
+ if (ret != ERROR_OK)
+ return ret;
+
+ ret = libusb_claim_interface(angie_handle->usb_device_handle, 0);
+ if (ret != LIBUSB_SUCCESS)
+ return ERROR_FAIL;
+
+ return ERROR_OK;
}
/**
@@ -475,6 +484,72 @@ static int angie_load_bitstream(struct angie *device, const char *filename)
return ERROR_OK;
}
+/**
+ * Send an i2c write operation to dev-board components.
+ *
+ * @param device pointer to struct angie identifying ANGIE driver instance.
+ * @param i2c_data table of i2c data that we want to write to slave device.
+ * @param i2c_data_size the size of i2c data table.
+ * @return on success: ERROR_OK
+ * @return on failure: ERROR_FAIL
+ */
+static int angie_i2c_write(struct angie *device, uint8_t *i2c_data, uint8_t i2c_data_size)
+{
+ char i2c_data_buffer[i2c_data_size + 2];
+ char buffer_received[1];
+ int ret, transferred;
+ i2c_data_buffer[0] = 0; // write = 0
+ i2c_data_buffer[1] = i2c_data_size - 1; // i2c_data count (without address)
+
+ for (uint8_t i = 0; i < i2c_data_size; i++)
+ i2c_data_buffer[i + 2] = i2c_data[i];
+
+ // Send i2c packet to Dev-board and configure its clock source /
+ ret = jtag_libusb_bulk_write(device->usb_device_handle, 0x06, i2c_data_buffer,
+ i2c_data_size + 2, 1000, &transferred);
+ if (ret != ERROR_OK) {
+ LOG_ERROR("Error in i2c clock gen configuration : ret ERROR");
+ angie_quit();
+ return ret;
+ }
+ if (transferred != i2c_data_size + 2) {
+ LOG_ERROR("Error in i2c clock gen configuration : bytes transferred");
+ angie_quit();
+ return ERROR_FAIL;
+ }
+
+ usleep(500);
+
+ // Receive packet from ANGIE /
+ ret = jtag_libusb_bulk_write(device->usb_device_handle, 0x88, buffer_received, 1, 1000, &transferred);
+ if (ret != ERROR_OK) {
+ LOG_ERROR("Error in i2c clock gen configuration : ret ERROR");
+ angie_quit();
+ return ret;
+ }
+ return ERROR_OK;
+}
+
+/**
+ * Configure dev-board gpio extender modules by configuring their
+ * register 3 and register 1 responsible for IO directions and values.
+ *
+ * @param device pointer to struct angie identifying ANGIE driver instance.
+ * @param i2c_adr i2c address of the gpio extender.
+ * @param cfg_value IOs configuration to be written in register Number 3.
+ * @param value the IOs value to be written in register Number 1.
+ * @return on success: ERROR_OK
+ * @return on failure: ERROR_FAIL
+ */
+static void angie_io_extender_config(struct angie *device, uint8_t i2c_adr, uint8_t cfg_value, uint8_t value)
+{
+ uint8_t ioconfig[3] = {i2c_adr, 3, cfg_value};
+ angie_i2c_write(device, ioconfig, 3);
+ uint8_t iovalue[3] = {i2c_adr, 1, value};
+ angie_i2c_write(device, iovalue, 3);
+ usleep(500);
+}
+
/**
* Send one contiguous firmware section to the ANGIE's EZ-USB microcontroller
* over the USB bus.
@@ -2175,7 +2250,7 @@ static int angie_init(void)
if (download_firmware) {
LOG_INFO("Loading ANGIE firmware. This is reversible by power-cycling ANGIE device.");
- if (libusb_claim_interface(angie_handle->usb_device_handle, 0) != ERROR_OK)
+ if (libusb_claim_interface(angie_handle->usb_device_handle, 0) != LIBUSB_SUCCESS)
LOG_ERROR("Could not claim interface");
ret = angie_load_firmware_and_renumerate(angie_handle,
@@ -2191,14 +2266,49 @@ static int angie_init(void)
angie_quit();
return ret;
}
+ if (libusb_claim_interface(angie_handle->usb_device_handle, 1) != LIBUSB_SUCCESS) {
+ LOG_ERROR("Could not claim interface 1");
+ angie_quit();
+ return ERROR_FAIL;
+ }
+ angie_io_extender_config(angie_handle, 0x22, 0xFF, 0xFF);
+ if (ret != ERROR_OK) {
+ LOG_ERROR("Could not configure io extender 22");
+ angie_quit();
+ return ret;
+ }
+ angie_io_extender_config(angie_handle, 0x23, 0xFF, 0xFF);
+ if (ret != ERROR_OK) {
+ LOG_ERROR("Could not configure io extender 23");
+ angie_quit();
+ return ret;
+ }
+ angie_io_extender_config(angie_handle, 0x24, 0x1F, 0x9F);
+ if (ret != ERROR_OK) {
+ LOG_ERROR("Could not configure io extender 24");
+ angie_quit();
+ return ret;
+ }
+ angie_io_extender_config(angie_handle, 0x25, 0x07, 0x00);
+ if (ret != ERROR_OK) {
+ LOG_ERROR("Could not configure io extender 25");
+ angie_quit();
+ return ret;
+ }
+ if (libusb_release_interface(angie_handle->usb_device_handle, 1) != LIBUSB_SUCCESS) {
+ LOG_ERROR("Fail release interface 1");
+ angie_quit();
+ return ERROR_FAIL;
+ }
} else {
LOG_INFO("ANGIE device is already running ANGIE firmware");
}
/* Get ANGIE USB IN/OUT endpoints and claim the interface */
ret = jtag_libusb_choose_interface(angie_handle->usb_device_handle,
- &angie_handle->ep_in, &angie_handle->ep_out, -1, -1, -1, -1);
+ &angie_handle->ep_in, &angie_handle->ep_out, 0xFF, 0, 0, -1);
if (ret != ERROR_OK) {
+ LOG_ERROR("Choose and claim interface failed");
angie_quit();
return ret;
}
diff --git a/src/jtag/drivers/angie/angie_firmware.bin b/src/jtag/drivers/angie/angie_firmware.bin
index c793abb2f..bc8520841 100644
Binary files a/src/jtag/drivers/angie/angie_firmware.bin and b/src/jtag/drivers/angie/angie_firmware.bin differ
-----------------------------------------------------------------------
Summary of changes:
contrib/firmware/angie/c/include/usb.h | 1 -
contrib/firmware/angie/c/src/usb.c | 11 --
.../{584e_424e_angie.txt => 584e_414f_angie.txt} | 13 +--
src/jtag/drivers/angie.c | 118 ++++++++++++++++++++-
src/jtag/drivers/angie/angie_firmware.bin | Bin 10256 -> 10248 bytes
5 files changed, 116 insertions(+), 27 deletions(-)
rename doc/usb_adapters/angie/{584e_424e_angie.txt => 584e_414f_angie.txt} (89%)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-01-13 14:48:46
|
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 868700e72073ca04ab71e8d03f56e5df031d5a7b (commit)
from 74807daeb36a3be891913d2e03e58d0a23b6fcb9 (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 868700e72073ca04ab71e8d03f56e5df031d5a7b
Author: Ahmed BOUDJELIDA <abo...@na...>
Date: Wed Dec 6 15:28:16 2023 +0100
jtag/drivers: give ANGIE a new PID after renumeration
Give ANGIE a new PID after renumeration to be able to distinguish
the two cases (programmed and not programmed)
Change-Id: I30a91d8ed2e8e261221488b98d40a027ca41da52
Signed-off-by: Ahmed BOUDJELIDA <abo...@na...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7991
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/contrib/60-openocd.rules b/contrib/60-openocd.rules
index b0e229d07..fe8b00cb7 100644
--- a/contrib/60-openocd.rules
+++ b/contrib/60-openocd.rules
@@ -225,6 +225,7 @@ ATTRS{idVendor}=="303a", ATTRS{idProduct}=="1001", MODE="660", GROUP="plugdev",
ATTRS{idVendor}=="303a", ATTRS{idProduct}=="1002", MODE="660", GROUP="plugdev", TAG+="uaccess"
# ANGIE USB-JTAG Adapter
+ATTRS{idVendor}=="584e", ATTRS{idProduct}=="414f", MODE="660", GROUP="plugdev", TAG+="uaccess"
ATTRS{idVendor}=="584e", ATTRS{idProduct}=="424e", MODE="660", GROUP="plugdev", TAG+="uaccess"
ATTRS{idVendor}=="584e", ATTRS{idProduct}=="4255", MODE="660", GROUP="plugdev", TAG+="uaccess"
ATTRS{idVendor}=="584e", ATTRS{idProduct}=="4355", MODE="660", GROUP="plugdev", TAG+="uaccess"
diff --git a/contrib/firmware/angie/c/Makefile b/contrib/firmware/angie/c/Makefile
index e919cd011..1bcc1f7d1 100644
--- a/contrib/firmware/angie/c/Makefile
+++ b/contrib/firmware/angie/c/Makefile
@@ -74,3 +74,6 @@ clean:
bin: angie_firmware.ihx
makebin -p angie_firmware.ihx angie_firmware.bin
+
+hex: angie_firmware.ihx
+ $(PACKIHX) angie_firmware.ihx > fx2.hex
diff --git a/contrib/firmware/angie/c/src/usb.c b/contrib/firmware/angie/c/src/usb.c
index de1964130..a1b72e2d6 100644
--- a/contrib/firmware/angie/c/src/usb.c
+++ b/contrib/firmware/angie/c/src/usb.c
@@ -42,7 +42,7 @@ __code struct usb_device_descriptor device_descriptor = {
.bdeviceprotocol = 0x01,
.bmaxpacketsize0 = 64,
.idvendor = 0x584e,
- .idproduct = 0x424e,
+ .idproduct = 0x414f,
.bcddevice = 0x0000,
.imanufacturer = 1,
.iproduct = 2,
diff --git a/src/jtag/drivers/angie.c b/src/jtag/drivers/angie.c
index 79195a947..d4219d3c5 100644
--- a/src/jtag/drivers/angie.c
+++ b/src/jtag/drivers/angie.c
@@ -31,10 +31,11 @@
/** USB Product ID of ANGIE device in unconfigured state (no firmware loaded
* yet) or with its firmware. */
-#define ANGIE_PID 0x424e
-#define ANGIE_PID_2 0x4255
-#define ANGIE_PID_3 0x4355
-#define ANGIE_PID_4 0x4a55
+#define ANGIE_PID 0x414F
+#define ANGIE_PID_2 0x424e
+#define ANGIE_PID_3 0x4255
+#define ANGIE_PID_4 0x4355
+#define ANGIE_PID_5 0x4a55
/** Address of EZ-USB ANGIE CPU Control & Status register. This register can be
* written by issuing a Control EP0 vendor request. */
@@ -255,8 +256,8 @@ static struct angie *angie_handle;
static int angie_usb_open(struct angie *device)
{
struct libusb_device_handle *usb_device_handle;
- const uint16_t vids[] = {ANGIE_VID, ANGIE_VID, ANGIE_VID, ANGIE_VID, 0};
- const uint16_t pids[] = {ANGIE_PID, ANGIE_PID_2, ANGIE_PID_3, ANGIE_PID_4, 0};
+ const uint16_t vids[] = {ANGIE_VID, ANGIE_VID, ANGIE_VID, ANGIE_VID, ANGIE_VID, 0};
+ const uint16_t pids[] = {ANGIE_PID, ANGIE_PID_2, ANGIE_PID_3, ANGIE_PID_4, ANGIE_PID_5, 0};
int ret = jtag_libusb_open(vids, pids, NULL, &usb_device_handle, NULL);
diff --git a/src/jtag/drivers/angie/angie_firmware.bin b/src/jtag/drivers/angie/angie_firmware.bin
index 23c4a8234..c793abb2f 100644
Binary files a/src/jtag/drivers/angie/angie_firmware.bin and b/src/jtag/drivers/angie/angie_firmware.bin differ
-----------------------------------------------------------------------
Summary of changes:
contrib/60-openocd.rules | 1 +
contrib/firmware/angie/c/Makefile | 3 +++
contrib/firmware/angie/c/src/usb.c | 2 +-
src/jtag/drivers/angie.c | 13 +++++++------
src/jtag/drivers/angie/angie_firmware.bin | Bin 10256 -> 10256 bytes
5 files changed, 12 insertions(+), 7 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-01-13 14:48:22
|
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 74807daeb36a3be891913d2e03e58d0a23b6fcb9 (commit)
from c7073853ebcbb8a94af0ef405cb05f94b7fd02e5 (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 74807daeb36a3be891913d2e03e58d0a23b6fcb9
Author: Ahmed BOUDJELIDA <abo...@na...>
Date: Mon Dec 4 10:58:05 2023 +0100
jtag/drivers: correct the angie_reset function
remove angie_clear_queue function from executing before the
angie_execute_queued_commands function and making it at the
end of the reset function.
Change-Id: Id8a0664fbd5b8f9730545ce0f8f272ae0b0e7e78
Signed-off-by: Ahmed BOUDJELIDA <abo...@na...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7990
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/jtag/drivers/angie.c b/src/jtag/drivers/angie.c
index b7d1f8ac3..79195a947 100644
--- a/src/jtag/drivers/angie.c
+++ b/src/jtag/drivers/angie.c
@@ -1725,14 +1725,16 @@ static int angie_reset(int trst, int srst)
high |= SIGNAL_SRST;
int ret = angie_append_set_signals_cmd(device, low, high);
- if (ret == ERROR_OK)
- angie_clear_queue(device);
+ if (ret != ERROR_OK)
+ return ret;
ret = angie_execute_queued_commands(device, LIBUSB_TIMEOUT_MS);
- if (ret == ERROR_OK)
- angie_clear_queue(device);
+ if (ret != ERROR_OK)
+ return ret;
- return ret;
+ angie_clear_queue(device);
+
+ return ERROR_OK;
}
/**
-----------------------------------------------------------------------
Summary of changes:
src/jtag/drivers/angie.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-01-13 14:48:01
|
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 c7073853ebcbb8a94af0ef405cb05f94b7fd02e5 (commit)
from 995a7af21d6f97f628382e26dc21dc38e4fa846e (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 c7073853ebcbb8a94af0ef405cb05f94b7fd02e5
Author: Ahmed BOUDJELIDA <abo...@na...>
Date: Wed Nov 29 15:21:27 2023 +0100
contrib/firmware: Add direction control for 'SCL' i2c signal
We want to keep the tri-state buffers located between the FPGA
and the board, in 'Z' state until we launch an i2c connection.
We launch an i2c start condition, make the SCL
direction 'OUT' to start the i2c protocol and at the end
of the i2c connection at the stop condition, we re-make
the tri-state buffers at 'Z' state.
Change-Id: Ic597a70d0427832547f6b539864c24ce20a18c64
Signed-off-by: Ahmed BOUDJELIDA <abo...@na...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7989
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/contrib/firmware/angie/c/include/io.h b/contrib/firmware/angie/c/include/io.h
index af488f4ed..19289d11d 100644
--- a/contrib/firmware/angie/c/include/io.h
+++ b/contrib/firmware/angie/c/include/io.h
@@ -66,7 +66,7 @@
#define PIN_SDA IOD0
#define PIN_SCL IOD1
#define PIN_SDA_DIR IOD2
-/* PD3 Not Connected */
+#define PIN_SCL_DIR IOD3
/* PD4 Not Connected */
/* PD5 Not Connected */
/* PD6 Not Connected */
diff --git a/contrib/firmware/angie/c/src/i2c.c b/contrib/firmware/angie/c/src/i2c.c
index 53840100b..10a463bf7 100644
--- a/contrib/firmware/angie/c/src/i2c.c
+++ b/contrib/firmware/angie/c/src/i2c.c
@@ -14,6 +14,9 @@
void start_cd(void)
{
+ PIN_SCL_DIR = 0;
+ PIN_SDA_DIR = 0;
+ delay_us(10);
PIN_SDA = 0; //SDA = 1;
delay_us(1);
PIN_SCL = 0; //SCL = 1;
@@ -40,6 +43,10 @@ void stop_cd(void)
delay_us(1);
PIN_SDA = 1;
delay_us(1);
+ PIN_SDA_DIR = 1;
+ delay_us(1);
+ PIN_SCL_DIR = 1;
+ delay_us(1);
}
void clock_cd(void)
diff --git a/contrib/firmware/angie/c/src/usb.c b/contrib/firmware/angie/c/src/usb.c
index 1b7aa4765..de1964130 100644
--- a/contrib/firmware/angie/c/src/usb.c
+++ b/contrib/firmware/angie/c/src/usb.c
@@ -886,9 +886,6 @@ void io_init(void)
PORTACFG = 0x01; /* 0: normal ou 1: alternate function (each bit) */
OEA = 0xEF; /* all OUT exept INIT_B IN */
IOA = 0xFF;
- PIN_RDWR_B = 1;
- PIN_CSI_B = 1;
- PIN_PROGRAM_B = 1;
/* PORT B */
OEB = 0xEF; /* all OUT exept TDO */
@@ -899,8 +896,6 @@ void io_init(void)
PIN_TDI = 0;
PIN_SRST = 1;
-
-
/* PORT C */
PORTCCFG = 0x00; /* 0: normal ou 1: alternate function (each bit) */
OEC = 0xFF;
@@ -909,5 +904,4 @@ void io_init(void)
/* PORT D */
OED = 0xFF;
IOD = 0xFF;
- PIN_SDA_DIR = 0;
}
diff --git a/contrib/firmware/angie/hdl/src/angie_bitstream.ucf b/contrib/firmware/angie/hdl/src/angie_bitstream.ucf
index 92a89c99e..9eb0c85c3 100644
--- a/contrib/firmware/angie/hdl/src/angie_bitstream.ucf
+++ b/contrib/firmware/angie/hdl/src/angie_bitstream.ucf
@@ -20,6 +20,7 @@ net SRST LOC = 'P61' ;
net SDA LOC = 'P50' ;
net SCL LOC = 'P51' ;
net SDA_DIR LOC = 'P56' ;
+net SCL_DIR LOC = 'P57' ;
net SI_TDO LOC = 'P16' ;
net SO_TRST LOC = 'P32' ;
diff --git a/contrib/firmware/angie/hdl/src/angie_bitstream.vhd b/contrib/firmware/angie/hdl/src/angie_bitstream.vhd
index 21ddb844a..6004bf2ff 100644
--- a/contrib/firmware/angie/hdl/src/angie_bitstream.vhd
+++ b/contrib/firmware/angie/hdl/src/angie_bitstream.vhd
@@ -26,8 +26,9 @@ entity S609 is port(
SDA : inout std_logic;
SDA_DIR : in std_logic;
SCL : in std_logic;
+ SCL_DIR : in std_logic;
- FTP : out std_logic_vector(7 downto 0):=(others => '1'); -- Test points
+ FTP : out std_logic_vector(7 downto 0); -- Test points
SI_TDO : in std_logic;
ST_0 : out std_logic;
ST_1 : out std_logic;
@@ -55,8 +56,6 @@ begin
ST_0 <= '0';
ST_1 <= '1';
-ST_4 <= '0';
-
--TDO:
TDO <= not SI_TDO;
@@ -75,13 +74,21 @@ SO_SDA_OUT <= SDA;
process(SDA_DIR)
begin
- if(SDA_DIR = '1') then
- ST_5 <= '1';
- else
+ if(SDA_DIR = '0') then
ST_5 <= '0';
+ else
+ ST_5 <= '1';
end if;
end process;
+process(SCL_DIR)
+begin
+ if(SCL_DIR = '0') then
+ ST_4 <= '0';
+ else
+ ST_4 <= '1';
+ end if;
+end process;
--Points de test:
FTP(0) <= SDA;
diff --git a/src/jtag/drivers/angie/angie_bitstream.bit b/src/jtag/drivers/angie/angie_bitstream.bit
index aebd3700b..7b3a88f7c 100644
Binary files a/src/jtag/drivers/angie/angie_bitstream.bit and b/src/jtag/drivers/angie/angie_bitstream.bit differ
diff --git a/src/jtag/drivers/angie/angie_firmware.bin b/src/jtag/drivers/angie/angie_firmware.bin
index da69631d9..23c4a8234 100644
Binary files a/src/jtag/drivers/angie/angie_firmware.bin and b/src/jtag/drivers/angie/angie_firmware.bin differ
-----------------------------------------------------------------------
Summary of changes:
contrib/firmware/angie/c/include/io.h | 2 +-
contrib/firmware/angie/c/src/i2c.c | 7 +++++++
contrib/firmware/angie/c/src/usb.c | 6 ------
contrib/firmware/angie/hdl/src/angie_bitstream.ucf | 1 +
contrib/firmware/angie/hdl/src/angie_bitstream.vhd | 19 +++++++++++++------
src/jtag/drivers/angie/angie_bitstream.bit | Bin 340704 -> 340704 bytes
src/jtag/drivers/angie/angie_firmware.bin | Bin 10158 -> 10256 bytes
7 files changed, 22 insertions(+), 13 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-01-13 14:47:43
|
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 995a7af21d6f97f628382e26dc21dc38e4fa846e (commit)
from fce7aa754f40475228db345c9dd0bf3eb929fc7b (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 995a7af21d6f97f628382e26dc21dc38e4fa846e
Author: Ahmed BOUDJELIDA <abo...@na...>
Date: Tue Nov 21 17:45:55 2023 +0100
jtag/drivers: send bitstream size to firmware via libusb
Send bitstream size to firmware to initialize the GPIF count registers,
since we're going to send this size via GPIF, we need to give the exact
number of bytes to be sent, then the GPIF counter will decrement with
every clock cycle (every byte sent) until reaching zero and stops.
Change-Id: Ib4e8e0f95a6a4a95ef4888ba8a04a0ea45567f5a
Signed-off-by: Ahmed BOUDJELIDA <abo...@na...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7988
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/jtag/drivers/angie.c b/src/jtag/drivers/angie.c
index b6bde5b3b..b7d1f8ac3 100644
--- a/src/jtag/drivers/angie.c
+++ b/src/jtag/drivers/angie.c
@@ -17,6 +17,7 @@
#include <stdlib.h>
#include <math.h>
#include "helper/system.h"
+#include <helper/types.h>
#include <jtag/interface.h>
#include <jtag/commands.h>
#include <target/image.h>
@@ -61,7 +62,7 @@
#define ANGIE_FIRMWARE_FILE PKGDATADIR "/angie/angie_firmware.bin"
/** Default location of ANGIE firmware image. */
-#define ANGIE_BITSTREAM_FILE PKGDATADIR "/angie/angie_bitstream.bit"
+#define ANGIE_BITSTREAM_FILE PKGDATADIR "/angie/angie_bitstream.bit"
/** Maximum size of a single firmware section. Entire EZ-USB ANGIE code space = 16kB */
#define SECTION_BUFFERSIZE 16384
@@ -404,15 +405,7 @@ static int angie_load_bitstream(struct angie *device, const char *filename)
FILE *bitstream_file = NULL;
char *bitstream_data = NULL;
size_t bitstream_size = 0;
-
- /* CFGopen */
- ret = jtag_libusb_control_transfer(device->usb_device_handle,
- 0x00, 0xB0, 0, 0, NULL, 0, LIBUSB_TIMEOUT_MS, &transferred);
- if (ret != ERROR_OK) {
- LOG_ERROR("Failed opencfg");
- /* Abort if libusb sent less data than requested */
- return ERROR_FAIL;
- }
+ uint8_t gpifcnt[4];
/* Open the bitstream file */
bitstream_file = fopen(bitstream_file_path, "rb");
@@ -442,6 +435,17 @@ static int angie_load_bitstream(struct angie *device, const char *filename)
return ERROR_FAIL;
}
+ h_u32_to_be(gpifcnt, bitstream_size);
+
+ /* CFGopen */
+ ret = jtag_libusb_control_transfer(device->usb_device_handle,
+ 0x00, 0xB0, 0, 0, (char *)gpifcnt, 4, LIBUSB_TIMEOUT_MS, &transferred);
+ if (ret != ERROR_OK) {
+ LOG_ERROR("Failed opencfg");
+ /* Abort if libusb sent less data than requested */
+ return ERROR_FAIL;
+ }
+
/* Send the bitstream data to the microcontroller */
int actual_length = 0;
ret = jtag_libusb_bulk_write(device->usb_device_handle, 0x02, bitstream_data, bitstream_size, 1000, &actual_length);
-----------------------------------------------------------------------
Summary of changes:
src/jtag/drivers/angie.c | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-01-13 14:47:14
|
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 fce7aa754f40475228db345c9dd0bf3eb929fc7b (commit)
from c47d77780cdaeac241e3be5d4433c7e4c8b475b9 (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 fce7aa754f40475228db345c9dd0bf3eb929fc7b
Author: Ahmed BOUDJELIDA <abo...@na...>
Date: Wed Nov 15 11:26:28 2023 +0100
contrib/firmware: update gpif FSM configuration file
Change the GPIF state machine, configuring only one of the 4 waveforms
to generate the clock signal (CCLK) used to program the FPGA, and send
one byte every cycle using an 8-bit bus.
Change-Id: I43cf5480b9d5c40cc2f6a62a52ecfe078b76458e
Signed-off-by: Ahmed BOUDJELIDA <abo...@na...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7976
Reviewed-by: Antonio Borneo <bor...@gm...>
Tested-by: jenkins
diff --git a/contrib/firmware/angie/c/src/gpif.c b/contrib/firmware/angie/c/src/gpif.c
index 80a957108..f4028be40 100644
--- a/contrib/firmware/angie/c/src/gpif.c
+++ b/contrib/firmware/angie/c/src/gpif.c
@@ -13,25 +13,25 @@
/****************************** GPIF PROGRAM CODE ********************************/
/* DO NOT EDIT ... */
const char wavedata[128] = {
-/* Wave 0 */
+// Wave 0
/* LenBr */ 0x01, 0x3F, 0x01, 0x01, 0x01, 0x01, 0x01, 0x07,
/* Opcode*/ 0x02, 0x07, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00,
/* Output*/ 0x04, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
/* LFun */ 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F,
-/* Wave 1 */
-/* LenBr */ 0x88, 0x01, 0x3F, 0x01, 0x01, 0x01, 0x01, 0x07,
-/* Opcode*/ 0x01, 0x02, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* Output*/ 0x07, 0x05, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
-/* LFun */ 0x09, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x3F,
-/* Wave 2 */
+// Wave 1
/* LenBr */ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x07,
/* Opcode*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* Output*/ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
+/* Output*/ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
/* LFun */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F,
-/* Wave 3 */
+// Wave 2
/* LenBr */ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x07,
/* Opcode*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* Output*/ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
+/* Output*/ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+/* LFun */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F,
+// Wave 3
+/* LenBr */ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x07,
+/* Opcode*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* Output*/ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
/* LFun */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F,
};
/* END DO NOT EDIT */
-----------------------------------------------------------------------
Summary of changes:
contrib/firmware/angie/c/src/gpif.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-01-13 14:46:32
|
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 c47d77780cdaeac241e3be5d4433c7e4c8b475b9 (commit)
from 53811fc584dc8837546be9ac17b77fdf8ad1e8bd (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 c47d77780cdaeac241e3be5d4433c7e4c8b475b9
Author: Antonio Borneo <bor...@gm...>
Date: Sat Jan 6 17:54:24 2024 +0100
target/mips32: fix false positive from clang
clang build triggers an error for an uninitialized value of the
variable 'instr'.
This is a false positive, as the macro
#define MIPS32_CONFIG3_ISA_MASK (3 << MIPS32_CONFIG3_ISA_SHIFT)
guarantees the switch/case already covers all the possible values
with cases 0, 1, 2 and 3.
Silent clang by adding a useless default case to the switch.
While there, fix the indentation of the switch/case accordingly to
OpenOCD coding style.
Change-Id: I0ae316754ce7d091dd8366bf314b8e6ee780e313
Signed-off-by: Antonio Borneo <bor...@gm...>
Fixes: 7de4b1202d50 ("target/mips32: add cpu info detection")
Reviewed-on: https://review.openocd.org/c/openocd/+/8065
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <li...@re...>
diff --git a/src/target/mips32.c b/src/target/mips32.c
index 8a3ddbf0b..5b94e6c89 100644
--- a/src/target/mips32.c
+++ b/src/target/mips32.c
@@ -1607,17 +1607,18 @@ COMMAND_HANDLER(mips32_handle_cpuinfo_command)
char *instr;
switch ((config3 & MIPS32_CONFIG3_ISA_MASK) >> MIPS32_CONFIG3_ISA_SHIFT) {
- case 0:
- instr = "MIPS32";
+ case 0:
+ instr = "MIPS32";
break;
- case 1:
- instr = "microMIPS";
+ case 1:
+ instr = "microMIPS";
break;
- case 2:
- instr = "MIPS32 (at reset) and microMIPS";
+ case 2:
+ instr = "MIPS32 (at reset) and microMIPS";
break;
- case 3:
- instr = "microMIPS (at reset) and MIPS32";
+ case 3:
+ default:
+ instr = "microMIPS (at reset) and MIPS32";
break;
}
-----------------------------------------------------------------------
Summary of changes:
src/target/mips32.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-01-13 14:46:10
|
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 53811fc584dc8837546be9ac17b77fdf8ad1e8bd (commit)
from e680841fd276439844ecf340f4005860d6e22582 (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 53811fc584dc8837546be9ac17b77fdf8ad1e8bd
Author: ianst <ia...@ca...>
Date: Wed Nov 1 16:41:43 2023 -0700
target/xtensa: enable xtensa algo support
- Add extra error checking
- Cache PS; lower PS.INTLEVEL to allow breakpoint trigger (LX)
- Xtensa algo support functional on LX per functional flash driver
- Test on NX via manual algo validation
Change-Id: Ie7cff4933979a0551308b382fa33c33c66376f25
Signed-off-by: ianst <ia...@ca...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8075
Reviewed-by: Antonio Borneo <bor...@gm...>
Reviewed-by: Erhan Kurubas <erh...@es...>
Tested-by: jenkins
diff --git a/src/target/xtensa/xtensa.c b/src/target/xtensa/xtensa.c
index ab3bfbb09..1ec091c9f 100644
--- a/src/target/xtensa/xtensa.c
+++ b/src/target/xtensa/xtensa.c
@@ -2646,6 +2646,7 @@ int xtensa_start_algorithm(struct target *target,
struct xtensa_algorithm *algorithm_info = arch_info;
int retval = ERROR_OK;
bool usr_ps = false;
+ uint32_t newps;
/* NOTE: xtensa_run_algorithm requires that each algorithm uses a software breakpoint
* at the exit point */
@@ -2660,7 +2661,17 @@ int xtensa_start_algorithm(struct target *target,
buf_cpy(reg->value, xtensa->algo_context_backup[i], reg->size);
}
/* save debug reason, it will be changed */
+ if (!algorithm_info) {
+ LOG_ERROR("BUG: arch_info not specified");
+ return ERROR_FAIL;
+ }
algorithm_info->ctx_debug_reason = target->debug_reason;
+ if (xtensa->core_config->core_type == XT_LX) {
+ /* save PS and set to debug_level - 1 */
+ algorithm_info->ctx_ps = xtensa_reg_get(target, xtensa->eps_dbglevel_idx);
+ newps = (algorithm_info->ctx_ps & ~0xf) | (xtensa->core_config->debug.irq_level - 1);
+ xtensa_reg_set(target, xtensa->eps_dbglevel_idx, newps);
+ }
/* write mem params */
for (int i = 0; i < num_mem_params; i++) {
if (mem_params[i].direction != PARAM_IN) {
@@ -2688,7 +2699,7 @@ int xtensa_start_algorithm(struct target *target,
}
if (memcmp(reg_params[i].reg_name, "ps", 3)) {
usr_ps = true;
- } else {
+ } else if (xtensa->core_config->core_type == XT_LX) {
unsigned int reg_id = xtensa->eps_dbglevel_idx;
assert(reg_id < xtensa->core_cache->num_regs && "Attempt to access non-existing reg!");
reg = &xtensa->core_cache->reg_list[reg_id];
@@ -2697,7 +2708,7 @@ int xtensa_start_algorithm(struct target *target,
reg->valid = 1;
}
/* ignore custom core mode if custom PS value is specified */
- if (!usr_ps) {
+ if (!usr_ps && xtensa->core_config->core_type == XT_LX) {
unsigned int eps_reg_idx = xtensa->eps_dbglevel_idx;
xtensa_reg_val_t ps = xtensa_reg_get(target, eps_reg_idx);
enum xtensa_mode core_mode = XT_PS_RING_GET(ps);
@@ -2741,7 +2752,8 @@ int xtensa_wait_algorithm(struct target *target,
return retval;
LOG_TARGET_ERROR(target, "not halted %d, pc 0x%" PRIx32 ", ps 0x%" PRIx32, retval,
xtensa_reg_get(target, XT_REG_IDX_PC),
- xtensa_reg_get(target, xtensa->eps_dbglevel_idx));
+ xtensa_reg_get(target, (xtensa->core_config->core_type == XT_LX) ?
+ xtensa->eps_dbglevel_idx : XT_REG_IDX_PS));
return ERROR_TARGET_TIMEOUT;
}
pc = xtensa_reg_get(target, XT_REG_IDX_PC);
@@ -2813,6 +2825,8 @@ int xtensa_wait_algorithm(struct target *target,
}
}
target->debug_reason = algorithm_info->ctx_debug_reason;
+ if (xtensa->core_config->core_type == XT_LX)
+ xtensa_reg_set(target, xtensa->eps_dbglevel_idx, algorithm_info->ctx_ps);
retval = xtensa_write_dirty_registers(target);
if (retval != ERROR_OK)
diff --git a/src/target/xtensa/xtensa.h b/src/target/xtensa/xtensa.h
index 3b37122d6..f799208f0 100644
--- a/src/target/xtensa/xtensa.h
+++ b/src/target/xtensa/xtensa.h
@@ -228,8 +228,9 @@ struct xtensa_sw_breakpoint {
struct xtensa_algorithm {
/** User can set this to specify which core mode algorithm should be run in. */
enum xtensa_mode core_mode;
- /** Used internally to backup and restore debug_reason. */
+ /** Used internally to backup and restore core state. */
enum target_debug_reason ctx_debug_reason;
+ xtensa_reg_val_t ctx_ps;
};
#define XTENSA_COMMON_MAGIC 0x54E4E555U
diff --git a/src/target/xtensa/xtensa_chip.c b/src/target/xtensa/xtensa_chip.c
index 668aa3acc..ac758ed83 100644
--- a/src/target/xtensa/xtensa_chip.c
+++ b/src/target/xtensa/xtensa_chip.c
@@ -184,6 +184,10 @@ struct target_type xtensa_chip_target = {
.get_gdb_reg_list = xtensa_get_gdb_reg_list,
+ .run_algorithm = xtensa_run_algorithm,
+ .start_algorithm = xtensa_start_algorithm,
+ .wait_algorithm = xtensa_wait_algorithm,
+
.add_breakpoint = xtensa_breakpoint_add,
.remove_breakpoint = xtensa_breakpoint_remove,
-----------------------------------------------------------------------
Summary of changes:
src/target/xtensa/xtensa.c | 20 +++++++++++++++++---
src/target/xtensa/xtensa.h | 3 ++-
src/target/xtensa/xtensa_chip.c | 4 ++++
3 files changed, 23 insertions(+), 4 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-01-13 14:45:04
|
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 e680841fd276439844ecf340f4005860d6e22582 (commit)
from f857db98bd2a3d97ada208a8137c48c47e9d3a78 (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 e680841fd276439844ecf340f4005860d6e22582
Author: Antonio Borneo <bor...@gm...>
Date: Sun Aug 6 12:38:54 2023 +0200
helper/command: pass command arguments also as Jim_Obj
Some OpenOCD command gets fragment of TCL scripts as command-line
argument, fragments that will be kept and executed later on.
E.g. the command 'configure' gets the body of an OpenOCD event:
$TARGET configure -event halted {TCL code}
These commands store the argument as a Jim_Obj and pass it to the
jimtcl interpreter when the TCL fragment has to be executed.
Using Jim_Obj as storage is relevant to let the jimtcl interpreter
to recover extra info of the TCL fragment, like the file-name and
the line-number that contain the fragment, that will be printed
out in case of run-time errors.
While converting the commands to COMMAND_HANDLER, we should avoid
storing the argument as C strings otherwise we will loose precious
info in case of run-time errors making challenging the debugging
of such TCL fragments.
Extend the struct command_invocation to contain the array that
points to the Jim_Obj of the command arguments.
This will be used while converting commands to COMMAND_HANDLER.
Change-Id: If37c5f20e9a71349f77ba1571baf1e6778e28aa5
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8057
Tested-by: jenkins
diff --git a/doc/manual/helper.txt b/doc/manual/helper.txt
index d5710ddde..b59fd664f 100644
--- a/doc/manual/helper.txt
+++ b/doc/manual/helper.txt
@@ -79,6 +79,8 @@ command handlers and helpers:
- @c CMD_NAME - invoked command name
- @c CMD_ARGC - the number of command arguments
- @c CMD_ARGV - array of command argument strings
+- @c CMD_JIMTCL_ARGV - array containing the Jim_Obj equivalent of command
+ argument in @c CMD_ARGV.
@section helpercmdregister Command Registration
diff --git a/src/helper/command.c b/src/helper/command.c
index 57db2adc1..a775c730b 100644
--- a/src/helper/command.c
+++ b/src/helper/command.c
@@ -511,6 +511,7 @@ static int exec_command(Jim_Interp *interp, struct command_context *context,
.name = c->name,
.argc = argc - 1,
.argv = words + 1,
+ .jimtcl_argv = argv + 1,
};
cmd.output = Jim_NewEmptyStringObj(context->interp);
diff --git a/src/helper/command.h b/src/helper/command.h
index 42cb9cb7d..dc4507042 100644
--- a/src/helper/command.h
+++ b/src/helper/command.h
@@ -79,6 +79,7 @@ struct command_invocation {
const char *name;
unsigned argc;
const char **argv;
+ Jim_Obj * const *jimtcl_argv;
Jim_Obj *output;
};
@@ -153,6 +154,11 @@ void *jimcmd_privdata(Jim_Cmd *cmd);
* rather than accessing the variable directly. It may be moved.
*/
#define CMD_ARGV (cmd->argv)
+/**
+ * Use this macro to access the jimtcl arguments for the command being
+ * handled, rather than accessing the variable directly. It may be moved.
+ */
+#define CMD_JIMTCL_ARGV (cmd->jimtcl_argv)
/**
* Use this macro to access the name of the command being handled,
* rather than accessing the variable directly. It may be moved.
-----------------------------------------------------------------------
Summary of changes:
doc/manual/helper.txt | 2 ++
src/helper/command.c | 1 +
src/helper/command.h | 6 ++++++
3 files changed, 9 insertions(+)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-01-13 14:44: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 f857db98bd2a3d97ada208a8137c48c47e9d3a78 (commit)
from f9ea9ce24cf4423111a7fa033f8ceff61d17aa5b (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 f857db98bd2a3d97ada208a8137c48c47e9d3a78
Author: Antonio Borneo <bor...@gm...>
Date: Sun Aug 6 12:26:25 2023 +0200
helper/command: inline run_command() in exec_command()
Simplify the command execution by inlining run_command() inside
exec_command().
Change-Id: Id932b006846720cfd867d22d142cd35831dbd1a2
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8056
Tested-by: jenkins
diff --git a/src/helper/command.c b/src/helper/command.c
index 8860cf81f..57db2adc1 100644
--- a/src/helper/command.c
+++ b/src/helper/command.c
@@ -489,14 +489,27 @@ static bool command_can_run(struct command_context *cmd_ctx, struct command *c,
return false;
}
-static int run_command(struct command_context *context,
- struct command *c, const char **words, unsigned num_words)
+static int exec_command(Jim_Interp *interp, struct command_context *context,
+ struct command *c, int argc, Jim_Obj * const *argv)
{
+ if (c->jim_handler)
+ return c->jim_handler(interp, argc, argv);
+
+ /* use c->handler */
+ const char **words = malloc(argc * sizeof(char *));
+ if (!words) {
+ LOG_ERROR("Out of memory");
+ return JIM_ERR;
+ }
+
+ for (int i = 0; i < argc; i++)
+ words[i] = Jim_GetString(argv[i], NULL);
+
struct command_invocation cmd = {
.ctx = context,
.current = c,
.name = c->name,
- .argc = num_words - 1,
+ .argc = argc - 1,
.argv = words + 1,
};
@@ -526,7 +539,8 @@ static int run_command(struct command_context *context,
}
Jim_DecrRefCount(context->interp, cmd.output);
- return retval;
+ free(words);
+ return command_retval_set(interp, retval);
}
int command_run_line(struct command_context *context, char *line)
@@ -867,27 +881,6 @@ static char *alloc_concatenate_strings(int argc, Jim_Obj * const *argv)
return all;
}
-static int exec_command(Jim_Interp *interp, struct command_context *cmd_ctx,
- struct command *c, int argc, Jim_Obj * const *argv)
-{
- if (c->jim_handler)
- return c->jim_handler(interp, argc, argv);
-
- /* use c->handler */
- const char **words = malloc(argc * sizeof(char *));
- if (!words) {
- LOG_ERROR("Out of memory");
- return JIM_ERR;
- }
-
- for (int i = 0; i < argc; i++)
- words[i] = Jim_GetString(argv[i], NULL);
-
- int retval = run_command(cmd_ctx, c, words, argc);
- free(words);
- return command_retval_set(interp, retval);
-}
-
static int jim_command_dispatch(Jim_Interp *interp, int argc, Jim_Obj * const *argv)
{
/* check subcommands */
-----------------------------------------------------------------------
Summary of changes:
src/helper/command.c | 43 ++++++++++++++++++-------------------------
1 file changed, 18 insertions(+), 25 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-01-13 14:44:04
|
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 f9ea9ce24cf4423111a7fa033f8ceff61d17aa5b (commit)
from 712c1244e8486bb4519ad0144a03c3c48c030214 (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 f9ea9ce24cf4423111a7fa033f8ceff61d17aa5b
Author: Antonio Borneo <bor...@gm...>
Date: Sun Aug 6 11:34:28 2023 +0200
helper/command: simplify exec_command()
The jimtcl interpreter guarantees that the Jim objects in argv[]
are not deallocated during the command execution. Thus, there is
no need to copy the string content of argv[].
Simplify exec_command() by inlining its two sub-functions and
dropping the strdup().
While there, add a LOG_ERROR() for out of memory.
Change-Id: I3e21ed7da50ca0bd072edbd49fca9740c81f95b0
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8055
Tested-by: jenkins
diff --git a/src/helper/command.c b/src/helper/command.c
index f7ec0e21f..8860cf81f 100644
--- a/src/helper/command.c
+++ b/src/helper/command.c
@@ -154,30 +154,6 @@ static void script_debug(Jim_Interp *interp, unsigned int argc, Jim_Obj * const
free(dbg);
}
-static void script_command_args_free(char **words, unsigned nwords)
-{
- for (unsigned i = 0; i < nwords; i++)
- free(words[i]);
- free(words);
-}
-
-static char **script_command_args_alloc(unsigned int argc, Jim_Obj * const *argv)
-{
- char **words = malloc(argc * sizeof(char *));
- if (!words)
- return NULL;
-
- for (unsigned int i = 0; i < argc; i++) {
- const char *w = Jim_GetString(argv[i], NULL);
- words[i] = strdup(w);
- if (!words[i]) {
- script_command_args_free(words, i);
- return NULL;
- }
- }
- return words;
-}
-
struct command_context *current_command_context(Jim_Interp *interp)
{
/* grab the command context from the associated data */
@@ -898,13 +874,17 @@ static int exec_command(Jim_Interp *interp, struct command_context *cmd_ctx,
return c->jim_handler(interp, argc, argv);
/* use c->handler */
- unsigned int nwords = argc;
- char **words = script_command_args_alloc(argc, argv);
- if (!words)
+ const char **words = malloc(argc * sizeof(char *));
+ if (!words) {
+ LOG_ERROR("Out of memory");
return JIM_ERR;
+ }
- int retval = run_command(cmd_ctx, c, (const char **)words, nwords);
- script_command_args_free(words, nwords);
+ for (int i = 0; i < argc; i++)
+ words[i] = Jim_GetString(argv[i], NULL);
+
+ int retval = run_command(cmd_ctx, c, words, argc);
+ free(words);
return command_retval_set(interp, retval);
}
-----------------------------------------------------------------------
Summary of changes:
src/helper/command.c | 38 +++++++++-----------------------------
1 file changed, 9 insertions(+), 29 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-01-13 14:43: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 712c1244e8486bb4519ad0144a03c3c48c030214 (commit)
from 5e1468da186e65029316a359493e2d2353e21512 (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 712c1244e8486bb4519ad0144a03c3c48c030214
Author: Antonio Borneo <bor...@gm...>
Date: Sun Aug 6 10:32:46 2023 +0200
helper/command: simplify script_command_args_alloc()
The output parameter nwords is always equal to the input parameter
argc, when the function succeeds.
Drop the parameter nwords and let the caller use directly the
value in argc.
While there, convert some 'unsigned' to 'unsigned int'.
Change-Id: Ie3d8ce1351792f3c07fe39cdcbcd180fd24dc928
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8054
Tested-by: jenkins
diff --git a/src/helper/command.c b/src/helper/command.c
index 96023336c..f7ec0e21f 100644
--- a/src/helper/command.c
+++ b/src/helper/command.c
@@ -161,15 +161,13 @@ static void script_command_args_free(char **words, unsigned nwords)
free(words);
}
-static char **script_command_args_alloc(
- unsigned argc, Jim_Obj * const *argv, unsigned *nwords)
+static char **script_command_args_alloc(unsigned int argc, Jim_Obj * const *argv)
{
char **words = malloc(argc * sizeof(char *));
if (!words)
return NULL;
- unsigned i;
- for (i = 0; i < argc; i++) {
+ for (unsigned int i = 0; i < argc; i++) {
const char *w = Jim_GetString(argv[i], NULL);
words[i] = strdup(w);
if (!words[i]) {
@@ -177,7 +175,6 @@ static char **script_command_args_alloc(
return NULL;
}
}
- *nwords = i;
return words;
}
@@ -901,8 +898,8 @@ static int exec_command(Jim_Interp *interp, struct command_context *cmd_ctx,
return c->jim_handler(interp, argc, argv);
/* use c->handler */
- unsigned int nwords;
- char **words = script_command_args_alloc(argc, argv, &nwords);
+ unsigned int nwords = argc;
+ char **words = script_command_args_alloc(argc, argv);
if (!words)
return JIM_ERR;
-----------------------------------------------------------------------
Summary of changes:
src/helper/command.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-01-13 14:43:15
|
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 5e1468da186e65029316a359493e2d2353e21512 (commit)
from 6e6d486de2c668e14f9534fab820eea305826753 (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 5e1468da186e65029316a359493e2d2353e21512
Author: Antonio Borneo <bor...@gm...>
Date: Sun Aug 6 10:40:03 2023 +0200
helper/command: drop unused variables
In both functions script_debug() and script_command_args_alloc()
the variable len is never used, and Jim_GetString() does not
mandate it.
Drop the variable and pass NULL to Jim_GetString().
Change-Id: I754b27a59c6087cde729496be42609d2a7145b0c
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8053
Tested-by: jenkins
diff --git a/src/helper/command.c b/src/helper/command.c
index ef50ab5bd..96023336c 100644
--- a/src/helper/command.c
+++ b/src/helper/command.c
@@ -145,8 +145,7 @@ static void script_debug(Jim_Interp *interp, unsigned int argc, Jim_Obj * const
char *dbg = alloc_printf("command -");
for (unsigned i = 0; i < argc; i++) {
- int len;
- const char *w = Jim_GetString(argv[i], &len);
+ const char *w = Jim_GetString(argv[i], NULL);
char *t = alloc_printf("%s %s", dbg, w);
free(dbg);
dbg = t;
@@ -171,8 +170,7 @@ static char **script_command_args_alloc(
unsigned i;
for (i = 0; i < argc; i++) {
- int len;
- const char *w = Jim_GetString(argv[i], &len);
+ const char *w = Jim_GetString(argv[i], NULL);
words[i] = strdup(w);
if (!words[i]) {
script_command_args_free(words, i);
-----------------------------------------------------------------------
Summary of changes:
src/helper/command.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-01-13 14:42:46
|
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 6e6d486de2c668e14f9534fab820eea305826753 (commit)
from 305f293201a1d75f24eaa188294b78b284c8185b (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 6e6d486de2c668e14f9534fab820eea305826753
Author: Antonio Borneo <bor...@gm...>
Date: Sun Dec 3 18:10:45 2023 +0100
target: drop deprecated code for mem2array and array2mem
Commit e370e06b724f ("target: Deprecate 'array2mem' and
'mem2array''") has already replaced the deprecated root versions
of commands mem2array and array2mem with TCL proc's that use
'read_memory' and 'write_memory'. It has left the deprecated code
of the target's version of the commands because the effort to code
the TCL replacement was not considered valuable.
To drop the last jim_handler commands, I consider much easier and
less error-prone to code them in TCL instead of converting the
deprecated code to COMMAND_HANDLER.
Drop the code in target.c and extend the TCL proc's.
While there, add the TCL procs to _telnet_autocomplete_skip.
Change-Id: I97d2370d8af479434ddf5af68541f90913982bc0
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8052
Tested-by: jenkins
diff --git a/src/target/startup.tcl b/src/target/startup.tcl
index 35492a6d9..75e0edc77 100644
--- a/src/target/startup.tcl
+++ b/src/target/startup.tcl
@@ -219,31 +219,44 @@ proc init_target_events {} {
proc init_board {} {
}
-proc mem2array {arrayname bitwidth address count {phys ""}} {
- echo "DEPRECATED! use 'read_memory' not 'mem2array'"
-
- upvar $arrayname $arrayname
- set $arrayname ""
- set i 0
-
- foreach elem [read_memory $address $bitwidth $count {*}$phys] {
- set ${arrayname}($i) $elem
- incr i
- }
-}
-
-proc array2mem {arrayname bitwidth address count {phys ""}} {
- echo "DEPRECATED! use 'write_memory' not 'array2mem'"
-
- upvar $arrayname $arrayname
- set data ""
+lappend _telnet_autocomplete_skip _post_init_target_array_mem
+proc _post_init_target_array_mem {} {
+ set targets [target names]
+ lappend targets ""
- for {set i 0} {$i < $count} {incr i} {
- lappend data [expr $${arrayname}($i)]
+ foreach t $targets {
+ if {$t != ""} {
+ set t "$t "
+ }
+ eval [format {lappend ::_telnet_autocomplete_skip "%smem2array"} $t]
+ eval [format {proc {%smem2array} {arrayname bitwidth address count {phys ""}} {
+ echo "DEPRECATED! use 'read_memory' not 'mem2array'"
+
+ upvar $arrayname $arrayname
+ set $arrayname ""
+ set i 0
+
+ foreach elem [%sread_memory $address $bitwidth $count {*}$phys] {
+ set ${arrayname}($i) $elem
+ incr i
+ }
+ }} $t $t]
+ eval [format {lappend ::_telnet_autocomplete_skip "%sarray2mem"} $t]
+ eval [format {proc {%sarray2mem} {arrayname bitwidth address count {phys ""}} {
+ echo "DEPRECATED! use 'write_memory' not 'array2mem'"
+
+ upvar $arrayname $arrayname
+ set data ""
+
+ for {set i 0} {$i < $count} {incr i} {
+ lappend data [expr $${arrayname}($i)]
+ }
+
+ %swrite_memory $address $bitwidth $data {*}$phys
+ }} $t $t]
}
-
- write_memory $address $bitwidth $data {*}$phys
}
+lappend post_init_commands _post_init_target_array_mem
# smp_on/smp_off were already DEPRECATED in v0.11.0 through http://openocd.zylin.com/4615
lappend _telnet_autocomplete_skip "aarch64 smp_on"
diff --git a/src/target/target.c b/src/target/target.c
index 61890aa3e..920511e96 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -56,10 +56,6 @@ static int target_read_buffer_default(struct target *target, target_addr_t addre
uint32_t count, uint8_t *buffer);
static int target_write_buffer_default(struct target *target, target_addr_t address,
uint32_t count, const uint8_t *buffer);
-static int target_array2mem(Jim_Interp *interp, struct target *target,
- int argc, Jim_Obj * const *argv);
-static int target_mem2array(Jim_Interp *interp, struct target *target,
- int argc, Jim_Obj * const *argv);
static int target_register_user_commands(struct command_context *cmd_ctx);
static int target_get_gdb_fileio_info_default(struct target *target,
struct gdb_fileio_info *fileio_info);
@@ -4397,192 +4393,6 @@ COMMAND_HANDLER(handle_profile_command)
return retval;
}
-static int new_u64_array_element(Jim_Interp *interp, const char *varname, int idx, uint64_t val)
-{
- char *namebuf;
- Jim_Obj *obj_name, *obj_val;
- int result;
-
- namebuf = alloc_printf("%s(%d)", varname, idx);
- if (!namebuf)
- return JIM_ERR;
-
- obj_name = Jim_NewStringObj(interp, namebuf, -1);
- jim_wide wide_val = val;
- obj_val = Jim_NewWideObj(interp, wide_val);
- if (!obj_name || !obj_val) {
- free(namebuf);
- return JIM_ERR;
- }
-
- Jim_IncrRefCount(obj_name);
- Jim_IncrRefCount(obj_val);
- result = Jim_SetVariable(interp, obj_name, obj_val);
- Jim_DecrRefCount(interp, obj_name);
- Jim_DecrRefCount(interp, obj_val);
- free(namebuf);
- /* printf("%s(%d) <= 0%08x\n", varname, idx, val); */
- return result;
-}
-
-static int target_mem2array(Jim_Interp *interp, struct target *target, int argc, Jim_Obj *const *argv)
-{
- int e;
-
- LOG_WARNING("DEPRECATED! use 'read_memory' not 'mem2array'");
-
- /* argv[0] = name of array to receive the data
- * argv[1] = desired element width in bits
- * argv[2] = memory address
- * argv[3] = count of times to read
- * argv[4] = optional "phys"
- */
- if (argc < 4 || argc > 5) {
- Jim_WrongNumArgs(interp, 0, argv, "varname width addr nelems [phys]");
- return JIM_ERR;
- }
-
- /* Arg 0: Name of the array variable */
- const char *varname = Jim_GetString(argv[0], NULL);
-
- /* Arg 1: Bit width of one element */
- long l;
- e = Jim_GetLong(interp, argv[1], &l);
- if (e != JIM_OK)
- return e;
- const unsigned int width_bits = l;
-
- if (width_bits != 8 &&
- width_bits != 16 &&
- width_bits != 32 &&
- width_bits != 64) {
- Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
- Jim_AppendStrings(interp, Jim_GetResult(interp),
- "Invalid width param. Must be one of: 8, 16, 32 or 64.", NULL);
- return JIM_ERR;
- }
- const unsigned int width = width_bits / 8;
-
- /* Arg 2: Memory address */
- jim_wide wide_addr;
- e = Jim_GetWide(interp, argv[2], &wide_addr);
- if (e != JIM_OK)
- return e;
- target_addr_t addr = (target_addr_t)wide_addr;
-
- /* Arg 3: Number of elements to read */
- e = Jim_GetLong(interp, argv[3], &l);
- if (e != JIM_OK)
- return e;
- size_t len = l;
-
- /* Arg 4: phys */
- bool is_phys = false;
- if (argc > 4) {
- int str_len = 0;
- const char *phys = Jim_GetString(argv[4], &str_len);
- if (!strncmp(phys, "phys", str_len))
- is_phys = true;
- else
- return JIM_ERR;
- }
-
- /* Argument checks */
- if (len == 0) {
- Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
- Jim_AppendStrings(interp, Jim_GetResult(interp), "mem2array: zero width read?", NULL);
- return JIM_ERR;
- }
- if ((addr + (len * width)) < addr) {
- Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
- Jim_AppendStrings(interp, Jim_GetResult(interp), "mem2array: addr + len - wraps to zero?", NULL);
- return JIM_ERR;
- }
- if (len > 65536) {
- Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
- Jim_AppendStrings(interp, Jim_GetResult(interp),
- "mem2array: too large read request, exceeds 64K items", NULL);
- return JIM_ERR;
- }
-
- if ((width == 1) ||
- ((width == 2) && ((addr & 1) == 0)) ||
- ((width == 4) && ((addr & 3) == 0)) ||
- ((width == 8) && ((addr & 7) == 0))) {
- /* alignment correct */
- } else {
- char buf[100];
- Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
- sprintf(buf, "mem2array address: " TARGET_ADDR_FMT " is not aligned for %" PRIu32 " byte reads",
- addr,
- width);
- Jim_AppendStrings(interp, Jim_GetResult(interp), buf, NULL);
- return JIM_ERR;
- }
-
- /* Transfer loop */
-
- /* index counter */
- size_t idx = 0;
-
- const size_t buffersize = 4096;
- uint8_t *buffer = malloc(buffersize);
- if (!buffer)
- return JIM_ERR;
-
- /* assume ok */
- e = JIM_OK;
- while (len) {
- /* Slurp... in buffer size chunks */
- const unsigned int max_chunk_len = buffersize / width;
- const size_t chunk_len = MIN(len, max_chunk_len); /* in elements.. */
-
- int retval;
- if (is_phys)
- retval = target_read_phys_memory(target, addr, width, chunk_len, buffer);
- else
- retval = target_read_memory(target, addr, width, chunk_len, buffer);
- if (retval != ERROR_OK) {
- /* BOO !*/
- LOG_ERROR("mem2array: Read @ " TARGET_ADDR_FMT ", w=%u, cnt=%zu, failed",
- addr,
- width,
- chunk_len);
- Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
- Jim_AppendStrings(interp, Jim_GetResult(interp), "mem2array: cannot read memory", NULL);
- e = JIM_ERR;
- break;
- } else {
- for (size_t i = 0; i < chunk_len ; i++, idx++) {
- uint64_t v = 0;
- switch (width) {
- case 8:
- v = target_buffer_get_u64(target, &buffer[i*width]);
- break;
- case 4:
- v = target_buffer_get_u32(target, &buffer[i*width]);
- break;
- case 2:
- v = target_buffer_get_u16(target, &buffer[i*width]);
- break;
- case 1:
- v = buffer[i] & 0x0ff;
- break;
- }
- new_u64_array_element(interp, varname, idx, v);
- }
- len -= chunk_len;
- addr += chunk_len * width;
- }
- }
-
- free(buffer);
-
- Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
-
- return e;
-}
-
COMMAND_HANDLER(handle_target_read_memory)
{
/*
@@ -4706,201 +4516,6 @@ COMMAND_HANDLER(handle_target_read_memory)
return ERROR_OK;
}
-static int get_u64_array_element(Jim_Interp *interp, const char *varname, size_t idx, uint64_t *val)
-{
- char *namebuf = alloc_printf("%s(%zu)", varname, idx);
- if (!namebuf)
- return JIM_ERR;
-
- Jim_Obj *obj_name = Jim_NewStringObj(interp, namebuf, -1);
- if (!obj_name) {
- free(namebuf);
- return JIM_ERR;
- }
-
- Jim_IncrRefCount(obj_name);
- Jim_Obj *obj_val = Jim_GetVariable(interp, obj_name, JIM_ERRMSG);
- Jim_DecrRefCount(interp, obj_name);
- free(namebuf);
- if (!obj_val)
- return JIM_ERR;
-
- jim_wide wide_val;
- int result = Jim_GetWide(interp, obj_val, &wide_val);
- *val = wide_val;
- return result;
-}
-
-static int target_array2mem(Jim_Interp *interp, struct target *target,
- int argc, Jim_Obj *const *argv)
-{
- int e;
-
- LOG_WARNING("DEPRECATED! use 'write_memory' not 'array2mem'");
-
- /* argv[0] = name of array from which to read the data
- * argv[1] = desired element width in bits
- * argv[2] = memory address
- * argv[3] = number of elements to write
- * argv[4] = optional "phys"
- */
- if (argc < 4 || argc > 5) {
- Jim_WrongNumArgs(interp, 0, argv, "varname width addr nelems [phys]");
- return JIM_ERR;
- }
-
- /* Arg 0: Name of the array variable */
- const char *varname = Jim_GetString(argv[0], NULL);
-
- /* Arg 1: Bit width of one element */
- long l;
- e = Jim_GetLong(interp, argv[1], &l);
- if (e != JIM_OK)
- return e;
- const unsigned int width_bits = l;
-
- if (width_bits != 8 &&
- width_bits != 16 &&
- width_bits != 32 &&
- width_bits != 64) {
- Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
- Jim_AppendStrings(interp, Jim_GetResult(interp),
- "Invalid width param. Must be one of: 8, 16, 32 or 64.", NULL);
- return JIM_ERR;
- }
- const unsigned int width = width_bits / 8;
-
- /* Arg 2: Memory address */
- jim_wide wide_addr;
- e = Jim_GetWide(interp, argv[2], &wide_addr);
- if (e != JIM_OK)
- return e;
- target_addr_t addr = (target_addr_t)wide_addr;
-
- /* Arg 3: Number of elements to write */
- e = Jim_GetLong(interp, argv[3], &l);
- if (e != JIM_OK)
- return e;
- size_t len = l;
-
- /* Arg 4: Phys */
- bool is_phys = false;
- if (argc > 4) {
- int str_len = 0;
- const char *phys = Jim_GetString(argv[4], &str_len);
- if (!strncmp(phys, "phys", str_len))
- is_phys = true;
- else
- return JIM_ERR;
- }
-
- /* Argument checks */
- if (len == 0) {
- Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
- Jim_AppendStrings(interp, Jim_GetResult(interp),
- "array2mem: zero width read?", NULL);
- return JIM_ERR;
- }
-
- if ((addr + (len * width)) < addr) {
- Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
- Jim_AppendStrings(interp, Jim_GetResult(interp),
- "array2mem: addr + len - wraps to zero?", NULL);
- return JIM_ERR;
- }
-
- if (len > 65536) {
- Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
- Jim_AppendStrings(interp, Jim_GetResult(interp),
- "array2mem: too large memory write request, exceeds 64K items", NULL);
- return JIM_ERR;
- }
-
- if ((width == 1) ||
- ((width == 2) && ((addr & 1) == 0)) ||
- ((width == 4) && ((addr & 3) == 0)) ||
- ((width == 8) && ((addr & 7) == 0))) {
- /* alignment correct */
- } else {
- char buf[100];
- Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
- sprintf(buf, "array2mem address: " TARGET_ADDR_FMT " is not aligned for %" PRIu32 " byte reads",
- addr,
- width);
- Jim_AppendStrings(interp, Jim_GetResult(interp), buf, NULL);
- return JIM_ERR;
- }
-
- /* Transfer loop */
-
- /* assume ok */
- e = JIM_OK;
-
- const size_t buffersize = 4096;
- uint8_t *buffer = malloc(buffersize);
- if (!buffer)
- return JIM_ERR;
-
- /* index counter */
- size_t idx = 0;
-
- while (len) {
- /* Slurp... in buffer size chunks */
- const unsigned int max_chunk_len = buffersize / width;
-
- const size_t chunk_len = MIN(len, max_chunk_len); /* in elements.. */
-
- /* Fill the buffer */
- for (size_t i = 0; i < chunk_len; i++, idx++) {
- uint64_t v = 0;
- if (get_u64_array_element(interp, varname, idx, &v) != JIM_OK) {
- free(buffer);
- return JIM_ERR;
- }
- switch (width) {
- case 8:
- target_buffer_set_u64(target, &buffer[i * width], v);
- break;
- case 4:
- target_buffer_set_u32(target, &buffer[i * width], v);
- break;
- case 2:
- target_buffer_set_u16(target, &buffer[i * width], v);
- break;
- case 1:
- buffer[i] = v & 0x0ff;
- break;
- }
- }
- len -= chunk_len;
-
- /* Write the buffer to memory */
- int retval;
- if (is_phys)
- retval = target_write_phys_memory(target, addr, width, chunk_len, buffer);
- else
- retval = target_write_memory(target, addr, width, chunk_len, buffer);
- if (retval != ERROR_OK) {
- /* BOO !*/
- LOG_ERROR("array2mem: Write @ " TARGET_ADDR_FMT ", w=%u, cnt=%zu, failed",
- addr,
- width,
- chunk_len);
- Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
- Jim_AppendStrings(interp, Jim_GetResult(interp), "array2mem: cannot read memory", NULL);
- e = JIM_ERR;
- break;
- }
- addr += chunk_len * width;
- }
-
- free(buffer);
-
- Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
-
- return e;
-}
-
static int target_jim_write_memory(Jim_Interp *interp, int argc,
Jim_Obj * const *argv)
{
@@ -5637,24 +5252,6 @@ static int jim_target_configure(Jim_Interp *interp, int argc, Jim_Obj * const *a
return target_configure(&goi, target);
}
-static int jim_target_mem2array(Jim_Interp *interp,
- int argc, Jim_Obj *const *argv)
-{
- struct command_context *cmd_ctx = current_command_context(interp);
- assert(cmd_ctx);
- struct target *target = get_current_target(cmd_ctx);
- return target_mem2array(interp, target, argc - 1, argv + 1);
-}
-
-static int jim_target_array2mem(Jim_Interp *interp,
- int argc, Jim_Obj *const *argv)
-{
- struct command_context *cmd_ctx = current_command_context(interp);
- assert(cmd_ctx);
- struct target *target = get_current_target(cmd_ctx);
- return target_array2mem(interp, target, argc - 1, argv + 1);
-}
-
COMMAND_HANDLER(handle_target_examine)
{
bool allow_defer = false;
@@ -5976,22 +5573,6 @@ static const struct command_registration target_instance_command_handlers[] = {
.help = "Display target memory as 8-bit bytes",
.usage = "address [count]",
},
- {
- .name = "array2mem",
- .mode = COMMAND_EXEC,
- .jim_handler = jim_target_array2mem,
- .help = "Writes Tcl array of 8/16/32 bit numbers "
- "to target memory",
- .usage = "arrayname bitwidth address count",
- },
- {
- .name = "mem2array",
- .mode = COMMAND_EXEC,
- .jim_handler = jim_target_mem2array,
- .help = "Loads Tcl array of 8/16/32 bit numbers "
- "from target memory",
- .usage = "arrayname bitwidth address count",
- },
{
.name = "get_reg",
.mode = COMMAND_EXEC,
-----------------------------------------------------------------------
Summary of changes:
src/target/startup.tcl | 57 ++++---
src/target/target.c | 419 -------------------------------------------------
2 files changed, 35 insertions(+), 441 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-01-13 14:41:57
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via 305f293201a1d75f24eaa188294b78b284c8185b (commit)
from 0de852f56130bfffa427bbc04bcea0370eecb0f3 (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 305f293201a1d75f24eaa188294b78b284c8185b
Author: Antonio Borneo <bor...@gm...>
Date: Thu Jan 4 22:26:38 2024 +0100
LICENSES: drop SPDX tag 'GPL-2.0' and use 'GPL-2.0-only'
The SPDX tag 'GPL-2.0' has been deprecated in
https://spdx.org/licenses/GPL-2.0.html
and the preferred tag is now 'GPL-2.0-only'
https://spdx.org/licenses/GPL-2.0-only.html
Update the LICENSES documents and the SPDX of the only file that
reports the deprecated tag.
Change-Id: I3c3215438bc4378ff470bb9fa8fa962505a9ae50
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8064
Tested-by: jenkins
diff --git a/LICENSES/license-rules.txt b/LICENSES/license-rules.txt
index c75192930..ecc8e4db1 100644
--- a/LICENSES/license-rules.txt
+++ b/LICENSES/license-rules.txt
@@ -173,7 +173,6 @@ OpenOCD, can be broken down into:
File format examples::
- Valid-License-Identifier: GPL-2.0
Valid-License-Identifier: GPL-2.0-only
Valid-License-Identifier: GPL-2.0-or-later
SPDX-URL: https://spdx.org/licenses/GPL-2.0.html
@@ -182,8 +181,6 @@ OpenOCD, can be broken down into:
tag/value pairs into a comment according to the placement
guidelines in the licensing rules documentation.
For 'GNU General Public License (GPL) version 2 only' use:
- SPDX-License-Identifier: GPL-2.0
- or
SPDX-License-Identifier: GPL-2.0-only
For 'GNU General Public License (GPL) version 2 or any later version' use:
SPDX-License-Identifier: GPL-2.0-or-later
diff --git a/LICENSES/preferred/GPL-2.0 b/LICENSES/preferred/GPL-2.0
index 2ca4651c3..687bdddb1 100644
--- a/LICENSES/preferred/GPL-2.0
+++ b/LICENSES/preferred/GPL-2.0
@@ -1,4 +1,3 @@
-Valid-License-Identifier: GPL-2.0
Valid-License-Identifier: GPL-2.0-only
Valid-License-Identifier: GPL-2.0-or-later
SPDX-URL: https://spdx.org/licenses/GPL-2.0.html
@@ -7,8 +6,6 @@ Usage-Guide:
tag/value pairs into a comment according to the placement
guidelines in the licensing rules documentation.
For 'GNU General Public License (GPL) version 2 only' use:
- SPDX-License-Identifier: GPL-2.0
- or
SPDX-License-Identifier: GPL-2.0-only
For 'GNU General Public License (GPL) version 2 or any later version' use:
SPDX-License-Identifier: GPL-2.0-or-later
diff --git a/src/target/mips_cpu.h b/src/target/mips_cpu.h
index 2f31dbd66..c3b7b54ba 100644
--- a/src/target/mips_cpu.h
+++ b/src/target/mips_cpu.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef OPENOCD_TARGET_MIPS_CPU_H
#define OPENOCD_TARGET_MIPS_CPU_H
-----------------------------------------------------------------------
Summary of changes:
LICENSES/license-rules.txt | 3 ---
LICENSES/preferred/GPL-2.0 | 3 ---
src/target/mips_cpu.h | 2 +-
3 files changed, 1 insertion(+), 7 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-01-13 14:41:01
|
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 0de852f56130bfffa427bbc04bcea0370eecb0f3 (commit)
from 2c10e3e2577604f5ec75b7f688f53fa2b3cbb0e7 (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 0de852f56130bfffa427bbc04bcea0370eecb0f3
Author: Evgeniy Didin <di...@sy...>
Date: Fri Jul 31 00:13:12 2020 +0300
target/arc: skip over breakpoints in arc_resume()
When requested by the core code (handle_breakpoints = true),
arc_resume() should be able to advance over a potential breakpoint set
at the resume address instead of getting stuck in one place. This is
achieved by removing the breakpoint, executing one instruction,
resetting the breakpoint, then proceeding forward as normal.
With this patch applied, openocd is now able to resume from a
breakpoint halt when debugging ARCv2 targets via telnet.
This has previously been committed to the Zephyr project's openocd repo
(see https://github.com/zephyrproject-rtos/openocd/pull/31).
Change-Id: I17dba0dcea311d394b303c587bc2dfaa99d67859
Signed-off-by: Evgeniy Didin <di...@sy...>
Signed-off-by: Stephanos Ioannidis <ro...@st...>
Signed-off-by: Artemiy Volkov <ar...@sy...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7817
Reviewed-by: Antonio Borneo <bor...@gm...>
Tested-by: jenkins
diff --git a/src/target/arc.c b/src/target/arc.c
index f3449aada..72e4d918d 100644
--- a/src/target/arc.c
+++ b/src/target/arc.c
@@ -52,6 +52,11 @@ static int arc_remove_watchpoint(struct target *target,
struct watchpoint *watchpoint);
static int arc_enable_watchpoints(struct target *target);
static int arc_enable_breakpoints(struct target *target);
+static int arc_unset_breakpoint(struct target *target,
+ struct breakpoint *breakpoint);
+static int arc_set_breakpoint(struct target *target,
+ struct breakpoint *breakpoint);
+static int arc_single_step_core(struct target *target);
void arc_reg_data_type_add(struct target *target,
struct arc_reg_data_type *data_type)
@@ -750,6 +755,29 @@ static int arc_examine(struct target *target)
return ERROR_OK;
}
+static int arc_exit_debug(struct target *target)
+{
+ uint32_t value;
+ struct arc_common *arc = target_to_arc(target);
+
+ /* Do read-modify-write sequence, or DEBUG.UB will be reset unintentionally. */
+ CHECK_RETVAL(arc_jtag_read_aux_reg_one(&arc->jtag_info, AUX_DEBUG_REG, &value));
+ value |= SET_CORE_FORCE_HALT; /* set the HALT bit */
+ CHECK_RETVAL(arc_jtag_write_aux_reg_one(&arc->jtag_info, AUX_DEBUG_REG, value));
+ alive_sleep(1);
+
+ target->state = TARGET_HALTED;
+ CHECK_RETVAL(target_call_event_callbacks(target, TARGET_EVENT_HALTED));
+
+ if (debug_level >= LOG_LVL_DEBUG) {
+ LOG_DEBUG("core stopped (halted) debug-reg: 0x%08" PRIx32, value);
+ CHECK_RETVAL(arc_jtag_read_aux_reg_one(&arc->jtag_info, AUX_STATUS32_REG, &value));
+ LOG_DEBUG("core STATUS32: 0x%08" PRIx32, value);
+ }
+
+ return ERROR_OK;
+}
+
static int arc_halt(struct target *target)
{
uint32_t value, irq_state;
@@ -1251,7 +1279,7 @@ static int arc_resume(struct target *target, int current, target_addr_t address,
uint32_t value;
struct reg *pc = &arc->core_and_aux_cache->reg_list[arc->pc_index_in_cache];
- LOG_DEBUG("current:%i, address:0x%08" TARGET_PRIxADDR ", handle_breakpoints(not supported yet):%i,"
+ LOG_DEBUG("current:%i, address:0x%08" TARGET_PRIxADDR ", handle_breakpoints:%i,"
" debug_execution:%i", current, address, handle_breakpoints, debug_execution);
/* We need to reset ARC cache variables so caches
@@ -1296,6 +1324,19 @@ static int arc_resume(struct target *target, int current, target_addr_t address,
CHECK_RETVAL(arc_jtag_write_aux_reg_one(&arc->jtag_info, AUX_PC_REG, value));
}
+ /* the front-end may request us not to handle breakpoints here */
+ if (handle_breakpoints) {
+ /* Single step past breakpoint at current address */
+ struct breakpoint *breakpoint = breakpoint_find(target, resume_pc);
+ if (breakpoint) {
+ LOG_DEBUG("skipping past breakpoint at 0x%08" TARGET_PRIxADDR,
+ breakpoint->address);
+ CHECK_RETVAL(arc_unset_breakpoint(target, breakpoint));
+ CHECK_RETVAL(arc_single_step_core(target));
+ CHECK_RETVAL(arc_set_breakpoint(target, breakpoint));
+ }
+ }
+
/* Restore IRQ state if not in debug_execution*/
if (!debug_execution)
CHECK_RETVAL(arc_enable_interrupts(target, arc->irq_state));
@@ -2027,6 +2068,22 @@ static int arc_config_step(struct target *target, int enable_step)
return ERROR_OK;
}
+static int arc_single_step_core(struct target *target)
+{
+ CHECK_RETVAL(arc_debug_entry(target));
+
+ /* disable interrupts while stepping */
+ CHECK_RETVAL(arc_enable_interrupts(target, 0));
+
+ /* configure single step mode */
+ CHECK_RETVAL(arc_config_step(target, 1));
+
+ /* exit debug mode */
+ CHECK_RETVAL(arc_exit_debug(target));
+
+ return ERROR_OK;
+}
+
static int arc_step(struct target *target, int current, target_addr_t address,
int handle_breakpoints)
{
-----------------------------------------------------------------------
Summary of changes:
src/target/arc.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 58 insertions(+), 1 deletion(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-01-13 14:40:34
|
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 2c10e3e2577604f5ec75b7f688f53fa2b3cbb0e7 (commit)
from 04eda372634f995c732bed4f67855be258ab0e41 (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 2c10e3e2577604f5ec75b7f688f53fa2b3cbb0e7
Author: Evgeniy Didin <di...@sy...>
Date: Fri Jul 31 00:13:12 2020 +0300
target/arc: restore breakpoints in arc_resume()
Presently, we rely on gdb to restore break/watchpoints upon resuming
execution in arc_resume(). To match this behavior in absence of gdb
(more specifically, when handle_breakpoints is true), this patch
explicitly re-enables all breakpoints and watchpoints in arc_resume().
This has previously been committed to the Zephyr project's openocd repo
(see https://github.com/zephyrproject-rtos/openocd/pull/31).
Change-Id: I59e9c91270ef0b5fd19cfc570663dc67a6022dbd
Signed-off-by: Evgeniy Didin <di...@sy...>
Signed-off-by: Stephanos Ioannidis <ro...@st...>
Signed-off-by: Artemiy Volkov <ar...@sy...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7816
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
Reviewed-by: Oleksij Rempel <li...@re...>
diff --git a/src/target/arc.c b/src/target/arc.c
index 0f7b11025..f3449aada 100644
--- a/src/target/arc.c
+++ b/src/target/arc.c
@@ -50,6 +50,8 @@
static int arc_remove_watchpoint(struct target *target,
struct watchpoint *watchpoint);
+static int arc_enable_watchpoints(struct target *target);
+static int arc_enable_breakpoints(struct target *target);
void arc_reg_data_type_add(struct target *target,
struct arc_reg_data_type *data_type)
@@ -1262,6 +1264,13 @@ static int arc_resume(struct target *target, int current, target_addr_t address,
return ERROR_TARGET_NOT_HALTED;
}
+ if (!debug_execution) {
+ /* (gdb) continue = execute until we hit break/watch-point */
+ target_free_all_working_areas(target);
+ CHECK_RETVAL(arc_enable_breakpoints(target));
+ CHECK_RETVAL(arc_enable_watchpoints(target));
+ }
+
/* current = 1: continue on current PC, otherwise continue at <address> */
if (!current) {
target_buffer_set_u32(target, pc->value, address);
@@ -1658,6 +1667,19 @@ static int arc_unset_breakpoint(struct target *target,
return retval;
}
+static int arc_enable_breakpoints(struct target *target)
+{
+ struct breakpoint *breakpoint = target->breakpoints;
+
+ /* set any pending breakpoints */
+ while (breakpoint) {
+ if (!breakpoint->is_set)
+ CHECK_RETVAL(arc_set_breakpoint(target, breakpoint));
+ breakpoint = breakpoint->next;
+ }
+
+ return ERROR_OK;
+}
static int arc_add_breakpoint(struct target *target, struct breakpoint *breakpoint)
{
@@ -1895,6 +1917,20 @@ static int arc_unset_watchpoint(struct target *target,
return retval;
}
+static int arc_enable_watchpoints(struct target *target)
+{
+ struct watchpoint *watchpoint = target->watchpoints;
+
+ /* set any pending watchpoints */
+ while (watchpoint) {
+ if (!watchpoint->is_set)
+ CHECK_RETVAL(arc_set_watchpoint(target, watchpoint));
+ watchpoint = watchpoint->next;
+ }
+
+ return ERROR_OK;
+}
+
static int arc_add_watchpoint(struct target *target,
struct watchpoint *watchpoint)
{
-----------------------------------------------------------------------
Summary of changes:
src/target/arc.c | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-01-13 14:39:27
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via 04eda372634f995c732bed4f67855be258ab0e41 (commit)
from 22ebb693b62fd05bcbe2c0101e180b92ca5b11f3 (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 04eda372634f995c732bed4f67855be258ab0e41
Author: ianst <ia...@ca...>
Date: Wed Dec 6 14:34:09 2023 -0800
target/xtensa: extra debug info for "xtensa exe" failures
- Read and display EXCCAUSE on exe error
- Clean up error messages
- Clarify "xtensa exe" documentation
Signed-off-by: ianst <ia...@ca...>
Change-Id: I90ed39f6afb6543c0c873301501435384b4dccbe
Reviewed-on: https://review.openocd.org/c/openocd/+/7982
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/doc/openocd.texi b/doc/openocd.texi
index 53730eafa..e4d4dc5d6 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -11600,13 +11600,14 @@ This feature is not well implemented and tested yet.
@end deffn
@deffn {Command} {xtensa exe} <ascii-encoded hexadecimal instruction bytes>
-Execute arbitrary instruction(s) provided as an ascii string. The string represents an integer
-number of instruction bytes, thus its length must be even.
+Execute one arbitrary instruction provided as an ascii string. The string represents an integer
+number of instruction bytes, thus its length must be even. The instruction can be of any width
+that is valid for the Xtensa core configuration.
@end deffn
@deffn {Command} {xtensa dm} (address) [value]
-Read or write Xtensa Debug Module (DM) registers. @var{address} is required for both reads
-and writes and is a 4-byte-aligned value typically between 0 and 0x3ffc. @var{value} is specified
+Read or write Xtensa Debug Module (DM) registers. @var{address} is required for both reads
+and writes and is a 4-byte-aligned value typically between 0 and 0x3ffc. @var{value} is specified
only for write accesses.
@end deffn
diff --git a/src/target/xtensa/xtensa.c b/src/target/xtensa/xtensa.c
index d2ca32c1d..ab3bfbb09 100644
--- a/src/target/xtensa/xtensa.c
+++ b/src/target/xtensa/xtensa.c
@@ -3483,15 +3483,21 @@ static COMMAND_HELPER(xtensa_cmd_exe_do, struct target *target)
LOG_TARGET_DEBUG(target, "execute stub: %s", CMD_ARGV[0]);
xtensa_queue_exec_ins_wide(xtensa, ops, oplen); /* Handles endian-swap */
status = xtensa_dm_queue_execute(&xtensa->dbg_mod);
- if (status != ERROR_OK)
- LOG_TARGET_ERROR(target, "TIE queue execute: %d\n", status);
- status = xtensa_core_status_check(target);
- if (status != ERROR_OK)
- LOG_TARGET_ERROR(target, "TIE instr execute: %d\n", status);
+ if (status != ERROR_OK) {
+ LOG_TARGET_ERROR(target, "exec: queue error %d", status);
+ } else {
+ status = xtensa_core_status_check(target);
+ if (status != ERROR_OK)
+ LOG_TARGET_ERROR(target, "exec: status error %d", status);
+ }
/* Reread register cache and restore saved regs after instruction execution */
if (xtensa_fetch_all_regs(target) != ERROR_OK)
- LOG_TARGET_ERROR(target, "%s: Failed to fetch register cache (post-exec).", target_name(target));
+ LOG_TARGET_ERROR(target, "post-exec: register fetch error");
+ if (status != ERROR_OK) {
+ LOG_TARGET_ERROR(target, "post-exec: EXCCAUSE 0x%02" PRIx32,
+ xtensa_reg_get(target, XT_REG_IDX_EXCCAUSE));
+ }
xtensa_reg_set(target, XT_REG_IDX_EXCCAUSE, exccause);
xtensa_reg_set(target, XT_REG_IDX_CPENABLE, cpenable);
return status;
-----------------------------------------------------------------------
Summary of changes:
doc/openocd.texi | 9 +++++----
src/target/xtensa/xtensa.c | 18 ++++++++++++------
2 files changed, 17 insertions(+), 10 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-01-13 14:38:17
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via 22ebb693b62fd05bcbe2c0101e180b92ca5b11f3 (commit)
from d2b2ac28d9a240a534a8e8bbe2fb0e791f003807 (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 22ebb693b62fd05bcbe2c0101e180b92ca5b11f3
Author: Tarek BOCHKATI <tar...@gm...>
Date: Thu Apr 28 03:46:35 2022 +0100
cortex_m: add detection of MVE feature for Armv8.1-M cores
For Armv8.1-M based cores, detect if the core implements the optional
M-profile vector extension (MVE), using MVFR1 register.
While at there rework armv7m->fp_feature detection based on MVFR0
and MVFR1 registers.
Change-Id: I92d5b1759aea9f7561d285f46acdec51d6efb7b4
Signed-off-by: Tarek BOCHKATI <tar...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/6950
Reviewed-by: Antonio Borneo <bor...@gm...>
Tested-by: jenkins
diff --git a/src/target/armv7m.h b/src/target/armv7m.h
index 8693404d2..2878dd1c7 100644
--- a/src/target/armv7m.h
+++ b/src/target/armv7m.h
@@ -211,6 +211,8 @@ enum {
FPV4_SP,
FPV5_SP,
FPV5_DP,
+ FPV5_MVE_I,
+ FPV5_MVE_F,
};
#define ARMV7M_NUM_CORE_REGS (ARMV7M_CORE_LAST_REG - ARMV7M_CORE_FIRST_REG + 1)
diff --git a/src/target/cortex_m.c b/src/target/cortex_m.c
index d9e8b538f..6a29a5fd4 100644
--- a/src/target/cortex_m.c
+++ b/src/target/cortex_m.c
@@ -2486,16 +2486,17 @@ static bool cortex_m_has_tz(struct target *target)
return (dauthstatus & DAUTHSTATUS_SID_MASK) != 0;
}
-#define MVFR0 0xe000ef40
-#define MVFR1 0xe000ef44
-#define MVFR0_DEFAULT_M4 0x10110021
-#define MVFR1_DEFAULT_M4 0x11000011
+#define MVFR0 0xE000EF40
+#define MVFR0_SP_MASK 0x000000F0
+#define MVFR0_SP 0x00000020
+#define MVFR0_DP_MASK 0x00000F00
+#define MVFR0_DP 0x00000200
-#define MVFR0_DEFAULT_M7_SP 0x10110021
-#define MVFR0_DEFAULT_M7_DP 0x10110221
-#define MVFR1_DEFAULT_M7_SP 0x11000011
-#define MVFR1_DEFAULT_M7_DP 0x12000011
+#define MVFR1 0xE000EF44
+#define MVFR1_MVE_MASK 0x00000F00
+#define MVFR1_MVE_I 0x00000100
+#define MVFR1_MVE_F 0x00000200
static int cortex_m_find_mem_ap(struct adiv5_dap *swjdp,
struct adiv5_ap **debug_ap)
@@ -2509,7 +2510,7 @@ static int cortex_m_find_mem_ap(struct adiv5_dap *swjdp,
int cortex_m_examine(struct target *target)
{
int retval;
- uint32_t cpuid, fpcr, mvfr0, mvfr1;
+ uint32_t cpuid, fpcr;
struct cortex_m_common *cortex_m = target_to_cm(target);
struct adiv5_dap *swjdp = cortex_m->armv7m.arm.dap;
struct armv7m_common *armv7m = target_to_armv7m(target);
@@ -2584,25 +2585,37 @@ int cortex_m_examine(struct target *target)
LOG_TARGET_DEBUG(target, "cpuid: 0x%8.8" PRIx32 "", cpuid);
if (cortex_m->core_info->flags & CORTEX_M_F_HAS_FPV4) {
+ uint32_t mvfr0;
target_read_u32(target, MVFR0, &mvfr0);
- target_read_u32(target, MVFR1, &mvfr1);
- /* test for floating point feature on Cortex-M4 */
- if ((mvfr0 == MVFR0_DEFAULT_M4) && (mvfr1 == MVFR1_DEFAULT_M4)) {
- LOG_TARGET_DEBUG(target, "%s floating point feature FPv4_SP found", cortex_m->core_info->name);
+ if ((mvfr0 & MVFR0_SP_MASK) == MVFR0_SP) {
+ LOG_TARGET_DEBUG(target, "%s floating point feature FPv4_SP found",
+ cortex_m->core_info->name);
armv7m->fp_feature = FPV4_SP;
}
} else if (cortex_m->core_info->flags & CORTEX_M_F_HAS_FPV5) {
+ uint32_t mvfr0, mvfr1;
target_read_u32(target, MVFR0, &mvfr0);
target_read_u32(target, MVFR1, &mvfr1);
- /* test for floating point features on Cortex-M7 */
- if ((mvfr0 == MVFR0_DEFAULT_M7_SP) && (mvfr1 == MVFR1_DEFAULT_M7_SP)) {
- LOG_TARGET_DEBUG(target, "%s floating point feature FPv5_SP found", cortex_m->core_info->name);
+ if ((mvfr0 & MVFR0_DP_MASK) == MVFR0_DP) {
+ if ((mvfr1 & MVFR1_MVE_MASK) == MVFR1_MVE_F) {
+ LOG_TARGET_DEBUG(target, "%s floating point feature FPv5_DP + MVE-F found",
+ cortex_m->core_info->name);
+ armv7m->fp_feature = FPV5_MVE_F;
+ } else {
+ LOG_TARGET_DEBUG(target, "%s floating point feature FPv5_DP found",
+ cortex_m->core_info->name);
+ armv7m->fp_feature = FPV5_DP;
+ }
+ } else if ((mvfr0 & MVFR0_SP_MASK) == MVFR0_SP) {
+ LOG_TARGET_DEBUG(target, "%s floating point feature FPv5_SP found",
+ cortex_m->core_info->name);
armv7m->fp_feature = FPV5_SP;
- } else if ((mvfr0 == MVFR0_DEFAULT_M7_DP) && (mvfr1 == MVFR1_DEFAULT_M7_DP)) {
- LOG_TARGET_DEBUG(target, "%s floating point feature FPv5_DP found", cortex_m->core_info->name);
- armv7m->fp_feature = FPV5_DP;
+ } else if ((mvfr1 & MVFR1_MVE_MASK) == MVFR1_MVE_I) {
+ LOG_TARGET_DEBUG(target, "%s floating point feature MVE-I found",
+ cortex_m->core_info->name);
+ armv7m->fp_feature = FPV5_MVE_I;
}
}
-----------------------------------------------------------------------
Summary of changes:
src/target/armv7m.h | 2 ++
src/target/cortex_m.c | 51 ++++++++++++++++++++++++++++++++-------------------
2 files changed, 34 insertions(+), 19 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-01-13 14:37:39
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via d2b2ac28d9a240a534a8e8bbe2fb0e791f003807 (commit)
from 44e02e1f49cc09703cb3b4088d0c1c4f9e2d9c87 (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 d2b2ac28d9a240a534a8e8bbe2fb0e791f003807
Author: Daniel Anselmi <dan...@gm...>
Date: Sun Mar 12 01:43:32 2023 +0100
ipdbg: improve ipdbg-host speed
By queuing multiple jtag transfers the connection speed between
JTAG-Host and JTAG-Hub is improved. This is due to much less
calls to OS functions. An improvement of about x30 has been
measured with ftdi-based jtag adapters
For this to work the JTAG-Host server needs to know if flow control
is enabled on the JTAG-Hub ports. This is possible with newer
JTAG-Hub/JtagCDC. For old JTAG-Hubs the queuing is not enabled so
this change is backwards compatible.
Change-Id: I8a5108adbe2a2c1e3d3620b5c9ff77a546bfc14e
Signed-off-by: Daniel Anselmi <dan...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7978
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/server/ipdbg.c b/src/server/ipdbg.c
index c1bdb2939..073323032 100644
--- a/src/server/ipdbg.c
+++ b/src/server/ipdbg.c
@@ -20,6 +20,17 @@
#define IPDBG_MIN_DR_LENGTH 11
#define IPDBG_MAX_DR_LENGTH 13
#define IPDBG_TCP_PORT_STR_MAX_LENGTH 6
+#define IPDBG_SCRATCH_MEMORY_SIZE 1024
+#define IPDBG_EMPTY_DOWN_TRANSFERS 1024
+#define IPDBG_CONSECUTIVE_UP_TRANSFERS 1024
+
+#if IPDBG_SCRATCH_MEMORY_SIZE < IPDBG_EMPTY_DOWN_TRANSFERS
+#error "scratch Memory must be at least IPDBG_EMPTY_DOWN_TRANSFERS"
+#endif
+
+#if IPDBG_SCRATCH_MEMORY_SIZE < IPDBG_CONSECUTIVE_UP_TRANSFERS
+#error "scratch Memory must be at least IPDBG_CONSECUTIVE_UP_TRANSFERS"
+#endif
/* private connection data for IPDBG */
struct ipdbg_fifo {
@@ -48,6 +59,13 @@ struct ipdbg_virtual_ir_info {
uint32_t value;
};
+struct ipdbg_hub_scratch_memory {
+ uint8_t *dr_out_vals;
+ uint8_t *dr_in_vals;
+ uint8_t *vir_out_val;
+ struct scan_field *fields;
+};
+
struct ipdbg_hub {
uint32_t user_instruction;
uint32_t max_tools;
@@ -62,7 +80,9 @@ struct ipdbg_hub {
struct connection **connections;
uint8_t data_register_length;
uint8_t dn_xoff;
+ uint8_t flow_control_enabled;
struct ipdbg_virtual_ir_info *virtual_ir;
+ struct ipdbg_hub_scratch_memory scratch_memory;
};
static struct ipdbg_hub *ipdbg_first_hub;
@@ -236,20 +256,28 @@ static int ipdbg_create_hub(struct jtag_tap *tap, uint32_t user_instruction, uin
{
*hub = NULL;
struct ipdbg_hub *new_hub = calloc(1, sizeof(struct ipdbg_hub));
- if (!new_hub) {
- free(virtual_ir);
- LOG_ERROR("Out of memory");
- return ERROR_FAIL;
- }
+ if (!new_hub)
+ goto mem_err_hub;
+ const size_t dreg_buffer_size = DIV_ROUND_UP(data_register_length, 8);
new_hub->max_tools = ipdbg_max_tools_from_data_register_length(data_register_length);
+
+ new_hub->scratch_memory.dr_out_vals = calloc(IPDBG_SCRATCH_MEMORY_SIZE, dreg_buffer_size);
+ new_hub->scratch_memory.dr_in_vals = calloc(IPDBG_SCRATCH_MEMORY_SIZE, dreg_buffer_size);
+ new_hub->scratch_memory.fields = calloc(IPDBG_SCRATCH_MEMORY_SIZE, sizeof(struct scan_field));
new_hub->connections = calloc(new_hub->max_tools, sizeof(struct connection *));
- if (!new_hub->connections) {
- free(virtual_ir);
- free(new_hub);
- LOG_ERROR("Out of memory");
- return ERROR_FAIL;
- }
+
+ if (virtual_ir)
+ new_hub->scratch_memory.vir_out_val = calloc(1, DIV_ROUND_UP(virtual_ir->length, 8));
+
+ if (!new_hub->scratch_memory.dr_out_vals || !new_hub->scratch_memory.dr_in_vals ||
+ !new_hub->scratch_memory.fields || (virtual_ir && !new_hub->scratch_memory.vir_out_val) ||
+ !new_hub->connections)
+ goto mem_err2;
+
+ if (virtual_ir)
+ buf_set_u32(new_hub->scratch_memory.vir_out_val, 0, virtual_ir->length, virtual_ir->value);
+
new_hub->tap = tap;
new_hub->user_instruction = user_instruction;
new_hub->data_register_length = data_register_length;
@@ -260,8 +288,19 @@ static int ipdbg_create_hub(struct jtag_tap *tap, uint32_t user_instruction, uin
new_hub->virtual_ir = virtual_ir;
*hub = new_hub;
-
return ERROR_OK;
+
+mem_err2:
+ free(new_hub->scratch_memory.vir_out_val);
+ free(new_hub->connections);
+ free(new_hub->scratch_memory.fields);
+ free(new_hub->scratch_memory.dr_in_vals);
+ free(new_hub->scratch_memory.dr_out_vals);
+ free(new_hub);
+mem_err_hub:
+ free(virtual_ir);
+ LOG_ERROR("Out of memory");
+ return ERROR_FAIL;
}
static void ipdbg_free_hub(struct ipdbg_hub *hub)
@@ -270,6 +309,10 @@ static void ipdbg_free_hub(struct ipdbg_hub *hub)
return;
free(hub->connections);
free(hub->virtual_ir);
+ free(hub->scratch_memory.dr_out_vals);
+ free(hub->scratch_memory.dr_in_vals);
+ free(hub->scratch_memory.fields);
+ free(hub->scratch_memory.vir_out_val);
free(hub);
}
@@ -348,20 +391,11 @@ static int ipdbg_shift_vir(struct ipdbg_hub *hub)
if (!tap)
return ERROR_FAIL;
- uint8_t *dr_out_val = calloc(DIV_ROUND_UP(hub->virtual_ir->length, 8), 1);
- if (!dr_out_val) {
- LOG_ERROR("Out of memory");
- return ERROR_FAIL;
- }
- buf_set_u32(dr_out_val, 0, hub->virtual_ir->length, hub->virtual_ir->value);
-
- struct scan_field fields;
- ipdbg_init_scan_field(&fields, NULL, hub->virtual_ir->length, dr_out_val);
- jtag_add_dr_scan(tap, 1, &fields, TAP_IDLE);
+ ipdbg_init_scan_field(hub->scratch_memory.fields, NULL,
+ hub->virtual_ir->length, hub->scratch_memory.vir_out_val);
+ jtag_add_dr_scan(tap, 1, hub->scratch_memory.fields, TAP_IDLE);
retval = jtag_execute_queue();
- free(dr_out_val);
-
return retval;
}
@@ -374,33 +408,15 @@ static int ipdbg_shift_data(struct ipdbg_hub *hub, uint32_t dn_data, uint32_t *u
if (!tap)
return ERROR_FAIL;
- uint8_t *dr_out_val = calloc(DIV_ROUND_UP(hub->data_register_length, 8), 1);
- if (!dr_out_val) {
- LOG_ERROR("Out of memory");
- return ERROR_FAIL;
- }
- buf_set_u32(dr_out_val, 0, hub->data_register_length, dn_data);
-
- uint8_t *dr_in_val = NULL;
- if (up_data) {
- dr_in_val = calloc(DIV_ROUND_UP(hub->data_register_length, 8), 1);
- if (!dr_in_val) {
- LOG_ERROR("Out of memory");
- free(dr_out_val);
- return ERROR_FAIL;
- }
- }
+ buf_set_u32(hub->scratch_memory.dr_out_vals, 0, hub->data_register_length, dn_data);
- struct scan_field fields;
- ipdbg_init_scan_field(&fields, dr_in_val, hub->data_register_length, dr_out_val);
- jtag_add_dr_scan(tap, 1, &fields, TAP_IDLE);
+ ipdbg_init_scan_field(hub->scratch_memory.fields, hub->scratch_memory.dr_in_vals,
+ hub->data_register_length, hub->scratch_memory.dr_out_vals);
+ jtag_add_dr_scan(tap, 1, hub->scratch_memory.fields, TAP_IDLE);
int retval = jtag_execute_queue();
if (up_data && retval == ERROR_OK)
- *up_data = buf_get_u32(dr_in_val, 0, hub->data_register_length);
-
- free(dr_out_val);
- free(dr_in_val);
+ *up_data = buf_get_u32(hub->scratch_memory.dr_in_vals, 0, hub->data_register_length);
return retval;
}
@@ -432,6 +448,60 @@ static int ipdbg_distribute_data_from_hub(struct ipdbg_hub *hub, uint32_t up)
return ERROR_OK;
}
+static void ipdbg_check_for_xoff(struct ipdbg_hub *hub, size_t tool,
+ uint32_t rx_data)
+{
+ if ((rx_data & hub->xoff_mask) && hub->last_dn_tool != hub->max_tools) {
+ hub->dn_xoff |= BIT(hub->last_dn_tool);
+ LOG_INFO("tool %d sent xoff", hub->last_dn_tool);
+ }
+
+ hub->last_dn_tool = tool;
+}
+
+static int ipdbg_shift_empty_data(struct ipdbg_hub *hub)
+{
+ if (!hub)
+ return ERROR_FAIL;
+
+ struct jtag_tap *tap = hub->tap;
+ if (!tap)
+ return ERROR_FAIL;
+
+ const size_t dreg_buffer_size = DIV_ROUND_UP(hub->data_register_length, 8);
+ memset(hub->scratch_memory.dr_out_vals, 0, dreg_buffer_size);
+ for (size_t i = 0; i < IPDBG_EMPTY_DOWN_TRANSFERS; ++i) {
+ ipdbg_init_scan_field(hub->scratch_memory.fields + i,
+ hub->scratch_memory.dr_in_vals + i * dreg_buffer_size,
+ hub->data_register_length,
+ hub->scratch_memory.dr_out_vals);
+ jtag_add_dr_scan(tap, 1, hub->scratch_memory.fields + i, TAP_IDLE);
+ }
+
+ int retval = jtag_execute_queue();
+
+ if (retval == ERROR_OK) {
+ uint32_t up_data;
+ for (size_t i = 0; i < IPDBG_EMPTY_DOWN_TRANSFERS; ++i) {
+ up_data = buf_get_u32(hub->scratch_memory.dr_in_vals +
+ i * dreg_buffer_size, 0,
+ hub->data_register_length);
+ int rv = ipdbg_distribute_data_from_hub(hub, up_data);
+ if (rv != ERROR_OK)
+ retval = rv;
+
+ if (i == 0) {
+ /* check if xoff sent is only needed on the first transfer which
+ may contain the xoff of the prev down transfer.
+ */
+ ipdbg_check_for_xoff(hub, hub->max_tools, up_data);
+ }
+ }
+ }
+
+ return retval;
+}
+
static int ipdbg_jtag_transfer_byte(struct ipdbg_hub *hub, size_t tool, struct ipdbg_connection *connection)
{
uint32_t dn = hub->valid_mask | ((tool & hub->tool_mask) << 8) |
@@ -445,14 +515,63 @@ static int ipdbg_jtag_transfer_byte(struct ipdbg_hub *hub, size_t tool, struct i
if (ret != ERROR_OK)
return ret;
- if ((up & hub->xoff_mask) && (hub->last_dn_tool != hub->max_tools)) {
- hub->dn_xoff |= BIT(hub->last_dn_tool);
- LOG_INFO("tool %d sent xoff", hub->last_dn_tool);
+ ipdbg_check_for_xoff(hub, tool, up);
+
+ return ERROR_OK;
+}
+
+static int ipdbg_jtag_transfer_bytes(struct ipdbg_hub *hub,
+ size_t tool, struct ipdbg_connection *connection)
+{
+ if (!hub)
+ return ERROR_FAIL;
+
+ struct jtag_tap *tap = hub->tap;
+ if (!tap)
+ return ERROR_FAIL;
+
+ const size_t dreg_buffer_size = DIV_ROUND_UP(hub->data_register_length, 8);
+ size_t num_tx = (connection->dn_fifo.count < IPDBG_CONSECUTIVE_UP_TRANSFERS) ?
+ connection->dn_fifo.count : IPDBG_CONSECUTIVE_UP_TRANSFERS;
+
+ for (size_t i = 0; i < num_tx; ++i) {
+ uint32_t dn_data = hub->valid_mask | ((tool & hub->tool_mask) << 8) |
+ (0x00fful & ipdbg_get_from_fifo(&connection->dn_fifo));
+ buf_set_u32(hub->scratch_memory.dr_out_vals + i * dreg_buffer_size, 0,
+ hub->data_register_length, dn_data);
+
+ ipdbg_init_scan_field(hub->scratch_memory.fields + i,
+ hub->scratch_memory.dr_in_vals +
+ i * dreg_buffer_size,
+ hub->data_register_length,
+ hub->scratch_memory.dr_out_vals +
+ i * dreg_buffer_size);
+ jtag_add_dr_scan(tap, 1, hub->scratch_memory.fields + i, TAP_IDLE);
}
- hub->last_dn_tool = tool;
+ int retval = jtag_execute_queue();
- return ERROR_OK;
+ if (retval == ERROR_OK) {
+ uint32_t up_data;
+ for (size_t i = 0; i < num_tx; ++i) {
+ up_data = buf_get_u32(hub->scratch_memory.dr_in_vals +
+ i * dreg_buffer_size,
+ 0, hub->data_register_length);
+ int rv = ipdbg_distribute_data_from_hub(hub, up_data);
+ if (rv != ERROR_OK)
+ retval = rv;
+ if (i == 0) {
+ /* check if xoff sent is only needed on the first transfer which
+ may contain the xoff of the prev down transfer.
+ No checks for this channel because this function is only
+ called for channels without enabled flow control.
+ */
+ ipdbg_check_for_xoff(hub, tool, up_data);
+ }
+ }
+ }
+
+ return retval;
}
static int ipdbg_polling_callback(void *priv)
@@ -468,33 +587,25 @@ static int ipdbg_polling_callback(void *priv)
return ret;
/* transfer dn buffers to jtag-hub */
- unsigned int num_transfers = 0;
for (size_t tool = 0; tool < hub->max_tools; ++tool) {
struct connection *conn = hub->connections[tool];
if (conn && conn->priv) {
struct ipdbg_connection *connection = conn->priv;
while (((hub->dn_xoff & BIT(tool)) == 0) && !ipdbg_fifo_is_empty(&connection->dn_fifo)) {
- ret = ipdbg_jtag_transfer_byte(hub, tool, connection);
+ if (hub->flow_control_enabled & BIT(tool))
+ ret = ipdbg_jtag_transfer_byte(hub, tool, connection);
+ else
+ ret = ipdbg_jtag_transfer_bytes(hub, tool, connection);
if (ret != ERROR_OK)
return ret;
- ++num_transfers;
}
}
}
/* some transfers to get data from jtag-hub in case there is no dn data */
- while (num_transfers++ < hub->max_tools) {
- uint32_t dn = 0;
- uint32_t up = 0;
-
- int retval = ipdbg_shift_data(hub, dn, &up);
- if (retval != ERROR_OK)
- return ret;
-
- retval = ipdbg_distribute_data_from_hub(hub, up);
- if (retval != ERROR_OK)
- return ret;
- }
+ ret = ipdbg_shift_empty_data(hub);
+ if (ret != ERROR_OK)
+ return ret;
/* write from up fifos to sockets */
for (size_t tool = 0; tool < hub->max_tools; ++tool) {
@@ -510,6 +621,33 @@ static int ipdbg_polling_callback(void *priv)
return ERROR_OK;
}
+static int ipdbg_get_flow_control_info_from_hub(struct ipdbg_hub *hub)
+{
+ uint32_t up_data;
+
+ /* on older implementations the flow_control_enable_word is not sent to us.
+ so we don't know -> assume it's enabled on all channels */
+ hub->flow_control_enabled = 0x7f;
+
+ int ret = ipdbg_shift_data(hub, 0UL, &up_data);
+ if (ret != ERROR_OK)
+ return ret;
+
+ const bool valid_up_data = up_data & hub->valid_mask;
+ if (valid_up_data) {
+ const size_t tool = (up_data >> 8) & hub->tool_mask;
+ /* the first valid data from hub is flow_control_enable_word */
+ if (tool == hub->tool_mask)
+ hub->flow_control_enabled = up_data & 0x007f;
+ else
+ ipdbg_distribute_data_from_hub(hub, up_data);
+ }
+
+ LOG_INFO("Flow control enabled on IPDBG JTAG Hub: 0x%02x", hub->flow_control_enabled);
+
+ return ERROR_OK;
+}
+
static int ipdbg_start_polling(struct ipdbg_service *service, struct connection *connection)
{
struct ipdbg_hub *hub = service->hub;
@@ -536,6 +674,10 @@ static int ipdbg_start_polling(struct ipdbg_service *service, struct connection
if (ret != ERROR_OK)
return ret;
+ ret = ipdbg_get_flow_control_info_from_hub(hub);
+ if (ret != ERROR_OK)
+ return ret;
+
LOG_INFO("IPDBG start_polling");
const int time_ms = 20;
-----------------------------------------------------------------------
Summary of changes:
src/server/ipdbg.c | 276 ++++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 209 insertions(+), 67 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-01-12 07:13:39
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via 44e02e1f49cc09703cb3b4088d0c1c4f9e2d9c87 (commit)
from 15f74c2595fe20235b27ce079a35e066d6b6611c (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 44e02e1f49cc09703cb3b4088d0c1c4f9e2d9c87
Author: Tomas Vanek <va...@fb...>
Date: Sun Dec 10 11:58:43 2023 +0100
jtag/drivers/cmsis_dap: use oocd_libusb_dev_mem_alloc() helper
On some systems (at least Windows/CYGWIN and macOS) libusb_dev_mem_alloc()
simply returns NULL. The helper can fall-back to malloc() to allocate
CMSIS-DAP pending command/response buffers.
Fixes: fd75e9e54270 (jtag/drivers/cmsis_dap_bulk: use asynchronous libusb transfer)
Signed-off-by: Tomas Vanek <va...@fb...>
Change-Id: I89660f6747ad9d494b8192711cbbee5764e058fa
Reviewed-on: https://review.openocd.org/c/openocd/+/8044
Reviewed-by: Antonio Borneo <bor...@gm...>
Tested-by: jenkins
diff --git a/src/jtag/drivers/cmsis_dap_usb_bulk.c b/src/jtag/drivers/cmsis_dap_usb_bulk.c
index 17e490f05..92a972a04 100644
--- a/src/jtag/drivers/cmsis_dap_usb_bulk.c
+++ b/src/jtag/drivers/cmsis_dap_usb_bulk.c
@@ -33,12 +33,6 @@
#include "cmsis_dap.h"
#include "libusb_helper.h"
-#if !defined(LIBUSB_API_VERSION) || (LIBUSB_API_VERSION < 0x01000105) \
- || defined(_WIN32) || defined(__CYGWIN__)
- #define libusb_dev_mem_alloc(dev, sz) malloc(sz)
- #define libusb_dev_mem_free(dev, buffer, sz) free(buffer)
-#endif
-
enum {
CMSIS_DAP_TRANSFER_PENDING = 0, /* must be 0, used in libusb_handle_events_completed */
CMSIS_DAP_TRANSFER_IDLE,
@@ -599,33 +593,34 @@ static int cmsis_dap_usb_alloc(struct cmsis_dap *dap, unsigned int pkt_sz)
dap->command = dap->packet_buffer;
dap->response = dap->packet_buffer;
+ struct cmsis_dap_backend_data *bdata = dap->bdata;
for (unsigned int i = 0; i < MAX_PENDING_REQUESTS; i++) {
- dap->bdata->command_transfers[i].buffer =
- libusb_dev_mem_alloc(dap->bdata->dev_handle, pkt_sz);
- if (!dap->bdata->command_transfers[i].buffer) {
- LOG_ERROR("unable to allocate CMSIS-DAP packet buffer");
- return ERROR_FAIL;
- }
- dap->bdata->response_transfers[i].buffer =
- libusb_dev_mem_alloc(dap->bdata->dev_handle, pkt_sz);
- if (!dap->bdata->response_transfers[i].buffer) {
- LOG_ERROR("unable to allocate CMSIS-DAP packet buffer");
+ bdata->command_transfers[i].buffer =
+ oocd_libusb_dev_mem_alloc(bdata->dev_handle, pkt_sz);
+
+ bdata->response_transfers[i].buffer =
+ oocd_libusb_dev_mem_alloc(bdata->dev_handle, pkt_sz);
+
+ if (!bdata->command_transfers[i].buffer
+ || !bdata->response_transfers[i].buffer) {
+ LOG_ERROR("unable to allocate CMSIS-DAP pending packet buffer");
return ERROR_FAIL;
}
}
-
return ERROR_OK;
}
static void cmsis_dap_usb_free(struct cmsis_dap *dap)
{
+ struct cmsis_dap_backend_data *bdata = dap->bdata;
+
for (unsigned int i = 0; i < MAX_PENDING_REQUESTS; i++) {
- libusb_dev_mem_free(dap->bdata->dev_handle,
- dap->bdata->command_transfers[i].buffer, dap->packet_size);
- dap->bdata->command_transfers[i].buffer = NULL;
- libusb_dev_mem_free(dap->bdata->dev_handle,
- dap->bdata->response_transfers[i].buffer, dap->packet_size);
- dap->bdata->response_transfers[i].buffer = NULL;
+ oocd_libusb_dev_mem_free(bdata->dev_handle,
+ bdata->command_transfers[i].buffer, dap->packet_size);
+ oocd_libusb_dev_mem_free(bdata->dev_handle,
+ bdata->response_transfers[i].buffer, dap->packet_size);
+ bdata->command_transfers[i].buffer = NULL;
+ bdata->response_transfers[i].buffer = NULL;
}
free(dap->packet_buffer);
-----------------------------------------------------------------------
Summary of changes:
src/jtag/drivers/cmsis_dap_usb_bulk.c | 41 +++++++++++++++--------------------
1 file changed, 18 insertions(+), 23 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2024-01-12 07:13:01
|
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 15f74c2595fe20235b27ce079a35e066d6b6611c (commit)
from adcc8ef87bc1ed47c95f1f2d23072b2b916e1555 (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 15f74c2595fe20235b27ce079a35e066d6b6611c
Author: Tomas Vanek <va...@fb...>
Date: Wed Dec 20 13:20:27 2023 +0100
drivers/libusb_helper: introduce oocd_libusb_dev_mem_alloc() helper
On some systems (at least Windows/CYGWIN and macOS) libusb_dev_mem_alloc()
simply returns NULL.
Use the result of the very first libusb_dev_mem_alloc() call to decide
if the underlining system supports dev mem allocation or we should
fall-back to plain heap malloc().
From the decision time on, keep using the selected type of memory allocator
and deallocator.
Signed-off-by: Tomas Vanek <va...@fb...>
Change-Id: Ia1f0965cea44b4bb6d936b02ec43f5a16a46f080
Reviewed-on: https://review.openocd.org/c/openocd/+/8059
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/jtag/drivers/libusb_helper.c b/src/jtag/drivers/libusb_helper.c
index 9d788ee39..57ea8cd3f 100644
--- a/src/jtag/drivers/libusb_helper.c
+++ b/src/jtag/drivers/libusb_helper.c
@@ -377,3 +377,59 @@ int jtag_libusb_handle_events_completed(int *completed)
{
return libusb_handle_events_completed(jtag_libusb_context, completed);
}
+
+static enum {
+ DEV_MEM_NOT_YET_DECIDED,
+ DEV_MEM_AVAILABLE,
+ DEV_MEM_FALLBACK_MALLOC
+} dev_mem_allocation;
+
+/* Older libusb does not implement following API calls - define stubs instead */
+#if !defined(LIBUSB_API_VERSION) || (LIBUSB_API_VERSION < 0x01000105)
+static uint8_t *libusb_dev_mem_alloc(libusb_device_handle *devh, size_t length)
+{
+ return NULL;
+}
+
+static int libusb_dev_mem_free(libusb_device_handle *devh,
+ uint8_t *buffer, size_t length)
+{
+ return LIBUSB_ERROR_NOT_SUPPORTED;
+}
+#endif
+
+uint8_t *oocd_libusb_dev_mem_alloc(libusb_device_handle *devh,
+ size_t length)
+{
+ uint8_t *buffer = NULL;
+ if (dev_mem_allocation != DEV_MEM_FALLBACK_MALLOC)
+ buffer = libusb_dev_mem_alloc(devh, length);
+
+ if (dev_mem_allocation == DEV_MEM_NOT_YET_DECIDED)
+ dev_mem_allocation = buffer ? DEV_MEM_AVAILABLE : DEV_MEM_FALLBACK_MALLOC;
+
+ if (dev_mem_allocation == DEV_MEM_FALLBACK_MALLOC)
+ buffer = malloc(length);
+
+ return buffer;
+}
+
+int oocd_libusb_dev_mem_free(libusb_device_handle *devh,
+ uint8_t *buffer, size_t length)
+{
+ if (!buffer)
+ return ERROR_OK;
+
+ switch (dev_mem_allocation) {
+ case DEV_MEM_AVAILABLE:
+ return jtag_libusb_error(libusb_dev_mem_free(devh, buffer, length));
+
+ case DEV_MEM_FALLBACK_MALLOC:
+ free(buffer);
+ return ERROR_OK;
+
+ case DEV_MEM_NOT_YET_DECIDED:
+ return ERROR_FAIL;
+ }
+ return ERROR_FAIL;
+}
diff --git a/src/jtag/drivers/libusb_helper.h b/src/jtag/drivers/libusb_helper.h
index 09309b40c..3cd83c6b3 100644
--- a/src/jtag/drivers/libusb_helper.h
+++ b/src/jtag/drivers/libusb_helper.h
@@ -67,4 +67,27 @@ int jtag_libusb_choose_interface(struct libusb_device_handle *devh,
int jtag_libusb_get_pid(struct libusb_device *dev, uint16_t *pid);
int jtag_libusb_handle_events_completed(int *completed);
+/**
+ * Attempts to allocate a block of persistent DMA memory suitable for transfers
+ * against the USB device. Fall-back to the ordinary heap malloc()
+ * if the first libusb_dev_mem_alloc() call fails.
+ * @param devh _libusb_ device handle.
+ * @param length size of desired data buffer
+ * @returns a pointer to the newly allocated memory, or NULL on failure
+ */
+uint8_t *oocd_libusb_dev_mem_alloc(libusb_device_handle *devh,
+ size_t length);
+
+/**
+ * Free device memory allocated with oocd_libusb_dev_mem_alloc().
+ * Uses either libusb_dev_mem_free() or free() consistently with
+ * the used method of allocation.
+ * @param devh _libusb_ device handle.
+ * @param buffer pointer to the previously allocated memory
+ * @param length size of desired data buffer
+ * @returns Returns ERROR_OK on success, ERROR_FAIL otherwise.
+ */
+int oocd_libusb_dev_mem_free(libusb_device_handle *devh,
+ uint8_t *buffer, size_t length);
+
#endif /* OPENOCD_JTAG_DRIVERS_LIBUSB_HELPER_H */
-----------------------------------------------------------------------
Summary of changes:
src/jtag/drivers/libusb_helper.c | 56 ++++++++++++++++++++++++++++++++++++++++
src/jtag/drivers/libusb_helper.h | 23 +++++++++++++++++
2 files changed, 79 insertions(+)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2023-12-30 13:15:38
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via 5c53034d85480d0855394c4683733f61b27b6c5e (commit)
from b0f99dfed0d0f95d3f9190f1767b4f2f6969f5bc (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 5c53034d85480d0855394c4683733f61b27b6c5e
Author: Marc Schink <de...@za...>
Date: Tue Nov 14 10:55:46 2023 +0100
doc/openocd: Mention APM32F1 and APM32F4 series
Change-Id: I2ff28b0fdf4923a58771a44ad6e83ac871d6fa9e
Signed-off-by: Marc Schink <de...@za...>
Reviewed-on: https://review.openocd.org/c/openocd/+/8018
Tested-by: jenkins
Reviewed-by: Tomas Vanek <va...@fb...>
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/doc/openocd.texi b/doc/openocd.texi
index 395d03ca2..cc133f791 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -7709,7 +7709,7 @@ applied to all of them.
@deffn {Flash Driver} {stm32f1x}
This driver supports the STM32F0, STM32F1 and STM32F3 microcontroller series from STMicroelectronics.
The driver is also compatible with the GD32F1, GD32VF103 (RISC-V core), GD32F3 and GD32E23 microcontroller series from GigaDevice.
-The driver also supports the APM32F0 series from Geehy Semiconductor.
+The driver also supports the APM32F0 and APM32F1 series from Geehy Semiconductor.
The driver automatically recognizes a number of these chips using the chip identification register, and autoconfigures itself.
@example
@@ -7771,6 +7771,7 @@ The @var{num} parameter is a value shown by @command{flash banks}.
@deffn {Flash Driver} {stm32f2x}
All members of the STM32F2, STM32F4 and STM32F7 microcontroller families from STMicroelectronics
include internal flash and use ARM Cortex-M3/M4/M7 cores.
+The driver also works for the APM32F4 series from Geehy Semiconductor.
The driver automatically recognizes a number of these chips using
the chip identification register, and autoconfigures itself.
-----------------------------------------------------------------------
Summary of changes:
doc/openocd.texi | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
hooks/post-receive
--
Main OpenOCD repository
|