uint32_t dscr;
+ int i = 0;
while (1)
{
CHECK_RETVAL(arm11_read_DSCR(arm11, &dscr));
if (dscr & ARM11_DSCR_CORE_HALTED)
break;
+
+
+ long long then = 0;
+ if (i == 1000)
+ {
+ then = timeval_ms();
+ }
+ if (i >= 1000)
+ {
+ if ((timeval_ms()-then) > 1000)
+ {
+ LOG_WARNING("Timeout (1000ms) waiting for instructions to complete");
+ return ERROR_FAIL;
+ }
+ }
+ i++;
}
arm11_on_enter_debug_state(arm11);
CHECK_RETVAL(jtag_execute_queue());
+ int i = 0;
while (1)
{
uint32_t dscr;
if (dscr & ARM11_DSCR_CORE_RESTARTED)
break;
+
+
+ long long then = 0;
+ if (i == 1000)
+ {
+ then = timeval_ms();
+ }
+ if (i >= 1000)
+ {
+ if ((timeval_ms()-then) > 1000)
+ {
+ LOG_WARNING("Timeout (1000ms) waiting for instructions to complete");
+ return ERROR_FAIL;
+ }
+ }
+ i++;
}
if (!debug_execution)
CHECK_RETVAL(jtag_execute_queue());
- /** \todo TODO: add a timeout */
-
/* wait for halt */
-
+ int i = 0;
while (1)
{
uint32_t dscr;
if ((dscr & (ARM11_DSCR_CORE_RESTARTED | ARM11_DSCR_CORE_HALTED)) ==
(ARM11_DSCR_CORE_RESTARTED | ARM11_DSCR_CORE_HALTED))
break;
+
+ long long then = 0;
+ if (i == 1000)
+ {
+ then = timeval_ms();
+ }
+ if (i >= 1000)
+ {
+ if ((timeval_ms()-then) > 1000)
+ {
+ LOG_WARNING("Timeout (1000ms) waiting for instructions to complete");
+ return ERROR_FAIL;
+ }
+ }
+ i++;
}
/* clear breakpoint */
0xFFFFFFFF, /* value */
};
-const char arm11_mrc_syntax[] = "Syntax: mrc <jtag_target> <coprocessor> <opcode 1> <CRn> <CRm> <opcode 2>. All parameters are numbers only.";
-const char arm11_mcr_syntax[] = "Syntax: mcr <jtag_target> <coprocessor> <opcode 1> <CRn> <CRm> <opcode 2> <32bit value to write>. All parameters are numbers only.";
-
arm11_common_t * arm11_find_target(const char * arg)
{
jtag_tap_t * tap;
{
if (argc != (read ? 6 : 7))
{
- LOG_ERROR("Invalid number of arguments. %s", read ? arm11_mrc_syntax : arm11_mcr_syntax);
- return -1;
+ LOG_ERROR("Invalid number of arguments.");
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
arm11_common_t * arm11 = arm11_find_target(args[0]);
if (!arm11)
{
- LOG_ERROR("Parameter 1 is not a the JTAG chain position of an ARM11 device. %s",
- read ? arm11_mrc_syntax : arm11_mcr_syntax);
-
- return -1;
+ LOG_ERROR("Parameter 1 is not a the JTAG chain position of an ARM11 device.");
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
if (arm11->target->state != TARGET_HALTED)
if (values[i] > arm11_coproc_instruction_limits[i])
{
- LOG_ERROR("Parameter %ld out of bounds (%" PRId32 " max). %s",
+ LOG_ERROR("Parameter %ld out of bounds (%" PRId32 " max).",
(long)(i + 2),
- arm11_coproc_instruction_limits[i],
- read ? arm11_mrc_syntax : arm11_mcr_syntax);
- return -1;
+ arm11_coproc_instruction_limits[i]);
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
}
register_command(cmd_ctx, top_cmd, "mcr",
arm11_handle_mcr, COMMAND_ANY,
- "Write Coprocessor register");
+ "Write Coprocessor register. mcr <jtag_target> <coprocessor> <opcode 1> <CRn> <CRm> <opcode 2> <32bit value to write>. All parameters are numbers only.");
mw_cmd = register_command(cmd_ctx, top_cmd, "memwrite",
NULL, COMMAND_ANY, NULL);
register_command(cmd_ctx, top_cmd, "mrc",
arm11_handle_mrc, COMMAND_ANY,
- "Read Coprocessor register");
+ "Read Coprocessor register. mrc <jtag_target> <coprocessor> <opcode 1> <CRn> <CRm> <opcode 2>. All parameters are numbers only.");
register_command(cmd_ctx, top_cmd, "no_increment",
arm11_handle_bool_memrw_no_increment, COMMAND_ANY,
"Don't increment address on multi-read/-write"