jtag: parse command options in 'swd newdap'

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>
This commit is contained in:
Antonio Borneo 2023-01-01 18:26:53 +01:00
parent 69571354f4
commit 7a890a8f25
1 changed files with 1 additions and 8 deletions

View 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;
}