Merge pull request #6436 from dhalbert/judicious-lto
LTO: Use -flto and -flto-partition only as needed
This commit is contained in:
commit
dc5565a5ce
@ -124,7 +124,7 @@ $(echo PERIPHERALS_CHIP_FAMILY=$(PERIPHERALS_CHIP_FAMILY))
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -ggdb3 -Og -Os
|
||||
# You may want to disable -flto if it interferes with debugging.
|
||||
CFLAGS += -flto -flto-partition=none
|
||||
CFLAGS += -flto -flto-partition=one
|
||||
# You may want to enable these flags to make setting breakpoints easier.
|
||||
# CFLAGS += -fno-inline -fno-ipa-sra
|
||||
ifeq ($(CHIP_FAMILY), samd21)
|
||||
@ -147,10 +147,11 @@ else
|
||||
CFLAGS += -finline-limit=$(CFLAGS_INLINE_LIMIT)
|
||||
endif
|
||||
|
||||
CFLAGS += -flto -flto-partition=none
|
||||
CFLAGS += -flto
|
||||
|
||||
ifeq ($(CIRCUITPY_FULL_BUILD),0)
|
||||
CFLAGS += --param inline-unit-growth=15 --param max-inline-insns-auto=20
|
||||
CFLAGS += -flto-partition=one
|
||||
endif
|
||||
|
||||
ifdef CFLAGS_BOARD
|
||||
@ -167,7 +168,8 @@ CFLAGS += \
|
||||
-mcpu=cortex-m0plus \
|
||||
-msoft-float \
|
||||
-mfloat-abi=soft \
|
||||
-DSAMD21
|
||||
-DSAMD21 \
|
||||
-flto-partition=one
|
||||
endif
|
||||
ifeq ($(CHIP_FAMILY), samd51)
|
||||
CFLAGS += \
|
||||
|
@ -84,6 +84,14 @@ INC += -I../../lib/mp-readline
|
||||
INC += -I../../lib/tinyusb/src
|
||||
INC += -I../../supervisor/shared/usb
|
||||
|
||||
ifeq ($(MCU_CHIP),nrf52833)
|
||||
OPTIMIZATION_FLAGS ?= -Os -flto -flto-partition=one
|
||||
else
|
||||
ifeq ($(INTERNAL_FLASH_FILESYSTEM),1)
|
||||
OPTIMIZATION_FLAGS ?= -Os -flto
|
||||
endif
|
||||
endif
|
||||
|
||||
#Debugging/Optimization
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -ggdb3
|
||||
@ -91,7 +99,6 @@ ifeq ($(DEBUG), 1)
|
||||
else
|
||||
OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions
|
||||
CFLAGS += -DNDEBUG -ggdb3
|
||||
CFLAGS += -flto -flto-partition=none
|
||||
endif
|
||||
|
||||
ifeq ($(NRF_DEBUG_PRINT), 1)
|
||||
|
@ -45,9 +45,3 @@ CIRCUITPY_VECTORIO = 0
|
||||
CIRCUITPY_ZLIB = 0
|
||||
|
||||
MICROPY_PY_ASYNC_AWAIT = 0
|
||||
|
||||
SUPEROPT_GC = 0
|
||||
SUPEROPT_VM = 0
|
||||
|
||||
# Override optimization to keep binary small
|
||||
OPTIMIZATION_FLAGS = -Os
|
||||
|
@ -28,8 +28,3 @@ CIRCUITPY_ULAB = 0
|
||||
CIRCUITPY_USB = 0
|
||||
|
||||
MICROPY_PY_ASYNC_AWAIT = 0
|
||||
|
||||
# Override optimization to keep binary small
|
||||
OPTIMIZATION_FLAGS = -Os
|
||||
SUPEROPT_VM = 0
|
||||
SUPEROPT_GC = 0
|
||||
|
@ -35,9 +35,3 @@ CIRCUITPY_VECTORIO = 0
|
||||
CIRCUITPY_ZLIB = 0
|
||||
|
||||
MICROPY_PY_ASYNC_AWAIT = 0
|
||||
|
||||
SUPEROPT_GC = 0
|
||||
SUPEROPT_VM = 0
|
||||
|
||||
# Override optimization to keep binary small
|
||||
OPTIMIZATION_FLAGS = -Os
|
||||
|
@ -46,8 +46,3 @@ CIRCUITPY_ZLIB = 0
|
||||
|
||||
# Enable micropython.native
|
||||
#CIRCUITPY_ENABLE_MPY_NATIVE = 1
|
||||
|
||||
# Override optimization to keep binary small
|
||||
OPTIMIZATION_FLAGS = -Os
|
||||
SUPEROPT_VM = 0
|
||||
SUPEROPT_GC = 0
|
||||
|
@ -77,6 +77,10 @@ MCU_SERIES = m4
|
||||
MCU_VARIANT = nrf52
|
||||
MCU_SUB_VARIANT = nrf52833
|
||||
|
||||
# Need the space
|
||||
SUPEROPT_GC ?= 0
|
||||
SUPEROPT_VM ?= 0
|
||||
|
||||
SD ?= s140
|
||||
SOFTDEV_VERSION ?= 7.0.1
|
||||
|
||||
|
@ -57,8 +57,7 @@ CFLAGS += -DMICROPY_PY_USELECT_SELECT=$(MICROPY_PY_USELECT_SELECT)
|
||||
CIRCUITPY_AESIO ?= $(CIRCUITPY_FULL_BUILD)
|
||||
CFLAGS += -DCIRCUITPY_AESIO=$(CIRCUITPY_AESIO)
|
||||
|
||||
# TODO: CIRCUITPY_ALARM will gradually be added to
|
||||
# as many ports as possible
|
||||
# TODO: CIRCUITPY_ALARM will gradually be added to as many ports as possible
|
||||
# so make this 1 or CIRCUITPY_FULL_BUILD eventually
|
||||
CIRCUITPY_ALARM ?= 0
|
||||
CFLAGS += -DCIRCUITPY_ALARM=$(CIRCUITPY_ALARM)
|
||||
|
Loading…
Reference in New Issue
Block a user