This is an automated email from Gerrit.

"Kirill Radkin <kirill.rad...@syntacore.com>" just uploaded a new patch set to 
Gerrit, which you can find at https://review.openocd.org/c/openocd/+/7741

-- gerrit

commit 7e6f7ce2fb5c62bfb05cb367ace4524a355a2ef1
Author: Kirill Radkin <kirill.rad...@syntacore.com>
Date:   Fri Jun 16 12:09:32 2023 +0300

    driver: OpenOCD fails on assert during run "drscan" command
    
    OpenOCD fails if all TAPS are in BYPASS mode.
    Now in this case "drscan" fails with corresponding error.
    
    Change-Id: Ic882acbfc9b6a9f4b0c3bb4741a49f3981503c8c
    Signed-off-by: Kirill Radkin <kirill.rad...@syntacore.com>

diff --git a/src/jtag/drivers/driver.c b/src/jtag/drivers/driver.c
index 409b800874..c6af56bc1d 100644
--- a/src/jtag/drivers/driver.c
+++ b/src/jtag/drivers/driver.c
@@ -110,12 +110,21 @@ int interface_jtag_add_dr_scan(struct jtag_tap *active, 
int in_num_fields,
        /* count devices in bypass */
 
        size_t bypass_devices = 0;
+       size_t all_devices = 0;
 
        for (struct jtag_tap *tap = jtag_tap_next_enabled(NULL); tap; tap = 
jtag_tap_next_enabled(tap)) {
+               all_devices++;
+
                if (tap->bypass)
                        bypass_devices++;
        }
 
+       if (all_devices == bypass_devices) {
+               LOG_ERROR("At least one TAP shouldn't be in BYPASS mode");
+
+               return ERROR_FAIL;
+       }
+
        struct jtag_command *cmd = cmd_queue_alloc(sizeof(struct jtag_command));
        struct scan_command *scan = cmd_queue_alloc(sizeof(struct 
scan_command));
        struct scan_field *out_fields = cmd_queue_alloc((in_num_fields + 
bypass_devices) * sizeof(struct scan_field));

-- 

Reply via email to