target: use unsigned int for timeout_ms
[openocd.git] / src / target / armv7m.c
index 93df5877eb21de6ed0f7b7ff6625df0f7c55eb0a..8c9ff902e5be8b2542518f135055794346281505 100644 (file)
@@ -97,7 +97,7 @@ static const struct {
        { ARMV7M_R13, "sp", 32, REG_TYPE_DATA_PTR, "general", "org.gnu.gdb.arm.m-profile" },
        { ARMV7M_R14, "lr", 32, REG_TYPE_INT, "general", "org.gnu.gdb.arm.m-profile" },
        { ARMV7M_PC, "pc", 32, REG_TYPE_CODE_PTR, "general", "org.gnu.gdb.arm.m-profile" },
-       { ARMV7M_XPSR, "xPSR", 32, REG_TYPE_INT, "general", "org.gnu.gdb.arm.m-profile" },
+       { ARMV7M_XPSR, "xpsr", 32, REG_TYPE_INT, "general", "org.gnu.gdb.arm.m-profile" },
 
        { ARMV7M_MSP, "msp", 32, REG_TYPE_DATA_PTR, "system", "org.gnu.gdb.arm.m-system" },
        { ARMV7M_PSP, "psp", 32, REG_TYPE_DATA_PTR, "system", "org.gnu.gdb.arm.m-system" },
@@ -182,8 +182,11 @@ int armv7m_restore_context(struct target *target)
        for (i = cache->num_regs - 1; i >= 0; i--) {
                struct reg *r = &cache->reg_list[i];
 
-               if (r->exist && r->dirty)
-                       armv7m->arm.write_core_reg(target, r, i, ARM_MODE_ANY, r->value);
+               if (r->exist && r->dirty) {
+                       int retval = armv7m->arm.write_core_reg(target, r, i, ARM_MODE_ANY, r->value);
+                       if (retval != ERROR_OK)
+                               return retval;
+               }
        }
 
        return ERROR_OK;
@@ -481,7 +484,7 @@ int armv7m_run_algorithm(struct target *target,
        int num_mem_params, struct mem_param *mem_params,
        int num_reg_params, struct reg_param *reg_params,
        target_addr_t entry_point, target_addr_t exit_point,
-       int timeout_ms, void *arch_info)
+       unsigned int timeout_ms, void *arch_info)
 {
        int retval;
 
@@ -619,7 +622,7 @@ int armv7m_start_algorithm(struct target *target,
 int armv7m_wait_algorithm(struct target *target,
        int num_mem_params, struct mem_param *mem_params,
        int num_reg_params, struct reg_param *reg_params,
-       target_addr_t exit_point, int timeout_ms,
+       target_addr_t exit_point, unsigned int timeout_ms,
        void *arch_info)
 {
        struct armv7m_common *armv7m = target_to_armv7m(target);
@@ -906,7 +909,7 @@ int armv7m_checksum_memory(struct target *target,
        buf_set_u32(reg_params[0].value, 0, 32, address);
        buf_set_u32(reg_params[1].value, 0, 32, count);
 
-       int timeout = 20000 * (1 + (count / (1024 * 1024)));
+       unsigned int timeout = 20000 * (1 + (count / (1024 * 1024)));
 
        retval = target_run_algorithm(target, 0, NULL, 2, reg_params, crc_algorithm->address,
                        crc_algorithm->address + (sizeof(cortex_m_crc_code) - 6),
@@ -1013,7 +1016,7 @@ int armv7m_blank_check_memory(struct target *target,
        buf_set_u32(reg_params[1].value, 0, 32, erased_word);
 
        /* assume CPU clk at least 1 MHz */
-       int timeout = (timed_out ? 30000 : 2000) + total_size * 3 / 1000;
+       unsigned int timeout = (timed_out ? 30000 : 2000) + total_size * 3 / 1000;
 
        retval = target_run_algorithm(target,
                                0, NULL,

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)