From 6330326513300edaf201c221a39d818e86bede36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Sun, 24 May 2026 00:36:46 +0200 Subject: [PATCH] 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. --- modules/script/script.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/modules/script/script.c b/modules/script/script.c index 6045ac4..2728a48 100644 --- a/modules/script/script.c +++ b/modules/script/script.c @@ -1585,32 +1585,34 @@ static int cmd_autoinit(script_ctx *ctx, char *line) } const char *cmd_init_and_scan_help[] = { - "", // Arguments "1(type) ..." - "explanations line one", // Explanations - "explanations line two", + "", + "Scan the JTAG chain and report the devices found with their IDCODEs.", + "Unlike jtag_autoinit, it does not load any BSDL.", "" }; static int cmd_init_and_scan(script_ctx *ctx, char *line) { jtag_core *jc; - int ret; + int ret, n, i; jc = (jtag_core *)ctx->app_ctx; 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"); - - return JTAG_CORE_NO_ERROR; - } - else - { - ctx->script_printf(ctx, MSG_INFO_0, "JTAG Scan return code : %d\n", ret); + ctx->script_printf(ctx, MSG_ERROR, "JTAG scan failed (code %d)\n", ret); + return 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[] = {