From a6244125973439e27a79e0d2ee2cdab5f97e8dc6 Mon Sep 17 00:00:00 2001 From: Thomas Eichinger Date: Thu, 9 Oct 2014 15:00:31 +0200 Subject: [PATCH] make: build with linker garbage collection Currently only has the linker flag --gc-sections defined which tells the linker to omit dead code. Depending on the application this leads to significant reduction of code size. --- boards/Makefile.include.cortexm_common | 1 + boards/redbee-econotag/Makefile.include | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/boards/Makefile.include.cortexm_common b/boards/Makefile.include.cortexm_common index 1207989375..e94090fa30 100644 --- a/boards/Makefile.include.cortexm_common +++ b/boards/Makefile.include.cortexm_common @@ -36,6 +36,7 @@ export ASFLAGS += $(CFLAGS_CPU) $(CFLAGS_DEBUG) export LINKFLAGS += -L$(RIOTCPU)/$(CPU)/ldscripts -L$(RIOTCPU)/cortexm_common/ldscripts export LINKFLAGS += -T$(RIOTCPU)/$(CPU)/ldscripts/$(CPU_MODEL).ld -Wl,--fatal-warnings export LINKFLAGS += $(CFLAGS_DEBUG) $(CFLAGS_CPU) $(CFLAGS_STYLE) -static -lgcc -nostartfiles +export LINKFLAGS += -Wl,--gc-sections # Import all toolchain settings include $(RIOTBOARD)/Makefile.include.$(TOOLCHAIN) diff --git a/boards/redbee-econotag/Makefile.include b/boards/redbee-econotag/Makefile.include index 2792fe6b65..79af1501d8 100644 --- a/boards/redbee-econotag/Makefile.include +++ b/boards/redbee-econotag/Makefile.include @@ -19,7 +19,7 @@ export SIZE = $(PREFIX)size export OBJCOPY = $(PREFIX)objcopy FLASHER = mc1322x-load.pl TERM = pyterm -LINKFLAGS += -mcpu=arm7tdmi-s -static -lgcc -nostartfiles -T$(RIOTBASE)/cpu/$(CPU)/mc1322x.lds +LINKFLAGS += -mcpu=arm7tdmi-s -static -lgcc -nostartfiles -Wl,--gc-sections -T$(RIOTBASE)/cpu/$(CPU)/mc1322x.lds ifeq ($(strip $(PORT)),) export PORT = /dev/ttyUSB0