script: jtag_scan reports the devices found

jtag_scan only printed "JTAG Scan done". Now it prints the device count
and each device's IDCODE (it scans the chain but, unlike jtag_autoinit,
loads no BSDL). Also replaces the placeholder help text.

Validated on the KCU105: shows device 0 IDCODE 0x03822093.
This commit is contained in:
2026-05-24 00:36:46 +02:00
parent 71b74fa03d
commit 6330326513

View File

@@ -1585,32 +1585,34 @@ static int cmd_autoinit(script_ctx *ctx, char *line)
} }
const char *cmd_init_and_scan_help[] = { const char *cmd_init_and_scan_help[] = {
"", // Arguments "1<arg>(type) ..." "",
"explanations line one", // Explanations "Scan the JTAG chain and report the devices found with their IDCODEs.",
"explanations line two", "Unlike jtag_autoinit, it does not load any BSDL.",
"" ""
}; };
static int cmd_init_and_scan(script_ctx *ctx, char *line) static int cmd_init_and_scan(script_ctx *ctx, char *line)
{ {
jtag_core *jc; jtag_core *jc;
int ret; int ret, n, i;
jc = (jtag_core *)ctx->app_ctx; jc = (jtag_core *)ctx->app_ctx;
ret = jtagcore_scan_and_init_chain(jc); ret = jtagcore_scan_and_init_chain(jc);
if (ret != JTAG_CORE_NO_ERROR)
if (ret == JTAG_CORE_NO_ERROR)
{ {
ctx->script_printf(ctx, MSG_INFO_0, "JTAG Scan done\n"); ctx->script_printf(ctx, MSG_ERROR, "JTAG scan failed (code %d)\n", ret);
return ret;
return JTAG_CORE_NO_ERROR;
}
else
{
ctx->script_printf(ctx, MSG_INFO_0, "JTAG Scan return code : %d\n", ret);
} }
return ret; n = jtagcore_get_number_of_devices(jc);
ctx->script_printf(ctx, MSG_INFO_0, "%d device(s) found\n", n);
for (i = 0; i < n; i++)
{
ctx->script_printf(ctx, MSG_INFO_0, " Device %d : IDCODE 0x%.8lX\n",
i, jtagcore_get_dev_id(jc, i));
}
ctx->last_data_value = n;
return JTAG_CORE_NO_ERROR;
} }
const char *cmd_print_nb_dev_help[] = { const char *cmd_print_nb_dev_help[] = {