|
From: openocd-gerrit <ope...@us...> - 2023-03-25 18:10:29
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via 842a12f4caf307e756045c14011c402a20da30b6 (commit)
via 80fc9fabc66a0bc767467fa14c703e5a9f340cd3 (commit)
from d05c68667129705ecfd42c6029a60e849518d50c (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 842a12f4caf307e756045c14011c402a20da30b6
Author: Antonio Borneo <bor...@gm...>
Date: Sun Dec 18 18:49:02 2022 +0100
helper: util: rewrite command 'ms' as COMMAND_HANDLER
Use full 64 bits in output; no reason to truncate at 32 bits.
Change-Id: I433815a381e147731ff0da2c805170649a9bcf38
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7487
Reviewed-by: Tomas Vanek <va...@fb...>
Tested-by: jenkins
diff --git a/src/helper/util.c b/src/helper/util.c
index bf18f8e60..5e12021ff 100644
--- a/src/helper/util.c
+++ b/src/helper/util.c
@@ -13,28 +13,21 @@
#include "log.h"
#include "time_support.h"
-static int jim_util_ms(Jim_Interp *interp,
- int argc,
- Jim_Obj * const *argv)
+COMMAND_HANDLER(handler_util_ms)
{
- if (argc != 1) {
- Jim_WrongNumArgs(interp, 1, argv, "ls ?dir?");
- return JIM_ERR;
- }
+ if (CMD_ARGC != 0)
+ return ERROR_COMMAND_SYNTAX_ERROR;
- /* Cast from 64 to 32 bit int works for 2's-compliment
- * when calculating differences*/
- Jim_SetResult(interp, Jim_NewIntObj(interp, (int)timeval_ms()));
+ command_print(CMD, "%" PRId64, timeval_ms());
- return JIM_OK;
+ return ERROR_OK;
}
static const struct command_registration util_command_handlers[] = {
- /* jim handlers */
{
.name = "ms",
.mode = COMMAND_ANY,
- .jim_handler = jim_util_ms,
+ .handler = handler_util_ms,
.help =
"Returns ever increasing milliseconds. Used to calculate differences in time.",
.usage = "",
commit 80fc9fabc66a0bc767467fa14c703e5a9f340cd3
Author: Antonio Borneo <bor...@gm...>
Date: Sun Dec 18 16:09:02 2022 +0100
flash: nor: rewrite command 'flash list' as COMMAND_HANDLER
The mixed use of jim commands and OpenOCD commands is error prone
due to handling of errors through JIM_xx and ERROR_yy.
Rewrite the jim command 'flash list' as OpenOCD command.
While there:
- format in a human readable way the output dictionary list, while
preserving the structure of its TCL data;
- add the mandatory 'usage' field.
Change-Id: I1ee69870d3ab3c1cfc46cd2b8ec03de6b2300bd6
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7486
Reviewed-by: Tomas Vanek <va...@fb...>
Tested-by: jenkins
diff --git a/src/flash/nor/tcl.c b/src/flash/nor/tcl.c
index 4ff6d9838..ecbcf00aa 100644
--- a/src/flash/nor/tcl.c
+++ b/src/flash/nor/tcl.c
@@ -1324,40 +1324,27 @@ COMMAND_HANDLER(handle_flash_banks_command)
return ERROR_OK;
}
-static int jim_flash_list(Jim_Interp *interp, int argc, Jim_Obj * const *argv)
+COMMAND_HANDLER(handle_flash_list)
{
- if (argc != 1) {
- Jim_WrongNumArgs(interp, 1, argv,
- "no arguments to 'flash list' command");
- return JIM_ERR;
- }
-
- Jim_Obj *list = Jim_NewListObj(interp, NULL, 0);
+ if (CMD_ARGC != 0)
+ return ERROR_COMMAND_SYNTAX_ERROR;
for (struct flash_bank *p = flash_bank_list(); p; p = p->next) {
- Jim_Obj *elem = Jim_NewListObj(interp, NULL, 0);
-
- Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, "name", -1));
- Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, p->name, -1));
- Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, "driver", -1));
- Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, p->driver->name, -1));
- Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, "base", -1));
- Jim_ListAppendElement(interp, elem, Jim_NewIntObj(interp, p->base));
- Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, "size", -1));
- Jim_ListAppendElement(interp, elem, Jim_NewIntObj(interp, p->size));
- Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, "bus_width", -1));
- Jim_ListAppendElement(interp, elem, Jim_NewIntObj(interp, p->bus_width));
- Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, "chip_width", -1));
- Jim_ListAppendElement(interp, elem, Jim_NewIntObj(interp, p->chip_width));
- Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, "target", -1));
- Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, target_name(p->target), -1));
-
- Jim_ListAppendElement(interp, list, elem);
+ command_print(CMD,
+ "{\n"
+ " name %s\n"
+ " driver %s\n"
+ " base " TARGET_ADDR_FMT "\n"
+ " size 0x%" PRIx32 "\n"
+ " bus_width %u\n"
+ " chip_width %u\n"
+ " target %s\n"
+ "}",
+ p->name, p->driver->name, p->base, p->size, p->bus_width, p->chip_width,
+ target_name(p->target));
}
- Jim_SetResult(interp, list);
-
- return JIM_OK;
+ return ERROR_OK;
}
COMMAND_HANDLER(handle_flash_init_command)
@@ -1404,8 +1391,9 @@ static const struct command_registration flash_config_command_handlers[] = {
{
.name = "list",
.mode = COMMAND_ANY,
- .jim_handler = jim_flash_list,
+ .handler = handle_flash_list,
.help = "Returns a list of details about the flash banks.",
+ .usage = "",
},
COMMAND_REGISTRATION_DONE
};
-----------------------------------------------------------------------
Summary of changes:
src/flash/nor/tcl.c | 48 ++++++++++++++++++------------------------------
src/helper/util.c | 19 ++++++-------------
2 files changed, 24 insertions(+), 43 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|