From 6f076dbe1ae3b2755c7e5b13aaa51738ab4282d1 Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Wed, 19 Jan 2011 07:24:37 +0000 Subject: [PATCH] A set of compiler options that reduce the size of the final code size and RAM usage with ~10%. Courtesy of Simon Duquennoy. --- cpu/msp430/Makefile.msp430 | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cpu/msp430/Makefile.msp430 b/cpu/msp430/Makefile.msp430 index 1be540eb9..8b7988e8d 100644 --- a/cpu/msp430/Makefile.msp430 +++ b/cpu/msp430/Makefile.msp430 @@ -1,4 +1,4 @@ -# $Id: Makefile.msp430,v 1.33 2010/08/24 16:23:20 joxe Exp $ +# $Id: Makefile.msp430,v 1.34 2011/01/19 07:24:37 adamdunkels Exp $ ifdef nodeid CFLAGS += -DNODEID=$(nodeid) @@ -24,7 +24,6 @@ CONTIKI_TARGET_SOURCEFILES += $(MSP430) \ CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES) - ### Compiler definitions CC = msp430-gcc LD = msp430-gcc @@ -41,6 +40,14 @@ CFLAGSNO = -Wall -mmcu=$(MCU) -g $(CFLAGSWERROR) CFLAGS += $(CFLAGSNO) -Os LDFLAGS += -mmcu=$(MCU) -Wl,-Map=contiki-$(TARGET).map + +### These flags can reduce the code size and RAM usage with up to 10% +if SMALL +CFLAGS += -ffunction-sections +LDFLAGS += -Wl,--gc-sections,--undefined=_reset_vector__,--undefined=InterruptVectors,--undefined=_copy_data_init__,--undefined=_clear_bss_init__,--undefined=_end_of_init__ +endif # SMALL + + PROJECT_OBJECTFILES += ${addprefix $(OBJECTDIR)/,$(CONTIKI_TARGET_MAIN:.c=.o)} ### Compilation rules