From 244476e3e66478f2e5d54ca92e10f9881747bd4f Mon Sep 17 00:00:00 2001 From: Damien George Date: Sat, 16 Aug 2014 13:37:05 +0100 Subject: [PATCH] stmhal: For non-debug compile, enable CC/LD opt to remove dead code. Saves over 35k ROM due to elimination of unused HAL functions. All tests pass. Addresses issue #702. --- stmhal/Makefile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/stmhal/Makefile b/stmhal/Makefile index 64c58151b4..116aeb114a 100644 --- a/stmhal/Makefile +++ b/stmhal/Makefile @@ -42,20 +42,21 @@ INC += -I$(CC3K_DIR) CFLAGS_CORTEX_M4 = -mthumb -mtune=cortex-m4 -mabi=aapcs-linux -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fsingle-precision-constant -Wdouble-promotion CFLAGS = $(INC) -Wall -Werror -ansi -std=gnu99 -nostdlib $(CFLAGS_CORTEX_M4) $(COPT) - CFLAGS += -Iboards/$(BOARD) -#Debugging/Optimization +LDFLAGS = -nostdlib -T stm32f405.ld -Map=$(@:.elf=.map) --cref +LIBS = + +# Debugging/Optimization ifeq ($(DEBUG), 1) CFLAGS += -g -DPENDSV_DEBUG COPT = -O0 else +CFLAGS += -fdata-sections -ffunction-sections COPT += -Os -DNDEBUG +LDFLAGS += --gc-sections endif -LDFLAGS = -nostdlib -T stm32f405.ld -Map=$(@:.elf=.map) --cref -LIBS = - # uncomment this if you want libgcc #LIBS += $(shell $(CC) -print-libgcc-file-name)