summaryrefslogtreecommitdiff
path: root/src/target
diff options
context:
space:
mode:
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-07-18 10:20:10 +0000
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-07-18 10:20:10 +0000
commit94e75e0c06c4d683b33a03aee17b80c8a59bbd47 (patch)
tree0119048c905e9fa2d382ac62f69223b2de376092 /src/target
parent7648d6b28793e8eb436a56682915185cb819ff5e (diff)
downloadopenocd_libswd-94e75e0c06c4d683b33a03aee17b80c8a59bbd47.tar.gz
openocd_libswd-94e75e0c06c4d683b33a03aee17b80c8a59bbd47.tar.bz2
openocd_libswd-94e75e0c06c4d683b33a03aee17b80c8a59bbd47.tar.xz
openocd_libswd-94e75e0c06c4d683b33a03aee17b80c8a59bbd47.zip
1. GDB will print cryptic error messages if it is not fed keep-alive packets
within the last 2000ms. To fix this, add keep_alive() if you are spending >1000ms in an algorithm thus holding up the server loop. target_call_timer_callbacks() invokes keep_alive(). 2. post_reset script is now executed at normal JTAG speed and not reset speed. 3. Resume is now synchronous again. Hopefully it will work this time. git-svn-id: svn://svn.berlios.de/openocd/trunk@826 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/target')
-rw-r--r--src/target/target.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/target/target.c b/src/target/target.c
index 589f626f..ea130ce3 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -266,6 +266,9 @@ int target_halt(struct target_s *target)
int target_resume(struct target_s *target, int current, u32 address, int handle_breakpoints, int debug_execution)
{
int retval;
+ int timeout_ms = 5000;
+
+ enum target_state resume_state = debug_execution ? TARGET_DEBUG_RUNNING : TARGET_RUNNING;
/* We can't poll until after examine */
if (!target->type->examined)
@@ -277,6 +280,21 @@ int target_resume(struct target_s *target, int current, u32 address, int handle_
if ((retval = target->type->resume(target, current, address, handle_breakpoints, debug_execution)) != ERROR_OK)
return retval;
+ /* wait for target to exit halted mode */
+ target_poll(target);
+
+ while (target->state != resume_state)
+ {
+ target_call_timer_callbacks();
+ usleep(10000);
+ target_poll(target);
+ if ((timeout_ms -= 10) <= 0)
+ {
+ LOG_ERROR("timeout waiting for target resume");
+ return ERROR_TARGET_TIMEOUT;
+ }
+ }
+
return retval;
}
@@ -407,6 +425,11 @@ int target_process_reset(struct command_context_s *cmd_ctx)
return retval;
}
+ /* post reset scripts can be quite long, increase speed now. If post
+ * reset scripts needs a different speed, they can set the speed to
+ * whatever they need.
+ */
+ jtag->speed(jtag_speed_post_reset);
LOG_DEBUG("Waiting for halted stated as approperiate");
@@ -464,7 +487,6 @@ int target_process_reset(struct command_context_s *cmd_ctx)
}
target_unregister_event_callback(target_init_handler, cmd_ctx);
- jtag->speed(jtag_speed_post_reset);
return retval;
}
@@ -738,6 +760,8 @@ static int target_call_timer_callbacks_check_time(int checktime)
target_timer_callback_t *next_callback;
struct timeval now;
+ keep_alive();
+
gettimeofday(&now, NULL);
while (callback)