aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSpencer Oliver <spen@spen-soft.co.uk>2013-06-28 23:32:59 +0100
committerSpencer Oliver <spen@spen-soft.co.uk>2013-07-15 16:03:31 +0000
commit8faa419fad72592970911b7973c61a88e785bcc0 (patch)
tree075b67401781e2a94a53556af475278cb1fbef91
parentab90b8777855876f23c779ee2b25827a34f890c3 (diff)
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 <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/1466 Tested-by: jenkins
-rw-r--r--src/target/target.c7
1 files 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)