- Improves error handling upon GDB connect

- switch to synchronous halt during connect. This fixes the bug
  where poll() was not invoked between halt() and servicing the
  'g' register packet
- halt() no longer returns error code when target is already halted, just
  logs a warning. Only the halt() implementation can say anything
  meaningful about why a halt() failed, so error messages are pushed
  up to halt()
- fixed soft_reset_halt infinite loop bug in arm7_9_common.c. The rest
  of the implementations are still busted.
- by using USER() instead of command_print() the log gets the 
  source + line #. Nice.
- no longer invoke exit() if soft_reset_halt fails. A reset can often 
  fix the problem.

git-svn-id: svn://svn.berlios.de/openocd/trunk@475 b42882b7-edfa-0310-969c-e2dbd0fdcd60
This commit is contained in:
oharboe
2008-03-07 21:49:16 +00:00
parent 29fc9b2596
commit c78b4fe426
12 changed files with 41 additions and 43 deletions

View File

@@ -359,7 +359,7 @@ int target_process_reset(struct command_context_s *cmd_ctx)
{
if ((now.tv_sec > timeout.tv_sec) || ((now.tv_sec == timeout.tv_sec) && (now.tv_usec >= timeout.tv_usec)))
{
command_print(cmd_ctx, "Timed out waiting for reset");
USER("Timed out waiting for reset");
goto done;
}
/* this will send alive messages on e.g. GDB remote protocol. */
@@ -1614,22 +1614,10 @@ int handle_daemon_startup_command(struct command_context_s *cmd_ctx, char *cmd,
int handle_soft_reset_halt_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
target_t *target = get_current_target(cmd_ctx);
int retval;
command_print(cmd_ctx, "requesting target halt and executing a soft reset");
USER("requesting target halt and executing a soft reset");
if ((retval = target->type->soft_reset_halt(target)) != ERROR_OK)
{
switch (retval)
{
case ERROR_TARGET_TIMEOUT:
command_print(cmd_ctx, "target timed out... shutting down");
exit(-1);
default:
command_print(cmd_ctx, "unknown error... shutting down");
exit(-1);
}
}
target->type->soft_reset_halt(target);
return ERROR_OK;
}