Skip to content

Commit

Permalink
Enable LTO for bootloader in order to reduce binary size.
Browse files Browse the repository at this point in the history
  • Loading branch information
emosenkis committed Dec 9, 2019
1 parent 66a172f commit e2f1b35
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions targets/stm32l432/build/bootloader.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ include build/common.mk
# ST related
SRC = bootloader/main.c bootloader/bootloader.c
SRC += bootloader/pubkey_bootloader.c bootloader/version_check.c
SRC += src/init.c src/redirect.c src/flash.c src/rng.c src/led.c src/device.c
SRC += src/fifo.c src/attestation.c src/sense.c
SRC += src/startup_stm32l432xx.s src/system_stm32l4xx.c
# Important: device.c must come after startup_stm32l432xx.s to work around
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83967. If the order is switched,
# compilation will succeed but the output will be missing overridden weak
# symbols.
SRC += src/init.c src/redirect.c src/flash.c src/rng.c src/led.c src/device.c
SRC += $(DRIVER_LIBS) $(USB_LIB)

# FIDO2 lib
Expand Down Expand Up @@ -45,8 +49,8 @@ endif
DEFINES = -DDEBUG_LEVEL=$(DEBUG) -D$(CHIP) -DAES256=1 -DUSE_FULL_LL_DRIVER -DAPP_CONFIG=\"bootloader.h\" $(EXTRA_DEFINES)
# DEFINES += -DTEST_SOLO_STM32 -DTEST -DTEST_FIFO=1

CFLAGS=$(INC) -c $(DEFINES) -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fdata-sections -ffunction-sections $(HW) -g $(VERSION_FLAGS)
LDFLAGS_LIB=$(HW) $(SEARCH) -specs=nano.specs -specs=nosys.specs -Wl,--gc-sections -lnosys
CFLAGS=$(INC) -c $(DEFINES) -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fdata-sections -ffunction-sections $(HW) -g $(VERSION_FLAGS) -flto
LDFLAGS_LIB=$(HW) $(SEARCH) -specs=nano.specs -specs=nosys.specs -Wl,--gc-sections -lnosys -flto
LDFLAGS=$(HW) $(LDFLAGS_LIB) -T$(LDSCRIPT) -Wl,-Map=$(TARGET).map,--cref -Wl,-Bstatic


Expand Down

0 comments on commit e2f1b35

Please sign in to comment.