diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index 53ba302376..4bcbb5cf83 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -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 += \ diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile index 6db2b547c5..68bc3cc41c 100755 --- a/ports/nrf/Makefile +++ b/ports/nrf/Makefile @@ -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) diff --git a/ports/nrf/boards/bluemicro833/mpconfigboard.mk b/ports/nrf/boards/bluemicro833/mpconfigboard.mk index 6c8c7172c1..bfefcbf100 100644 --- a/ports/nrf/boards/bluemicro833/mpconfigboard.mk +++ b/ports/nrf/boards/bluemicro833/mpconfigboard.mk @@ -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 diff --git a/ports/nrf/boards/microbit_v2/mpconfigboard.mk b/ports/nrf/boards/microbit_v2/mpconfigboard.mk index dc47f2be4e..413efda7f7 100644 --- a/ports/nrf/boards/microbit_v2/mpconfigboard.mk +++ b/ports/nrf/boards/microbit_v2/mpconfigboard.mk @@ -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 diff --git a/ports/nrf/boards/pca10100/mpconfigboard.mk b/ports/nrf/boards/pca10100/mpconfigboard.mk index 95a2dd4d98..553da88963 100644 --- a/ports/nrf/boards/pca10100/mpconfigboard.mk +++ b/ports/nrf/boards/pca10100/mpconfigboard.mk @@ -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 diff --git a/ports/nrf/boards/simmel/mpconfigboard.mk b/ports/nrf/boards/simmel/mpconfigboard.mk index bdafadceb7..faf9d2d1e3 100644 --- a/ports/nrf/boards/simmel/mpconfigboard.mk +++ b/ports/nrf/boards/simmel/mpconfigboard.mk @@ -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 diff --git a/ports/nrf/mpconfigport.mk b/ports/nrf/mpconfigport.mk index 1a12c20f2d..6cbbce1846 100644 --- a/ports/nrf/mpconfigport.mk +++ b/ports/nrf/mpconfigport.mk @@ -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 diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 121341b6d1..69f4c248bc 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -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)