From 8faa419fad72592970911b7973c61a88e785bcc0 Mon Sep 17 00:00:00 2001 From: Spencer Oliver Date: Fri, 28 Jun 2013 23:32:59 +0100 Subject: [PATCH] target: use consistent halt timeout On slow targets we sometimes get false messages about timeouts due to poll using 1sec rather than the default 5sec timeout. Change-Id: Icc81c78e0ca86cebf9eeb2f5307cf7a82f1f4ee8 Signed-off-by: Spencer Oliver Reviewed-on: http://openocd.zylin.com/1466 Tested-by: jenkins --- src/target/target.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/target/target.c b/src/target/target.c index a5c7b30a..60a8a773 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -56,6 +56,9 @@ #include "image.h" #include "rtos/rtos.h" +/* default halt wait timeout (ms) */ +#define DEFAULT_HALT_TIMEOUT 5000 + static int target_read_buffer_default(struct target *target, uint32_t address, uint32_t size, uint8_t *buffer); static int target_write_buffer_default(struct target *target, uint32_t address, @@ -456,7 +459,7 @@ int target_poll(struct target *target) target->halt_issued = false; else { long long t = timeval_ms() - target->halt_issued_time; - if (t > 1000) { + if (t > DEFAULT_HALT_TIMEOUT) { target->halt_issued = false; LOG_INFO("Halt timed out, wake up GDB."); target_call_event_callbacks(target, TARGET_EVENT_GDB_HALT); @@ -2409,7 +2412,7 @@ COMMAND_HANDLER(handle_wait_halt_command) if (CMD_ARGC > 1) return ERROR_COMMAND_SYNTAX_ERROR; - unsigned ms = 5000; + unsigned ms = DEFAULT_HALT_TIMEOUT; if (1 == CMD_ARGC) { int retval = parse_uint(CMD_ARGV[0], &ms); if (ERROR_OK != retval) -- 2.39.5