Improve jtag_validate_ircapture() diagnostics.
[openocd.git] / src / jtag / core.c
index 128504046cbd2672895ddb6c045a9bbb258f3cbf..07eec64f46528ed31b0d58662ac9bcc4f5702db8 100644 (file)
@@ -1068,6 +1068,7 @@ static int jtag_validate_ircapture(void)
        int total_ir_length = 0;
        uint8_t *ir_test = NULL;
        scan_field_t field;
+       int val;
        int chain_pos = 0;
        int retval;
 
@@ -1100,7 +1101,7 @@ static int jtag_validate_ircapture(void)
 
        tap = NULL;
        chain_pos = 0;
-       int val;
+
        for (;;) {
                tap = jtag_tap_next_enabled(tap);
                if (tap == NULL) {
@@ -1111,17 +1112,18 @@ static int jtag_validate_ircapture(void)
                 * REVISIT we might be able to verify some MSBs too, using
                 * ircapture/irmask attributes.
                 */
-               val = buf_get_u32(ir_test, chain_pos, 2);
-               if (val != 1) {
-                       char *cbuf = buf_to_str(ir_test, total_ir_length, 16);
-
-                       LOG_ERROR("%s: IR capture error; saw 0x%s not 0x..1",
-                                       jtag_tap_name(tap), cbuf);
+               val = buf_get_u32(ir_test, chain_pos, tap->ir_length);
+               if ((val & 0x3) != 1) {
+                       LOG_ERROR("%s: IR capture error; saw 0x%0*x not 0x..1",
+                                       jtag_tap_name(tap),
+                                       (tap->ir_length + 7) / tap->ir_length,
+                                       val);
 
-                       free(cbuf);
                        retval = ERROR_JTAG_INIT_FAILED;
                        goto done;
                }
+               LOG_DEBUG("%s: IR capture 0x%0*x", jtag_tap_name(tap),
+                               (tap->ir_length + 7) / tap->ir_length, val);
                chain_pos += tap->ir_length;
        }
 

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)