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>
AC_PROG_CC
AC_PROG_CC_C99
AM_PROG_CC_C_O
AC_PROG_CC
AC_PROG_CC_C99
AM_PROG_CC_C_O
AC_PROG_RANLIB
dnl disable checks for C++, Fortran and GNU Java Compiler
AC_PROG_RANLIB
dnl disable checks for C++, Fortran and GNU Java Compiler
-bin2char$(EXEEXT_FOR_BUILD): bin2char.c
+BIN2C = bin2char$(EXEEXT_FOR_BUILD)
+
+BUILT_SOURCES = $(BIN2C)
+
+$(BIN2C): bin2char.c
${CC_FOR_BUILD} ${CFLAGS_FOR_BUILD} $(srcdir)/bin2char.c -o $@
# Convert .tcl to cfile
${CC_FOR_BUILD} ${CFLAGS_FOR_BUILD} $(srcdir)/bin2char.c -o $@
# Convert .tcl to cfile
-startup_tcl.c: startup.tcl bin2char$(EXEEXT_FOR_BUILD)
- ./bin2char$(EXEEXT_FOR_BUILD) startup_tcl < $(srcdir)/startup.tcl > $@
+startup_tcl.c: startup.tcl $(BIN2C)
+ ./$(BIN2C) startup_tcl < $(srcdir)/startup.tcl > $@
# add startup_tcl.c to make clean list
CLEANFILES = startup_tcl.c bin2char$(EXEEXT_FOR_BUILD)
# add startup_tcl.c to make clean list
CLEANFILES = startup_tcl.c bin2char$(EXEEXT_FOR_BUILD)
-I$(top_srcdir)/src/jtag \
-I$(top_srcdir)/src/xsvf
-I$(top_srcdir)/src/jtag \
-I$(top_srcdir)/src/xsvf
-# ideally this would be specific to xscale_debug.S ...
-libtarget_la_CCASFLAGS = \
- -Wa,-I$(top_srcdir)/src/target \
- $(AM_CCASFLAGS)
+BIN2C = $(top_srcdir)/src/helper/bin2char$(EXEEXT_FOR_BUILD)
+xscale_debug.h: $(BIN2C) xscale/debug_handler.bin
+ $(BIN2C) < xscale/debug_handler.bin xscale_debug_handler > xscale_debug.h
METASOURCES = AUTO
noinst_LTLIBRARIES = libtarget.la
METASOURCES = AUTO
noinst_LTLIBRARIES = libtarget.la
feroceon.c \
etb.c \
xscale.c \
feroceon.c \
etb.c \
xscale.c \
arm_simulator.c \
image.c \
armv7m.c \
arm_simulator.c \
image.c \
armv7m.c \
+BUILT_SOURCES = \
+ xscale_debug.h
+
noinst_HEADERS = \
target.h \
target_type.h \
noinst_HEADERS = \
target.h \
target_type.h \
arm926ejs.h \
etb.h \
xscale.h \
arm926ejs.h \
etb.h \
xscale.h \
arm_simulator.h \
image.h \
armv7m.h \
arm_simulator.h \
image.h \
armv7m.h \
static int xscale_read_trace(target_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 */
static char *const xscale_reg_list[] =
{
"XSCALE_MAINID", /* 0 */
* force that, so writing new contents is reliable...
*/
address = xscale->handler_address;
* 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)
{
binary_size > 0;
binary_size -= buf_cnt, buffer += buf_cnt)
{
{
xscale_common_t *xscale;
{
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;
}
LOG_ERROR("debug_handler.bin: larger than 2kb");
return ERROR_FAIL;
}
#define ERROR_XSCALE_NO_TRACE_DATA (-1500)
#define ERROR_XSCALE_NO_TRACE_DATA (-1500)
-/* This XScale "debug handler" is loaded into the processor's
- * mini-ICache, which is 2K of code writable only via JTAG.
- */
-extern const uint8_t xscale_debug_handler[];
-extern const uint32_t xscale_debug_handler_size;
-
+++ /dev/null
- .section .rodata
-
- .align 4
- .global xscale_debug_handler
-xscale_debug_handler:
- .incbin "xscale/debug_handler.bin"
- .size xscale_debug_handler, . - xscale_debug_handler
-
- .align 4
- .global xscale_debug_handler_size
-xscale_debug_handler_size:
- .word . - xscale_debug_handler
- .size xscale_debug_handler_size, 4