Stop GDB when polling fails, srst assert or powerdropout is detected
[openocd.git] / src / target / armv4_5.c
index 9f9aa2f5f037111893763cb29f47f6d8c48f0367..eedbc702d6750792f7cb252e900252ee1524238a 100644 (file)
@@ -532,7 +532,10 @@ static int armv4_5_run_algorithm_completion(struct target_s *target, uint32_t ex
                }
                return ERROR_TARGET_TIMEOUT;
        }
-       if (buf_get_u32(armv4_5->core_cache->reg_list[15].value, 0, 32) != exit_point)
+
+       /* fast exit: ARMv5+ code can use BKPT */
+       if (exit_point && buf_get_u32(armv4_5->core_cache->reg_list[15].value,
+                               0, 32) != exit_point)
        {
                LOG_WARNING("target reentered debug state, but not at the desired exit point: 0x%4.4" PRIx32 "",
                        buf_get_u32(armv4_5->core_cache->reg_list[15].value, 0, 32));
@@ -570,6 +573,13 @@ int armv4_5_run_algorithm_inner(struct target_s *target, int num_mem_params, mem
        if (armv4_5_mode_to_number(armv4_5->core_mode)==-1)
                return ERROR_FAIL;
 
+       /* armv5 and later can terminate with BKPT instruction; less overhead */
+       if (!exit_point && armv4_5->is_armv4)
+       {
+               LOG_ERROR("ARMv4 target needs HW breakpoint location");
+               return ERROR_FAIL;
+       }
+
        for (i = 0; i <= 16; i++)
        {
                if (!ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, armv4_5_algorithm_info->core_mode, i).valid)
@@ -626,9 +636,11 @@ int armv4_5_run_algorithm_inner(struct target_s *target, int num_mem_params, mem
                armv4_5->core_cache->reg_list[ARMV4_5_CPSR].valid = 1;
        }
 
-       if ((retval = breakpoint_add(target, exit_point, exit_breakpoint_size, BKPT_HARD)) != ERROR_OK)
+       /* terminate using a hardware or (ARMv5+) software breakpoint */
+       if (exit_point && (retval = breakpoint_add(target, exit_point,
+                               exit_breakpoint_size, BKPT_HARD)) != ERROR_OK)
        {
-               LOG_ERROR("can't add breakpoint to finish algorithm execution");
+               LOG_ERROR("can't add HW breakpoint to terminate algorithm");
                return ERROR_TARGET_FAILURE;
        }
 
@@ -639,7 +651,8 @@ int armv4_5_run_algorithm_inner(struct target_s *target, int num_mem_params, mem
        int retvaltemp;
        retval = run_it(target, exit_point, timeout_ms, arch_info);
 
-       breakpoint_remove(target, exit_point);
+       if (exit_point)
+               breakpoint_remove(target, exit_point);
 
        if (retval != ERROR_OK)
                return retval;

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)