mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
cc makefile: enable -ffunction-sections and -fdata-sections
These compiler options place each function and each global variable into its own ELF section in each .o file. This, combined with the linker option --gc-sections allows the linker to evict unused functions and variables from the final ELF file. On CC, the firmware flash bank is only 118784 bytes in total. This commit reduces the .text segment from 114120 to 83536 and .data from 572 bytes to 560 bytes. That frees up a grand total of 30596 bytes of flash and 12 bytes of RAM.
This commit is contained in:
parent
bbe86332de
commit
9f8d22961f
@ -503,6 +503,7 @@ endif
|
||||
|
||||
CFLAGS += -Wall
|
||||
CFLAGS += -Werror
|
||||
CFLAGS += -ffunction-sections -fdata-sections
|
||||
CFLAGS += -Wa,-adhlns=$(addprefix $(OUTDIR)/, $(notdir $(addsuffix .lst, $(basename $<))))
|
||||
# Compiler flags to generate dependency files:
|
||||
CFLAGS += -MD -MP -MF $(OUTDIR)/dep/$(@F).d
|
||||
|
Loading…
x
Reference in New Issue
Block a user