1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-20 10:54:14 +01:00

OP-21/Flight Bootloader - added compiler and linker options to remove unused functions. Code is now smaller.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1759 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
kokomojoe 2010-09-26 02:34:04 +00:00 committed by kokomojoe
parent 9b05282be5
commit ca4f3b53fa
2 changed files with 20 additions and 6 deletions

View File

@ -244,6 +244,9 @@ CFLAGS = -g$(DEBUGF)
endif
CFLAGS += -O$(OPT)
ifeq ($(DEBUG),NO)
CFLAGS += -fdata-sections -ffunction-sections
endif
CFLAGS += -mcpu=$(MCU) -mthumb
CFLAGS += $(CDEFS)
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -I.
@ -279,6 +282,9 @@ MATH_LIB = -lm
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -nostartfiles -Wl,-Map=$(OUTDIR)/$(TARGET).map,--cref,--gc-sections
ifeq ($(DEBUG),NO)
LDFLAGS += -Wl,-static -Wl,-s
endif
LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS))
LDFLAGS += -lc
LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS))
@ -382,13 +388,13 @@ bin: $(OUTDIR)/$(TARGET).bin
all: begin gccversion build sizeafter finished end
ifeq ($(LOADFORMAT),ihex)
build: elf hex lss sym
build: elf hex sym
else
ifeq ($(LOADFORMAT),binary)
build: elf bin lss sym
build: elf bin sym
else
ifeq ($(LOADFORMAT),both)
build: elf hex bin lss sym
build: elf hex bin sym
else
$(error "$(MSG_FORMATERROR) $(FORMAT)")
endif

View File

@ -328,6 +328,10 @@ CFLAGS = -g$(DEBUGF) -DDEBUG
endif
CFLAGS += -O$(OPT)
ifeq ($(DEBUG),NO)
CFLAGS += -fdata-sections -ffunction-sections
endif
CFLAGS += -mcpu=$(MCU) -mthumb
CFLAGS += $(CDEFS)
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -I.
@ -361,6 +365,9 @@ MATH_LIB = -lm
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -nostartfiles -Wl,-Map=$(OUTDIR)/$(TARGET).map,--cref,--gc-sections
ifeq ($(DEBUG),NO)
LDFLAGS += -Wl,-static -Wl,-s
endif
LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS))
LDFLAGS += -lc
LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS))
@ -466,13 +473,13 @@ bin: $(OUTDIR)/$(TARGET).bin
all: begin gccversion build sizeafter finished end
ifeq ($(LOADFORMAT),ihex)
build: elf hex lss sym
build: elf hex sym
else
ifeq ($(LOADFORMAT),binary)
build: elf bin lss sym
build: elf bin sym
else
ifeq ($(LOADFORMAT),both)
build: elf hex bin lss sym
build: elf hex bin sym
else
$(error "$(MSG_FORMATERROR) $(FORMAT)")
endif
@ -509,6 +516,7 @@ end:
# Display sizes of sections.
ELFSIZE = $(SIZE) -A $(OUTDIR)/$(TARGET).elf
#ELFSIZE = $(SIZE) -B -t $(ALLOBJ) $(OUTDIR)/$(TARGET).elf
##ELFSIZE = $(SIZE) --format=Berkeley --common $(OUTDIR)/$(TARGET).elf
sizebefore:
# @if [ -f $(OUTDIR)/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi