Commit 766b0ca8 authored by oharboe's avatar oharboe
Browse files

Charles Hardin <ckhardin@gmail.com> - hopefully final word on startup.tcl => c conversion

git-svn-id: svn://svn.berlios.de/openocd/trunk@803 b42882b7-edfa-0310-969c-e2dbd0fdcd60
parent 69565278
bin_PROGRAMS = openocd bin_PROGRAMS = openocd bin2char
bin2char_SOURCES = bin2char.c
if ECOSBOARD if ECOSBOARD
MAINFILE = ecosboard.c MAINFILE = ecosboard.c
...@@ -6,7 +8,7 @@ else ...@@ -6,7 +8,7 @@ else
MAINFILE = main.c jim.c MAINFILE = main.c jim.c
endif endif
openocd_SOURCES = $(MAINFILE) openocd.c openocd_SOURCES = $(MAINFILE) openocd.c startup_tcl.c
# set the include path found by configure # set the include path found by configure
INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/src/helper \ INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/src/helper \
...@@ -70,7 +72,7 @@ FTD2XXLIB = ...@@ -70,7 +72,7 @@ FTD2XXLIB =
endif endif
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/target/libtarget.a $(top_builddir)/src/jtag/libjtag.a \
$(top_builddir)/src/helper/libhelper.a \ $(top_builddir)/src/helper/libhelper.a \
$(top_builddir)/src/server/libserver.a $(top_builddir)/src/helper/libhelper.a \ $(top_builddir)/src/server/libserver.a $(top_builddir)/src/helper/libhelper.a \
...@@ -94,9 +96,6 @@ nobase_dist_pkglib_DATA = \ ...@@ -94,9 +96,6 @@ nobase_dist_pkglib_DATA = \
tcl/mmr_helpers.tcl \ tcl/mmr_helpers.tcl \
tcl/readable.tcl tcl/readable.tcl
# Convert .tcl to object # Convert .tcl to cfile
startup_tcl.c: bin2char startup.tcl
$(top_builddir)/src/startup.o: $(top_srcdir)/src/startup.tcl ./bin2char startup_tcl < $(srcdir)/startup.tcl > startup_tcl.c
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
#include <stdio.h>
#include <stdlib.h>
int
main(int argc, char **argv)
{
int c;
unsigned int n;
char *name;
if (argc == 1) {
fprintf(stderr, "bin2char <varname>\n");
fprintf(stderr, "read from standard input and write a char"
" array out to standard output\n");
exit(1);
}
n = 0;
name = argv[1];
fprintf(stdout, "/* autogenerated from %s */\n", argv[0]);
fprintf(stdout, "unsigned const char %s[] = {\n", name);
while ((c = getc(stdin)) != EOF) {
fprintf(stdout, "0x%02x,", c & 0xff);
if ((++n % 16) == 0)
fprintf(stdout, "\n");
}
fprintf(stdout, "0 /* terminate with a nil */};\n");
fprintf(stdout, "unsigned int %s_len = %u;\n", name, n);
return 0;
}
...@@ -714,8 +714,8 @@ void add_jim(const char *name, int (*cmd)(Jim_Interp *interp, int argc, Jim_Obj ...@@ -714,8 +714,8 @@ void add_jim(const char *name, int (*cmd)(Jim_Interp *interp, int argc, Jim_Obj
Jim_ListAppendElement(interp, helptext, cmd_entry); Jim_ListAppendElement(interp, helptext, cmd_entry);
} }
extern char binary_startup_tcl_start; extern unsigned const char startup_tcl[];
extern char binary_startup_tcl_size; extern unsigned int startup_tcl_len;
void initJim(void) void initJim(void)
{ {
...@@ -741,10 +741,10 @@ void initJim(void) ...@@ -741,10 +741,10 @@ void initJim(void)
add_default_dirs(); add_default_dirs();
script_len = (int)&binary_startup_tcl_size; script_len = startup_tcl_len;
script = malloc(script_len + sizeof(char)); script = malloc(script_len + sizeof(char));
memcpy(script, &binary_startup_tcl_start, script_len); memcpy(script, startup_tcl, script_len);
/* null terminate */ /* null terminate */
script[script_len] = 0; script[script_len] = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment