jtag: fix jtag configure command containing events 25/8125/2
authorAntonio Borneo <borneo.antonio@gmail.com>
Thu, 1 Feb 2024 09:55:51 +0000 (10:55 +0100)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sun, 11 Feb 2024 23:07:46 +0000 (23:07 +0000)
Commit ea2e26f7d521 ("jtag: rewrite jim_jtag_configure() as
COMMAND_HANDLER") breaks the option -event if it is the last of
the command line.
This can be tested, even without any device connected, through:
#> openocd -f board/ti_cc26x0_launchpad.cfg
wrong # args: should be "-event <event-name> <event-body>"

Fix the check on available arguments after -event.

Change-Id: Iec1522238f906d61a888a09a7685acd9ac6442a7
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Lorenz Brun <lorenz@brun.one>
Fixes: ea2e26f7d521 ("jtag: rewrite jim_jtag_configure() as COMMAND_HANDLER")
Reviewed-on: https://review.openocd.org/c/openocd/+/8125
Tested-by: jenkins
Reviewed-by: Lorenz Brun <lorenz@brun.one>
src/jtag/tcl.c

index 163edfa19e34f94932915e55d1cfa94fa60f184e..79955290187e22c56e8d63cb99faaebf41a701a1 100644 (file)
@@ -315,7 +315,7 @@ __COMMAND_HANDLER(handle_jtag_configure)
                const struct nvp *n = nvp_name2value(nvp_config_opts, CMD_ARGV[i]);
                switch (n->value) {
                case JCFG_EVENT:
-                       if (i + (is_configure ? 3 : 2) >= CMD_ARGC) {
+                       if (i + (is_configure ? 2 : 1) >= CMD_ARGC) {
                                command_print(CMD, "wrong # args: should be \"-event <event-name>%s\"",
                                                is_configure ? " <event-body>" : "");
                                return ERROR_COMMAND_ARGUMENT_INVALID;

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)