summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-07-19 12:21:52 +1000
committerDamien George <damien.p.george@gmail.com>2017-07-21 23:30:33 +1000
commita6bec531771f2e2103148ed98dc96d4ce90e44e1 (patch)
tree77224c4378a01de93e03fa44150c2d914e11dcf6
parent205c368fa1e03e93af3b45ae08ac02f87ca866b5 (diff)
downloadmicropython-a6bec531771f2e2103148ed98dc96d4ce90e44e1.tar.gz
micropython-a6bec531771f2e2103148ed98dc96d4ce90e44e1.zip
minimal/Makefile: Enable gc-sections to remove unused code.
-rw-r--r--minimal/Makefile12
1 files changed, 5 insertions, 7 deletions
diff --git a/minimal/Makefile b/minimal/Makefile
index d615157970..994d26880d 100644
--- a/minimal/Makefile
+++ b/minimal/Makefile
@@ -22,23 +22,21 @@ DFU = ../tools/dfu.py
PYDFU = ../tools/pydfu.py
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 -std=c99 -nostdlib $(CFLAGS_CORTEX_M4) $(COPT)
+LDFLAGS = -nostdlib -T stm32f405.ld -Map=$@.map --cref --gc-sections
else
+LD = gcc
CFLAGS = -m32 $(INC) -Wall -Werror -std=c99 $(COPT)
+LDFLAGS = -m32 -Wl,-Map=$@.map,--cref -Wl,--gc-sections
endif
-#Debugging/Optimization
+# Tune for Debugging or Optimization
ifeq ($(DEBUG), 1)
CFLAGS += -O0 -ggdb
else
CFLAGS += -Os -DNDEBUG
+CFLAGS += -fdata-sections -ffunction-sections
endif
-ifeq ($(CROSS), 1)
-LDFLAGS = -nostdlib -T stm32f405.ld -Map=$@.map --cref
-else
-LD = gcc
-LDFLAGS = -m32 -Wl,-Map=$@.map,--cref
-endif
LIBS =
SRC_C = \