From: Antonio Borneo Date: Sun, 1 Jan 2023 17:26:53 +0000 (+0100) Subject: jtag: parse command options in 'swd newdap' X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=commitdiff_plain;h=7a890a8f256f28b1c8b0dde3b62ab81c7c139d55 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 Reviewed-on: https://review.openocd.org/c/openocd/+/7427 Tested-by: jenkins Reviewed-by: Tomas Vanek --- diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c index b1815b79da..fc0d562e23 100644 --- a/src/jtag/tcl.c +++ b/src/jtag/tcl.c @@ -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; }