diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile index c165242b19..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 - # If -flto is needed, give it in OPTIMIZATION_FLAGS per board endif ifeq ($(NRF_DEBUG_PRINT), 1) diff --git a/ports/nrf/boards/bluemicro833/mpconfigboard.mk b/ports/nrf/boards/bluemicro833/mpconfigboard.mk index 22ea8df1b9..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 -flto -flto-partition=one diff --git a/ports/nrf/boards/microbit_v2/mpconfigboard.mk b/ports/nrf/boards/microbit_v2/mpconfigboard.mk index 738444c91c..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 -flto -flto-partition=one -SUPEROPT_VM = 0 -SUPEROPT_GC = 0 diff --git a/ports/nrf/boards/pca10100/mpconfigboard.mk b/ports/nrf/boards/pca10100/mpconfigboard.mk index 7c7bb06c1f..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 -flto -flto-partition=one diff --git a/ports/nrf/boards/simmel/mpconfigboard.mk b/ports/nrf/boards/simmel/mpconfigboard.mk index 0885462951..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 -flto -flto-partition=one -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