jtag: parse command options in 'swd newdap' 27/7427/2
authorAntonio Borneo <borneo.antonio@gmail.com>
Sun, 1 Jan 2023 17:26:53 +0000 (18:26 +0100)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sun, 15 Jan 2023 15:11:50 +0000 (15:11 +0000)
The same code is currently used for commands 'jtag newtap' and
'swd newdap' (plus dapdirect versions), but for SWD case the code
skips the parsing of the command line as not every flag is used.
This has the drawback that syntax errors get unchecked.

Move the check about the transport so the command line get always
parsed even when the corresponding flags are not useful.

Change-Id: I596c3beb04e9e8a9ebe6ee68a61395b679d43b3e
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7427
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
src/jtag/tcl.c

index b1815b79da7d0796d4dbecc46d19f171be7caa77..fc0d562e23ce504e7cbe417a0635c82289be5b15 100644 (file)
@@ -557,13 +557,6 @@ static int jim_newtap_cmd(struct jim_getopt_info *goi)
        LOG_DEBUG("Creating New Tap, Chip: %s, Tap: %s, Dotted: %s, %d params",
                tap->chip, tap->tapname, tap->dotted_name, goi->argc);
 
-       if (!transport_is_jtag()) {
-               /* SWD doesn't require any JTAG tap parameters */
-               tap->enabled = true;
-               jtag_tap_init(tap);
-               return JIM_OK;
-       }
-
        /* IEEE specifies that the two LSBs of an IR scan are 01, so make
         * that the default.  The "-ircapture" and "-irmask" options are only
         * needed to cope with nonstandard TAPs, or to specify more bits.
@@ -618,7 +611,7 @@ static int jim_newtap_cmd(struct jim_getopt_info *goi)
        tap->enabled = !tap->disabled_after_reset;
 
        /* Did all the required option bits get cleared? */
-       if (tap->ir_length != 0) {
+       if (!transport_is_jtag() || tap->ir_length != 0) {
                jtag_tap_init(tap);
                return JIM_OK;
        }

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)