Charles Hardin <ckhardin@gmail.com> - hopefully final word on startup.tcl => c conversion
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Sun, 13 Jul 2008 17:31:40 +0000 (17:31 +0000)
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Sun, 13 Jul 2008 17:31:40 +0000 (17:31 +0000)
git-svn-id: svn://svn.berlios.de/openocd/trunk@803 b42882b7-edfa-0310-969c-e2dbd0fdcd60

src/Makefile.am
src/bin2char.c [new file with mode: 0644]
src/openocd.c

index 502a63d50c28cdfeb1ad44ddec748d5d692febec..0cb13ab6fb1127ed2b3ed97b54221fd14373e25c 100644 (file)
@@ -1,4 +1,6 @@
-bin_PROGRAMS = openocd
+bin_PROGRAMS = openocd bin2char
+
+bin2char_SOURCES = bin2char.c
 
 if ECOSBOARD
 MAINFILE = ecosboard.c
@@ -6,7 +8,7 @@ else
 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 \
@@ -70,7 +72,7 @@ FTD2XXLIB =
 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 \
@@ -94,9 +96,6 @@ nobase_dist_pkglib_DATA = \
        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
diff --git a/src/bin2char.c b/src/bin2char.c
new file mode 100644 (file)
index 0000000..de00aeb
--- /dev/null
@@ -0,0 +1,30 @@
+#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
index 6c1f57031ee13b70f70d70c70fd0e8236c5e4616..813c021cb2f576f216098b2e718dfc0783d65b94 100644 (file)
@@ -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);
 }
 
-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)
 {
@@ -741,10 +741,10 @@ 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;
        

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)