X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Fjtag%2Ftcl.c;h=7f08b00fb12eeead51b403eb80341f19091c4854;hp=3f63ffc15ff8ece7f50b7f8f3b8e2ce66add9ca1;hb=ef02b69b14d133b061217a91add5a028a77e86bc;hpb=517ba0690dcc9e859a05df2113ce32401a5ab254 diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c index 3f63ffc15f..7f08b00fb1 100644 --- a/src/jtag/tcl.c +++ b/src/jtag/tcl.c @@ -59,8 +59,6 @@ static const Jim_Nvp nvp_jtag_tap_event[] = { { .name = NULL, .value = -1 } }; -extern struct jtag_interface *jtag_interface; - struct jtag_tap *jtag_tap_by_jim_obj(Jim_Interp *interp, Jim_Obj *o) { const char *cp = Jim_GetString(o, NULL); @@ -171,7 +169,10 @@ static int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *args return JIM_ERR; num_fields = (argc-2)/2; - assert(num_fields > 0); + if (num_fields <= 0) { + Jim_SetResultString(interp, "drscan: no scan fields supplied", -1); + return JIM_ERR; + } fields = malloc(sizeof(struct scan_field) * num_fields); for (i = 2; i < argc; i += 2) { long bits; @@ -552,8 +553,15 @@ static int jim_newtap_cmd(Jim_GetOptInfo *goi) LOG_DEBUG("Creating New Tap, Chip: %s, Tap: %s, Dotted: %s, %d params", pTap->chip, pTap->tapname, pTap->dotted_name, goi->argc); + if (!transport_is_jtag()) { + /* SWD doesn't require any JTAG tap parameters */ + pTap->enabled = true; + jtag_tap_init(pTap); + return JIM_OK; + } + /* IEEE specifies that the two LSBs of an IR scan are 01, so make - * that the default. The "-irlen" and "-irmask" options are only + * that the default. The "-ircapture" and "-irmask" options are only * needed to cope with nonstandard TAPs, or to specify more bits. */ pTap->ir_capture_mask = 0x03;