target: Clean up format strings
[openocd.git] / src / target / target.c
index 0dbce9aecdc27cd5e6a4709ac46ace8abc5e7490..e3c81689d85271c4fdd3b2cbf23948bf3a7432fc 100644 (file)
@@ -1014,6 +1014,15 @@ int target_run_flash_async_algorithm(struct target *target,
                retval = retval2;
        }
 
+       if (retval == ERROR_OK) {
+               /* check if algorithm set rp = 0 after fifo writer loop finished */
+               retval = target_read_u32(target, rp_addr, &rp);
+               if (retval == ERROR_OK && rp == 0) {
+                       LOG_ERROR("flash write algorithm aborted by target");
+                       retval = ERROR_FLASH_OPERATION_FAILED;
+               }
+       }
+
        return retval;
 }
 
@@ -2013,8 +2022,8 @@ static int target_profiling_default(struct target *target, uint32_t *samples,
  */
 int target_write_buffer(struct target *target, uint32_t address, uint32_t size, const uint8_t *buffer)
 {
-       LOG_DEBUG("writing buffer of %i byte at 0x%8.8x",
-                       (int)size, (unsigned)address);
+       LOG_DEBUG("writing buffer of %" PRIi32 " byte at 0x%8.8" PRIx32,
+                         size, address);
 
        if (!target_was_examined(target)) {
                LOG_ERROR("Target not examined yet");
@@ -2025,10 +2034,10 @@ int target_write_buffer(struct target *target, uint32_t address, uint32_t size,
                return ERROR_OK;
 
        if ((address + size - 1) < address) {
-               /* GDB can request this when e.g. PC is 0xfffffffc*/
-               LOG_ERROR("address + size wrapped(0x%08x, 0x%08x)",
-                                 (unsigned)address,
-                                 (unsigned)size);
+               /* GDB can request this when e.g. PC is 0xfffffffc */
+               LOG_ERROR("address + size wrapped (0x%08" PRIx32 ", 0x%08" PRIx32 ")",
+                                 address,
+                                 size);
                return ERROR_FAIL;
        }
 
@@ -2074,8 +2083,8 @@ static int target_write_buffer_default(struct target *target, uint32_t address,
  */
 int target_read_buffer(struct target *target, uint32_t address, uint32_t size, uint8_t *buffer)
 {
-       LOG_DEBUG("reading buffer of %i byte at 0x%8.8x",
-                         (int)size, (unsigned)address);
+       LOG_DEBUG("reading buffer of %" PRIi32 " byte at 0x%8.8" PRIx32,
+                         size, address);
 
        if (!target_was_examined(target)) {
                LOG_ERROR("Target not examined yet");
@@ -2086,8 +2095,8 @@ int target_read_buffer(struct target *target, uint32_t address, uint32_t size, u
                return ERROR_OK;
 
        if ((address + size - 1) < address) {
-               /* GDB can request this when e.g. PC is 0xfffffffc*/
-               LOG_ERROR("address + size wrapped(0x%08" PRIx32 ", 0x%08" PRIx32 ")",
+               /* GDB can request this when e.g. PC is 0xfffffffc */
+               LOG_ERROR("address + size wrapped (0x%08" PRIx32 ", 0x%08" PRIx32 ")",
                                  address,
                                  size);
                return ERROR_FAIL;
@@ -2144,7 +2153,7 @@ int target_checksum_memory(struct target *target, uint32_t address, uint32_t siz
        if (retval != ERROR_OK) {
                buffer = malloc(size);
                if (buffer == NULL) {
-                       LOG_ERROR("error allocating buffer for section (%d bytes)", (int)size);
+                       LOG_ERROR("error allocating buffer for section (%" PRId32 " bytes)", size);
                        return ERROR_COMMAND_SYNTAX_ERROR;
                }
                retval = target_read_buffer(target, address, size, buffer);
@@ -2245,7 +2254,7 @@ int target_read_u16(struct target *target, uint32_t address, uint16_t *value)
 
        if (retval == ERROR_OK) {
                *value = target_buffer_get_u16(target, value_buf);
-               LOG_DEBUG("address: 0x%8.8" PRIx32 ", value: 0x%4.4x",
+               LOG_DEBUG("address: 0x%8.8" PRIx32 ", value: 0x%4.4" PRIx16,
                                  address,
                                  *value);
        } else {
@@ -2267,7 +2276,7 @@ int target_read_u8(struct target *target, uint32_t address, uint8_t *value)
        int retval = target_read_memory(target, address, 1, 1, value);
 
        if (retval == ERROR_OK) {
-               LOG_DEBUG("address: 0x%8.8" PRIx32 ", value: 0x%2.2x",
+               LOG_DEBUG("address: 0x%8.8" PRIx32 ", value: 0x%2.2" PRIx8,
                                  address,
                                  *value);
        } else {
@@ -2330,7 +2339,7 @@ int target_write_u16(struct target *target, uint32_t address, uint16_t value)
                return ERROR_FAIL;
        }
 
-       LOG_DEBUG("address: 0x%8.8" PRIx32 ", value: 0x%8.8x",
+       LOG_DEBUG("address: 0x%8.8" PRIx32 ", value: 0x%8.8" PRIx16,
                          address,
                          value);
 
@@ -2350,7 +2359,7 @@ int target_write_u8(struct target *target, uint32_t address, uint8_t value)
                return ERROR_FAIL;
        }
 
-       LOG_DEBUG("address: 0x%8.8" PRIx32 ", value: 0x%2.2x",
+       LOG_DEBUG("address: 0x%8.8" PRIx32 ", value: 0x%2.2" PRIx8,
                          address, value);
 
        retval = target_write_memory(target, address, 1, 1, &value);
@@ -3993,7 +4002,7 @@ static int target_mem2array(Jim_Interp *interp, struct target *target, int argc,
                sprintf(buf, "mem2array address: 0x%08" PRIx32 " is not aligned for %" PRId32 " byte reads",
                                addr,
                                width);
-               Jim_AppendStrings(interp, Jim_GetResult(interp), buf , NULL);
+               Jim_AppendStrings(interp, Jim_GetResult(interp), buf, NULL);
                return JIM_ERR;
        }
 
@@ -4022,10 +4031,10 @@ static int target_mem2array(Jim_Interp *interp, struct target *target, int argc,
                        retval = target_read_memory(target, addr, width, count, buffer);
                if (retval != ERROR_OK) {
                        /* BOO !*/
-                       LOG_ERROR("mem2array: Read @ 0x%08x, w=%d, cnt=%d, failed",
-                                         (unsigned int)addr,
-                                         (int)width,
-                                         (int)count);
+                       LOG_ERROR("mem2array: Read @ 0x%08" PRIx32 ", w=%" PRId32 ", cnt=%" PRId32 ", failed",
+                                         addr,
+                                         width,
+                                         count);
                        Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
                        Jim_AppendStrings(interp, Jim_GetResult(interp), "mem2array: cannot read memory", NULL);
                        e = JIM_ERR;
@@ -4196,10 +4205,10 @@ static int target_array2mem(Jim_Interp *interp, struct target *target,
        } else {
                char buf[100];
                Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
-               sprintf(buf, "array2mem address: 0x%08x is not aligned for %d byte reads",
-                               (unsigned int)addr,
-                               (int)width);
-               Jim_AppendStrings(interp, Jim_GetResult(interp), buf , NULL);
+               sprintf(buf, "array2mem address: 0x%08" PRIx32 " is not aligned for %" PRId32 " byte reads",
+                               addr,
+                               width);
+               Jim_AppendStrings(interp, Jim_GetResult(interp), buf, NULL);
                return JIM_ERR;
        }
 
@@ -4245,10 +4254,10 @@ static int target_array2mem(Jim_Interp *interp, struct target *target,
                        retval = target_write_memory(target, addr, width, count, buffer);
                if (retval != ERROR_OK) {
                        /* BOO !*/
-                       LOG_ERROR("array2mem: Write @ 0x%08x, w=%d, cnt=%d, failed",
-                                         (unsigned int)addr,
-                                         (int)width,
-                                         (int)count);
+                       LOG_ERROR("array2mem: Write @ 0x%08" PRIx32 ", w=%" PRId32 ", cnt=%" PRId32 ", failed",
+                                         addr,
+                                         width,
+                                         count);
                        Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
                        Jim_AppendStrings(interp, Jim_GetResult(interp), "array2mem: cannot read memory", NULL);
                        e = JIM_ERR;

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)