X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Ftarget%2Fxscale.c;h=ee9d88d6463f14b3aed92e74fe49ae6e4e13e8aa;hb=2a8aa3b7efb590cabd7ee930dbb68fd64e028099;hp=dd16b35e52d275d1e31eea890db375f1b86bb11b;hpb=b6c4d1006f66744f67cbd03005e438f8512012cd;p=openocd diff --git a/src/target/xscale.c b/src/target/xscale.c index dd16b35e..ee9d88d6 100644 --- a/src/target/xscale.c +++ b/src/target/xscale.c @@ -69,6 +69,17 @@ static int xscale_unset_breakpoint(struct target_s *, breakpoint_t *); static int xscale_read_trace(target_t *); +/* This XScale "debug handler" is loaded into the processor's + * mini-ICache, which is 2K of code writable only via JTAG. + * + * FIXME the OpenOCD "bin2char" utility currently doesn't handle + * binary files cleanly. It's string oriented, and terminates them + * with a NUL character. Better would be to generate the constants + * and let other code decide names, scoping, and other housekeeping. + */ +static /* unsigned const char xscale_debug_handler[] = ... */ +#include "xscale_debug.h" + static char *const xscale_reg_list[] = { "XSCALE_MAINID", /* 0 */ @@ -879,8 +890,6 @@ static int xscale_arch_state(struct target_s *target) static int xscale_poll(target_t *target) { int retval = ERROR_OK; - armv4_5_common_t *armv4_5 = target->arch_info; - xscale_common_t *xscale = armv4_5->arch_info; if ((target->state == TARGET_RUNNING) || (target->state == TARGET_DEBUG_RUNNING)) { @@ -889,8 +898,6 @@ static int xscale_poll(target_t *target) { /* there's data to read from the tx register, we entered debug state */ - xscale->handler_running = 1; - target->state = TARGET_HALTED; /* process debug entry, fetching current mode regs */ @@ -1354,8 +1361,6 @@ static int xscale_resume(struct target_s *target, int current, LOG_DEBUG("target resumed"); - xscale->handler_running = 1; - return ERROR_OK; } @@ -1563,7 +1568,17 @@ static int xscale_deassert_reset(target_t *target) breakpoint = breakpoint->next; } - if (!xscale->handler_installed) + armv4_5_invalidate_core_regs(target); + + /* FIXME mark hardware watchpoints got unset too. Also, + * at least some of the XScale registers are invalid... + */ + + /* + * REVISIT: *assumes* we had a SRST+TRST reset so the mini-icache + * contents got invalidated. Safer to force that, so writing new + * contents can't ever fail.. + */ { uint32_t address; unsigned buf_cnt; @@ -1588,13 +1603,9 @@ static int xscale_deassert_reset(target_t *target) * it's using halt mode (not monitor mode), it runs in * "Special Debug State" for access to registers, memory, * coprocessors, trace data, etc. - * - * REVISIT: *assumes* we've had a SRST+TRST reset so the - * mini-icache contents have been invalidated. Safest to - * force that, so writing new contents is reliable... */ address = xscale->handler_address; - for (unsigned binary_size = xscale_debug_handler_size; + for (unsigned binary_size = sizeof xscale_debug_handler - 1; binary_size > 0; binary_size -= buf_cnt, buffer += buf_cnt) { @@ -1662,10 +1673,6 @@ static int xscale_deassert_reset(target_t *target) xscale_resume(target, 1, 0x0, 1, 0); } } - else - { - jtag_add_reset(0, 0); - } return ERROR_OK; } @@ -2956,8 +2963,6 @@ static int xscale_init_arch_info(target_t *target, } /* the debug handler isn't installed (and thus not running) at this time */ - xscale->handler_installed = 0; - xscale->handler_running = 0; xscale->handler_address = 0xfe000800; /* clear the vectors we keep locally for reference */ @@ -3030,7 +3035,7 @@ static int xscale_target_create(struct target_s *target, Jim_Interp *interp) { xscale_common_t *xscale; - if (xscale_debug_handler_size > 0x800) { + if (sizeof xscale_debug_handler - 1 > 0x800) { LOG_ERROR("debug_handler.bin: larger than 2kb"); return ERROR_FAIL; }