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.
|
# Uncomment this line if you want to use the installed (not local) library.
|
||||||
# TOOLCHAIN_DIR = `dirname \`which $(CC)\``/../$(PREFIX)
|
# TOOLCHAIN_DIR = `dirname \`which $(CC)\``/../$(PREFIX)
|
||||||
TOOLCHAIN_DIR = ../../..
|
TOOLCHAIN_DIR = ../../..
|
||||||
CFLAGS = -O0 -g -Wall -Wextra -I$(TOOLCHAIN_DIR)/include -fno-common \
|
CFLAGS += -Os -g -Wall -Wextra -I$(TOOLCHAIN_DIR)/include -fno-common \
|
||||||
-mcpu=cortex-m3 -mthumb
|
-mcpu=cortex-m3 -mthumb
|
||||||
LDSCRIPT = $(BINARY).ld
|
LDSCRIPT = $(BINARY).ld
|
||||||
LDFLAGS = -L$(TOOLCHAIN_DIR)/lib -T$(LDSCRIPT) -nostartfiles
|
LDFLAGS += -L$(TOOLCHAIN_DIR)/lib -T$(LDSCRIPT) -nostartfiles \
|
||||||
#LDFLAGS = -T$(LDSCRIPT) -nostartfiles
|
-Wl,--gc-sections
|
||||||
OBJS += $(BINARY).o
|
OBJS += $(BINARY).o
|
||||||
|
|
||||||
OOCD ?= openocd
|
OOCD ?= openocd
|
||||||
@ -41,6 +41,8 @@ OOCD_BOARD ?= olimex_stm32_h103
|
|||||||
ifneq ($(V),1)
|
ifneq ($(V),1)
|
||||||
Q := @
|
Q := @
|
||||||
NULL := 2>/dev/null
|
NULL := 2>/dev/null
|
||||||
|
else
|
||||||
|
LDFLAGS += -Wl,--print-gc-sections
|
||||||
endif
|
endif
|
||||||
|
|
||||||
.SUFFIXES: .elf .bin .hex .srec .list .images
|
.SUFFIXES: .elf .bin .hex .srec .list .images
|
||||||
|
@ -24,7 +24,8 @@ PREFIX ?= arm-elf
|
|||||||
CC = $(PREFIX)-gcc
|
CC = $(PREFIX)-gcc
|
||||||
AR = $(PREFIX)-ar
|
AR = $(PREFIX)-ar
|
||||||
CFLAGS = -Os -g -Wall -Wextra -I../include -fno-common \
|
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 = rcsv
|
||||||
ARFLAGS = rcs
|
ARFLAGS = rcs
|
||||||
OBJS = vector.o rcc.o gpio.o usart.o adc.o spi.o flash.o nvic.o \
|
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