diff options
author | David Brownell <dbrownell@users.sourceforge.net> | 2009-10-16 13:52:40 -0700 |
---|---|---|
committer | David Brownell <dbrownell@users.sourceforge.net> | 2009-10-16 13:52:40 -0700 |
commit | cb7965da154793430d935f4965d7360198b711ba (patch) | |
tree | 1ca65b04f77e65884b82b80cc490552a347ee31e /src/target/xscale.c | |
parent | a61b57a87fec48a41c7429715c477077b545d698 (diff) |
xscale: better fix for debug_handler.bin
Generate a C struct with the data, and use that, instead of an
assembly language file. The assembly language causes issues on
Darwin and MS-Windows, which don't necessarily use GNU AS; or
if they do, don't necessarily use its ELF syntax.
It's also better in two other ways: fewer global symbols; and
the init-time size check gets optimized away at compile time.
(Unless it fails, in which case bigger chunks of the file vanish.)
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Diffstat (limited to 'src/target/xscale.c')
-rw-r--r-- | src/target/xscale.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/target/xscale.c b/src/target/xscale.c index dd16b35e..640eb01b 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 */ @@ -1594,7 +1605,7 @@ static int xscale_deassert_reset(target_t *target) * 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) { @@ -3030,7 +3041,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; } |