Skip to content

Commit a6bec53

Browse files
committed
minimal/Makefile: Enable gc-sections to remove unused code.
1 parent 205c368 commit a6bec53

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

minimal/Makefile

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,21 @@ DFU = ../tools/dfu.py
2222
PYDFU = ../tools/pydfu.py
2323
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
2424
CFLAGS = $(INC) -Wall -Werror -std=c99 -nostdlib $(CFLAGS_CORTEX_M4) $(COPT)
25+
LDFLAGS = -nostdlib -T stm32f405.ld -Map=$@.map --cref --gc-sections
2526
else
27+
LD = gcc
2628
CFLAGS = -m32 $(INC) -Wall -Werror -std=c99 $(COPT)
29+
LDFLAGS = -m32 -Wl,-Map=$@.map,--cref -Wl,--gc-sections
2730
endif
2831

29-
#Debugging/Optimization
32+
# Tune for Debugging or Optimization
3033
ifeq ($(DEBUG), 1)
3134
CFLAGS += -O0 -ggdb
3235
else
3336
CFLAGS += -Os -DNDEBUG
37+
CFLAGS += -fdata-sections -ffunction-sections
3438
endif
3539

36-
ifeq ($(CROSS), 1)
37-
LDFLAGS = -nostdlib -T stm32f405.ld -Map=$@.map --cref
38-
else
39-
LD = gcc
40-
LDFLAGS = -m32 -Wl,-Map=$@.map,--cref
41-
endif
4240
LIBS =
4341

4442
SRC_C = \

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy