This is an automated email from Gerrit.

Samuel Obuch ([email protected]) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/5800

-- gerrit

commit 93c6e1c90c64ff182adde6731e8a77a805854a89
Author: Samuel Obuch <[email protected]>
Date:   Tue Aug 11 17:37:01 2020 +0200

    Fix debug when loading to flash
    
    While loading to flash with debug level at least 3,
    OpenOCD gets stuck seemingly forever.
    
    * fix condition on selected debug level in jtag/core.c
    * speed up buf_to_str function from helper/binarybuffer.c
    
    Change-Id: I3dc01d5846941ca80736f2ed12e3a54114d2b6dd
    Signed-off-by: Samuel Obuch <[email protected]>

diff --git a/src/helper/binarybuffer.c b/src/helper/binarybuffer.c
index 76f657f..a9da4a6 100644
--- a/src/helper/binarybuffer.c
+++ b/src/helper/binarybuffer.c
@@ -221,16 +221,26 @@ char *buf_to_str(const void *_buf, unsigned buf_len, 
unsigned radix)
 
        const uint8_t *buf = _buf;
        int b256_len = DIV_ROUND_UP(buf_len, 8);
-       for (int i = b256_len - 1; i >= 0; i--) {
-               uint32_t tmp = buf[i];
-               if (((unsigned)i == (buf_len / 8)) && (buf_len % 8))
-                       tmp &= (0xff >> (8 - (buf_len % 8)));
-
-               /* base-256 digits */
-               for (unsigned j = str_len; j > 0; j--) {
-                       tmp += (uint32_t)str[j-1] * 256;
-                       str[j-1] = (uint8_t)(tmp % radix);
-                       tmp /= radix;
+       if (radix == 16) {
+               for (int i = 0; i < b256_len; i++) {
+                       uint8_t tmp = buf[b256_len - i - 1];
+                       if ((i == 0) && (buf_len % 8))
+                               tmp &= (0xff >> (8 - (buf_len % 8)));
+                       str[2 * i] = tmp >> 4;
+                       str[2 * i + 1] = tmp & 0xf;
+               }
+       } else {
+               for (int i = b256_len - 1; i >= 0; i--) {
+                       uint32_t tmp = buf[i];
+                       if (((unsigned)i == (buf_len / 8)) && (buf_len % 8))
+                               tmp &= (0xff >> (8 - (buf_len % 8)));
+
+                       /* base-256 digits */
+                       for (unsigned j = str_len; j > 0; j--) {
+                               tmp += (uint32_t)str[j-1] * 256;
+                               str[j-1] = (uint8_t)(tmp % radix);
+                               tmp /= radix;
+                       }
                }
        }
 
diff --git a/src/jtag/core.c b/src/jtag/core.c
index 1d424b2..f9d886c 100644
--- a/src/jtag/core.c
+++ b/src/jtag/core.c
@@ -960,7 +960,7 @@ int default_interface_jtag_execute_queue(void)
         * jtag/Makefile.am if MINIDRIVER_DUMMY || !MINIDRIVER, but those 
variables
         * aren't accessible here. */
        struct jtag_command *cmd = jtag_command_queue;
-       while (debug_level >= LOG_LVL_DEBUG && cmd) {
+       while (debug_level >= LOG_LVL_DEBUG_IO && cmd) {
                switch (cmd->type) {
                        case JTAG_SCAN:
                                LOG_DEBUG_IO("JTAG %s SCAN to %s",

-- 


_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to