From 83b348631fb9a9c5a528ac1e7abee0c86eea56c9 Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Wed, 24 Jan 2007 16:11:48 +0000 Subject: [PATCH] Changed the generation of symbols to the mknmlist script. Now symbols.h is not automatically generated so we can use it as a normal include file and remove symbols-def.h. --- core/loader/symbols.h | 45 ++++++++++++++++++++++++++++++++++++++ core/loader/symtab-avr.c | 4 ++-- core/loader/symtab.c | 4 ++-- cpu/msp430/Makefile.msp430 | 9 ++++---- tools/make-empty-symbols | 3 ++- tools/mknmlist | 2 +- 6 files changed, 57 insertions(+), 10 deletions(-) create mode 100644 core/loader/symbols.h diff --git a/core/loader/symbols.h b/core/loader/symbols.h new file mode 100644 index 000000000..84df877a3 --- /dev/null +++ b/core/loader/symbols.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2005, Swedish Institute of Computer Science + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of the Contiki operating system. + * + * @(#)$Id: symbols.h,v 1.4 2007/01/24 16:13:49 adamdunkels Exp $ + */ +#ifndef __SYMBOLS_DEF_H__ +#define __SYMBOLS_DEF_H__ + +struct symbols { + const char *name; + const char *value; +}; + +extern const int symbols_nelts; + +extern const struct symbols symbols[]; + +#endif /* __SYMBOLS_DEF_H__ */ diff --git a/core/loader/symtab-avr.c b/core/loader/symtab-avr.c index 359774cb4..173e3f60d 100644 --- a/core/loader/symtab-avr.c +++ b/core/loader/symtab-avr.c @@ -28,14 +28,14 @@ * * This file is part of the Contiki operating system. * - * @(#)$Id: symtab-avr.c,v 1.2 2007/01/23 12:31:14 bg- Exp $ + * @(#)$Id: symtab-avr.c,v 1.3 2007/01/24 16:13:50 adamdunkels Exp $ */ #include #include #include #include "symtab.h" -#include "loader/symbols-def.h" +#include "loader/symbols.h" #define SYMTAB_CONF_BINARY_SEARCH 0 diff --git a/core/loader/symtab.c b/core/loader/symtab.c index 01a1a6964..d76a2719b 100644 --- a/core/loader/symtab.c +++ b/core/loader/symtab.c @@ -28,12 +28,12 @@ * * This file is part of the Contiki operating system. * - * @(#)$Id: symtab.c,v 1.6 2007/01/12 13:55:05 bg- Exp $ + * @(#)$Id: symtab.c,v 1.7 2007/01/24 16:13:50 adamdunkels Exp $ */ #include "symtab.h" -#include "loader/symbols-def.h" +#include "loader/symbols.h" #include diff --git a/cpu/msp430/Makefile.msp430 b/cpu/msp430/Makefile.msp430 index 969d007cd..a1069a8e1 100644 --- a/cpu/msp430/Makefile.msp430 +++ b/cpu/msp430/Makefile.msp430 @@ -1,4 +1,4 @@ -# $Id: Makefile.msp430,v 1.10 2006/12/19 09:22:25 adamdunkels Exp $ +# $Id: Makefile.msp430,v 1.11 2007/01/24 16:13:47 adamdunkels Exp $ ### Check if we are running under Windows @@ -40,7 +40,7 @@ CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES) ### Compiler definitions CC = msp430-gcc -LD = msp430-ld +LD = msp430-gcc AS = msp430-as AR = msp430-ar OBJCOPY = msp430-objcopy @@ -103,8 +103,9 @@ loader-init.o: ${CONTIKI_TARGET}/loader/loader-init.S .PHONY: symbols.c symbols.h ifdef CORE -symbols.c symbols.h: - @${CONTIKI}/tools/msp430-make-symbols $(CORE) +symbols.c: +# @${CONTIKI}/tools/msp430-make-symbols $(CORE) + $(NM) $(CORE) | awk -f ../../tools/mknmlist > symbols.c else symbols.c symbols.h: @${CONTIKI}/tools/make-empty-symbols diff --git a/tools/make-empty-symbols b/tools/make-empty-symbols index 802521512..f530d093e 100755 --- a/tools/make-empty-symbols +++ b/tools/make-empty-symbols @@ -1,5 +1,6 @@ #!/bin/sh echo "#include \"symbols.h\"" > symbols.c +echo "const int symbols_nelts = 0;" >> symbols.c echo "const struct symbols symbols[] = {{0,0}};" >> symbols.c -echo "#include \"loader/symbols-def.h\"" > symbols.h +echo "#include \"loader/symbols.h\"" > symbols.h echo "extern const struct symbols symbols[1];">> symbols.h diff --git a/tools/mknmlist b/tools/mknmlist index 03436b3ce..79f6af655 100644 --- a/tools/mknmlist +++ b/tools/mknmlist @@ -30,7 +30,7 @@ BEGIN { END { sort(name, nname); - print "#include \"loader/symbols-def.h\"\n"; + print "#include \"loader/symbols.h\"\n"; # Must deal with compiler builtins etc. for (x = 0; x < nname; x++) {