my_checksum += character & 0xff;
buffer[count++] = character & 0xff;
}
+
}
*len = count;
* connect.
*/
target_halt(gdb_service->target);
+ /* FIX!!!! could extended-remote work better here?
+ *
+ * wait a tiny bit for halted state or we just continue. The
+ * GDB register packet will then contain garbage
+ */
+ target_wait_state(gdb_service->target, TARGET_HALTED, 500);
/* remove the initial ACK from the incoming buffer */
if ((retval = gdb_get_char(connection, &initial_ack)) != ERROR_OK)
return ERROR_OK;
}
-static int wait_state(struct command_context_s *cmd_ctx, char *cmd, enum target_state state, int ms);
int handle_poll_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
return ERROR_OK;
}
}
+ target_t *target = get_current_target(cmd_ctx);
- return wait_state(cmd_ctx, cmd, TARGET_HALTED, ms);
+ return target_wait_state(target, TARGET_HALTED, ms);
}
-static int wait_state(struct command_context_s *cmd_ctx, char *cmd, enum target_state state, int ms)
+int target_wait_state(target_t *target, enum target_state state, int ms)
{
int retval;
struct timeval timeout, now;
gettimeofday(&timeout, NULL);
timeval_add_time(&timeout, 0, ms * 1000);
- target_t *target = get_current_target(cmd_ctx);
for (;;)
{
if ((retval=target_poll(target))!=ERROR_OK)
if (once)
{
once=0;
- command_print(cmd_ctx, "waiting for target %s...", target_state_strings[state]);
+ LOG_USER("waiting for target %s...", target_state_strings[state]);
}
gettimeofday(&now, NULL);
extern int target_read_buffer(struct target_s *target, u32 address, u32 size, u8 *buffer);
extern int target_checksum_memory(struct target_s *target, u32 address, u32 size, u32* crc);
extern int target_blank_check_memory(struct target_s *target, u32 address, u32 size, u32* blank);
+extern int target_wait_state(target_t *target, enum target_state state, int ms);
/* DANGER!!!!!
*