static bool cmd_jtag_scan(target *t, int argc, char **argv) { (void)t; uint8_t *irlens = NULL; gdb_outf("Target voltage: %s\n", platform_target_voltage()); if (argc > 1) { /* Accept a list of IR lengths on command line */ irlens = alloca(argc); for (int i = 1; i < argc; i++) irlens[i-1] = atoi(argv[i]); irlens[argc-1] = 0; } int devs = jtag_scan(irlens); if(devs < 0) { gdb_out("JTAG device scan failed!\n"); return false; } if(devs == 0) { gdb_out("JTAG scan found no devices!\n"); return false; } gdb_outf("Device IR Len IDCODE Description\n"); for(int i = 0; i < jtag_dev_count; i++) gdb_outf("%d\t%d\t0x%08lX %s\n", i, jtag_devs[i].ir_len, jtag_devs[i].idcode, jtag_devs[i].descr); gdb_out("\n"); cmd_targets(NULL); return true; }
bool cmd_swdp_scan(void) { gdb_outf("Target voltage: %s\n", platform_target_voltage()); if(adiv5_swdp_scan() < 0) { gdb_out("SW-DP scan failed!\n"); return false; } //gdb_outf("SW-DP detected IDCODE: 0x%08X\n", adiv5_dp_list->idcode); cmd_targets(NULL); return true; }
static bool cmd_jtag_scan(target *t, int argc, char **argv) { (void)t; uint8_t irlens[argc]; gdb_outf("Target voltage: %s\n", platform_target_voltage()); if (argc > 1) { /* Accept a list of IR lengths on command line */ for (int i = 1; i < argc; i++) irlens[i-1] = atoi(argv[i]); irlens[argc-1] = 0; } if(connect_assert_srst) platform_srst_set_val(true); /* will be deasserted after attach */ int devs = -1; volatile struct exception e; TRY_CATCH (e, EXCEPTION_ALL) { devs = jtag_scan(argc > 1 ? irlens : NULL); }