From fc669dc27409b64525f09c13f320ec1f50ab06b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valmantas=20Palik=C5=A1a?= Date: Fri, 18 May 2018 11:54:57 +0300 Subject: [PATCH] Use LTO to save up to 7k of flash (#305) --- workspace/TS100/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/workspace/TS100/Makefile b/workspace/TS100/Makefile index 29fd1aa6..04c31f0a 100644 --- a/workspace/TS100/Makefile +++ b/workspace/TS100/Makefile @@ -32,7 +32,7 @@ HEXFILE_DIR=Hexfile OUTPUT_DIR=Objects # code optimisation ------------------------------------------------------------ -OPTIM=-Os -finline-small-functions -findirect-inlining -fdiagnostics-color -ffunction-sections -fdata-sections +OPTIM=-Os -flto -finline-small-functions -findirect-inlining -fdiagnostics-color -ffunction-sections -fdata-sections # global defines --------------------------------------------------------------- @@ -73,7 +73,7 @@ LINKER_FLAGS=-Wl,--gc-sections \ -mcpu=cortex-m3 \ -mthumb \ -mfloat-abi=soft \ - -lm + -lm -Os -flto -Wl,--undefined=vTaskSwitchContext # compiler flags --------------------------------------------------------------- CPUFLAGS=-D GCC_ARMCM3 \ @@ -185,13 +185,13 @@ all: $(OUT_HEXFILE).hex # Create hexfile %.hex : %.elf - $(SIZE) -x $^ + $(SIZE) $^ $(OBJCOPY) $^ -O ihex $@ $(OUT_HEXFILE).elf : $(OUT_OBJS) $(OUT_OBJS_CPP) $(OUT_OBJS_S) Makefile $(LDSCRIPT) @test -d $(@D) || mkdir -p $(@D) @echo Linking $(OUTPUT_EXE).elf - @$(CPP) $(CXXFLAGS) $(OUT_OBJS) $(OUT_OBJS_CPP) $(OUT_OBJS_S) $(LIBS) $(LINKER_FLAGS) + @$(CPP) $(CXXFLAGS) $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) $(LIBS) $(LINKER_FLAGS) $(OUT_OBJS): $(OUTPUT_DIR)/%.o : %.c Makefile @test -d $(@D) || mkdir -p $(@D)