From 696a20fea495b589305abe6cbd4cbfeb498a33a6 Mon Sep 17 00:00:00 2001 From: ntfreak Date: Sun, 13 Jul 2008 21:07:14 +0000 Subject: [PATCH] - remove unused objcopy from configure.in - make sure bin2char is built before openocd - add generated startup_tcl.c to clean list - pass startup_tcl directly to Jim_Eval git-svn-id: svn://svn.berlios.de/openocd/trunk@805 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- configure.in | 13 ------------- src/Makefile.am | 5 ++++- src/bin2char.c | 26 ++++++++++++++++++++++---- src/openocd.c | 17 ++--------------- 4 files changed, 28 insertions(+), 33 deletions(-) diff --git a/configure.in b/configure.in index bc47064f..343b52c6 100644 --- a/configure.in +++ b/configure.in @@ -291,19 +291,6 @@ AC_LANG_C AC_PROG_CC AC_PROG_RANLIB -AC_CHECK_PROG(OBJDUMP, objdump, objdump) -AC_CHECK_PROG(OBJCOPY, objcopy, objcopy) - -if test x${OBJDUMP} != x -a x${OBJCOPY} != x ; then - AC_MSG_CHECKING(objcopy command line) - AC_TRY_COMPILE(,,[OBJCOPY_format=`${OBJDUMP} -f conftest.$ac_objext | sed -e '/file format/!d' -e 's/.*format \(.*\)/\1/'` - OBJCOPY_arch=`${OBJDUMP} -f conftest.$ac_objext | sed -e '/architecture/!d' -e 's/.*architecture: \(.*\),.*/\1/'`]) - AC_MSG_RESULT(-I binary -O ${OBJCOPY_format} -B ${OBJCOPY_arch}) -fi - -AC_SUBST(OBJCOPY_FORMAT, ${OBJCOPY_format}) -AC_SUBST(OBJCOPY_ARCH, ${OBJCOPY_arch}) - AC_SUBST(WITH_FTD2XX, $with_ftd2xx) AC_OUTPUT(Makefile src/Makefile src/helper/Makefile src/jtag/Makefile src/xsvf/Makefile src/target/Makefile src/server/Makefile src/flash/Makefile src/pld/Makefile doc/Makefile) diff --git a/src/Makefile.am b/src/Makefile.am index 0cb13ab6..27309eca 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,4 @@ -bin_PROGRAMS = openocd bin2char +bin_PROGRAMS = bin2char openocd bin2char_SOURCES = bin2char.c @@ -99,3 +99,6 @@ nobase_dist_pkglib_DATA = \ # Convert .tcl to cfile startup_tcl.c: bin2char startup.tcl ./bin2char startup_tcl < $(srcdir)/startup.tcl > startup_tcl.c + +# add startup_tcl.c to make clean list +CLEANFILES = startup_tcl.c diff --git a/src/bin2char.c b/src/bin2char.c index 436839bb..f1c809c8 100644 --- a/src/bin2char.c +++ b/src/bin2char.c @@ -1,8 +1,27 @@ +/*************************************************************************** + * Copyright (C) 2005 by Dominic Rath * + * Dominic.Rath@gmx.de * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + #include #include -int -main(int argc, char **argv) +int main(int argc, char **argv) { int c; unsigned int n; @@ -24,7 +43,6 @@ main(int argc, char **argv) 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); + fprintf(stdout, "0 /* terminate with a null */};\n"); return 0; } diff --git a/src/openocd.c b/src/openocd.c index 813c021c..2698b724 100644 --- a/src/openocd.c +++ b/src/openocd.c @@ -715,13 +715,9 @@ void add_jim(const char *name, int (*cmd)(Jim_Interp *interp, int argc, Jim_Obj } extern unsigned const char startup_tcl[]; -extern unsigned int startup_tcl_len; void initJim(void) -{ - char *script; - int script_len; - +{ Jim_CreateCommand(interp, "openocd", Jim_Command_openocd, NULL, NULL); Jim_CreateCommand(interp, "openocd_throw", Jim_Command_openocd_throw, NULL, NULL); Jim_CreateCommand(interp, "find", Jim_Command_find, NULL, NULL); @@ -741,21 +737,12 @@ void initJim(void) add_default_dirs(); - script_len = startup_tcl_len; - script = malloc(script_len + sizeof(char)); - memcpy(script, startup_tcl, script_len); - - /* null terminate */ - script[script_len] = 0; - - if (Jim_Eval(interp, script)==JIM_ERR) + if (Jim_Eval(interp, startup_tcl)==JIM_ERR) { LOG_ERROR("Failed to run startup.tcl (embedded into OpenOCD compile time)"); Jim_PrintErrorMessage(interp); exit(-1); } - - free(script); } int handle_script_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) -- 2.39.5