Added gc-sections. Now unused functions are being garbage collected.
This commit is contained in:
parent
81045ff279
commit
600d8c3458
@ -26,11 +26,11 @@ OBJDUMP = $(PREFIX)-objdump
|
||||
# Uncomment this line if you want to use the installed (not local) library.
|
||||
# TOOLCHAIN_DIR = `dirname \`which $(CC)\``/../$(PREFIX)
|
||||
TOOLCHAIN_DIR = ../../..
|
||||
CFLAGS = -O0 -g -Wall -Wextra -I$(TOOLCHAIN_DIR)/include -fno-common \
|
||||
-mcpu=cortex-m3 -mthumb
|
||||
CFLAGS += -Os -g -Wall -Wextra -I$(TOOLCHAIN_DIR)/include -fno-common \
|
||||
-mcpu=cortex-m3 -mthumb
|
||||
LDSCRIPT = $(BINARY).ld
|
||||
LDFLAGS = -L$(TOOLCHAIN_DIR)/lib -T$(LDSCRIPT) -nostartfiles
|
||||
#LDFLAGS = -T$(LDSCRIPT) -nostartfiles
|
||||
LDFLAGS += -L$(TOOLCHAIN_DIR)/lib -T$(LDSCRIPT) -nostartfiles \
|
||||
-Wl,--gc-sections
|
||||
OBJS += $(BINARY).o
|
||||
|
||||
OOCD ?= openocd
|
||||
@ -41,6 +41,8 @@ OOCD_BOARD ?= olimex_stm32_h103
|
||||
ifneq ($(V),1)
|
||||
Q := @
|
||||
NULL := 2>/dev/null
|
||||
else
|
||||
LDFLAGS += -Wl,--print-gc-sections
|
||||
endif
|
||||
|
||||
.SUFFIXES: .elf .bin .hex .srec .list .images
|
||||
|
@ -24,7 +24,8 @@ PREFIX ?= arm-elf
|
||||
CC = $(PREFIX)-gcc
|
||||
AR = $(PREFIX)-ar
|
||||
CFLAGS = -Os -g -Wall -Wextra -I../include -fno-common \
|
||||
-mcpu=cortex-m3 -mthumb -Wstrict-prototypes
|
||||
-mcpu=cortex-m3 -mthumb -Wstrict-prototypes \
|
||||
-ffunction-sections -fdata-sections
|
||||
# ARFLAGS = rcsv
|
||||
ARFLAGS = rcs
|
||||
OBJS = vector.o rcc.o gpio.o usart.o adc.o spi.o flash.o nvic.o \
|
||||
|
Loading…
x
Reference in New Issue
Block a user