-bin_PROGRAMS = openocd
+bin_PROGRAMS = openocd bin2char
+
+bin2char_SOURCES = bin2char.c
if ECOSBOARD
MAINFILE = ecosboard.c
MAINFILE = main.c jim.c
endif
-openocd_SOURCES = $(MAINFILE) openocd.c
+openocd_SOURCES = $(MAINFILE) openocd.c startup_tcl.c
# set the include path found by configure
INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/src/helper \
endif
endif
-openocd_LDADD = $(top_builddir)/src/startup.o $(top_builddir)/src/xsvf/libxsvf.a \
+openocd_LDADD = $(top_builddir)/src/xsvf/libxsvf.a \
$(top_builddir)/src/target/libtarget.a $(top_builddir)/src/jtag/libjtag.a \
$(top_builddir)/src/helper/libhelper.a \
$(top_builddir)/src/server/libserver.a $(top_builddir)/src/helper/libhelper.a \
tcl/mmr_helpers.tcl \
tcl/readable.tcl
-# Convert .tcl to object
-
-$(top_builddir)/src/startup.o: $(top_srcdir)/src/startup.tcl
- abs_builddir=`cd $(top_builddir) && pwd` && \
- cd $(top_srcdir)/src && \
- ${OBJCOPY} -I binary -O ${OBJCOPY_FORMAT} -B ${OBJCOPY_ARCH} startup.tcl $$abs_builddir/src/startup.o
+# Convert .tcl to cfile
+startup_tcl.c: bin2char startup.tcl
+ ./bin2char startup_tcl < $(srcdir)/startup.tcl > startup_tcl.c
--- /dev/null
+#include <stdio.h>\r
+#include <stdlib.h>\r
+\r
+int\r
+main(int argc, char **argv)\r
+{\r
+ int c;\r
+ unsigned int n;\r
+ char *name;\r
+\r
+ if (argc == 1) {\r
+ fprintf(stderr, "bin2char <varname>\n");\r
+ fprintf(stderr, "read from standard input and write a char"\r
+ " array out to standard output\n");\r
+ exit(1);\r
+ }\r
+\r
+ n = 0;\r
+ name = argv[1];\r
+ fprintf(stdout, "/* autogenerated from %s */\n", argv[0]);\r
+ fprintf(stdout, "unsigned const char %s[] = {\n", name);\r
+ while ((c = getc(stdin)) != EOF) {\r
+ fprintf(stdout, "0x%02x,", c & 0xff);\r
+ if ((++n % 16) == 0)\r
+ fprintf(stdout, "\n");\r
+ }\r
+ fprintf(stdout, "0 /* terminate with a nil */};\n");\r
+ fprintf(stdout, "unsigned int %s_len = %u;\n", name, n);\r
+ return 0;\r
+}\r
Jim_ListAppendElement(interp, helptext, cmd_entry);
}
-extern char binary_startup_tcl_start;
-extern char binary_startup_tcl_size;
+extern unsigned const char startup_tcl[];
+extern unsigned int startup_tcl_len;
void initJim(void)
{
add_default_dirs();
- script_len = (int)&binary_startup_tcl_size;
+ script_len = startup_tcl_len;
script = malloc(script_len + sizeof(char));
- memcpy(script, &binary_startup_tcl_start, script_len);
-
+ memcpy(script, startup_tcl, script_len);
+
/* null terminate */
script[script_len] = 0;