Skip to content
Snippets Groups Projects
Commit 3cdecf90 authored by Ayke van Laethem's avatar Ayke van Laethem Committed by Damien George
Browse files

nrf: Make LTO configurable via Makefile flag.

LTO messes up debuggability and may cause some other issues.
Additionally, it does not always result in reduced code size.
parent c4861273
No related branches found
No related tags found
No related merge requests found
...@@ -69,6 +69,13 @@ CFLAGS_MCU_m4 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4 -mfpu=fpv4-s ...@@ -69,6 +69,13 @@ CFLAGS_MCU_m4 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4 -mfpu=fpv4-s
CFLAGS_MCU_m0 = $(CFLAGS_CORTEX_M) --short-enums -mtune=cortex-m0 -mcpu=cortex-m0 -mfloat-abi=soft -fno-builtin CFLAGS_MCU_m0 = $(CFLAGS_CORTEX_M) --short-enums -mtune=cortex-m0 -mcpu=cortex-m0 -mfloat-abi=soft -fno-builtin
LTO ?= 1
ifeq ($(LTO),1)
CFLAGS_LTO += -flto
else
CFLAGS_LTO += -Wl,--gc-sections -ffunction-sections -fdata-sections
endif
CFLAGS += $(CFLAGS_MCU_$(MCU_SERIES)) CFLAGS += $(CFLAGS_MCU_$(MCU_SERIES))
CFLAGS += $(INC) -Wall -Werror -ansi -std=gnu99 -nostdlib $(COPT) $(NRF_DEFINES) $(CFLAGS_MOD) CFLAGS += $(INC) -Wall -Werror -ansi -std=gnu99 -nostdlib $(COPT) $(NRF_DEFINES) $(CFLAGS_MOD)
...@@ -76,7 +83,7 @@ CFLAGS += -fno-strict-aliasing ...@@ -76,7 +83,7 @@ CFLAGS += -fno-strict-aliasing
CFLAGS += -fstack-usage CFLAGS += -fstack-usage
CFLAGS += -Iboards/$(BOARD) CFLAGS += -Iboards/$(BOARD)
CFLAGS += -DNRF5_HAL_H='<$(MCU_VARIANT)_hal.h>' CFLAGS += -DNRF5_HAL_H='<$(MCU_VARIANT)_hal.h>'
CFLAGS += -flto CFLAGS += $(CFLAGS_LTO)
LDFLAGS = $(CFLAGS) LDFLAGS = $(CFLAGS)
LDFLAGS += -Xlinker -Map=$(@:.elf=.map) LDFLAGS += -Xlinker -Map=$(@:.elf=.map)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment