diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile index e39bf9639b800..40537e50c1424 100644 --- a/ports/nrf/Makefile +++ b/ports/nrf/Makefile @@ -58,7 +58,14 @@ ifeq ($(DEBUG), 0) MICROPY_ROM_TEXT_COMPRESSION ?= 1 endif -FROZEN_MANIFEST ?= modules/manifest.py +# Enable asyncio by default and select appropriate manifest. +MICROPY_PY_ASYNCIO ?= 1 +ifeq ($(MICROPY_PY_ASYNCIO),1) +FROZEN_MANIFEST ?= boards/manifest.py +else +FROZEN_MANIFEST ?= boards/manifest_minimal.py +endif +CFLAGS += -DMICROPY_PY_ASYNCIO=$(MICROPY_PY_ASYNCIO) # include py core make definitions include ../../py/py.mk diff --git a/ports/nrf/boards/ARDUINO_NANO_33_BLE_SENSE/manifest.py b/ports/nrf/boards/ARDUINO_NANO_33_BLE_SENSE/manifest.py index 1e35ae8c4dd34..a196f931b3947 100644 --- a/ports/nrf/boards/ARDUINO_NANO_33_BLE_SENSE/manifest.py +++ b/ports/nrf/boards/ARDUINO_NANO_33_BLE_SENSE/manifest.py @@ -1,4 +1,4 @@ -include("$(PORT_DIR)/modules/manifest.py") +include("$(PORT_DIR)/boards/manifest.py") require("hts221") require("lps22h") require("lsm9ds1") diff --git a/ports/nrf/boards/MICROBIT/mpconfigboard.mk b/ports/nrf/boards/MICROBIT/mpconfigboard.mk index 6c7e1b46b93c3..f44da7aaabe7b 100644 --- a/ports/nrf/boards/MICROBIT/mpconfigboard.mk +++ b/ports/nrf/boards/MICROBIT/mpconfigboard.mk @@ -10,6 +10,8 @@ else MICROPY_VFS_LFS2 = 1 endif +MICROPY_PY_ASYNCIO = 0 + LD_FILES += boards/nrf51x22_256k_16k.ld FLASHER = pyocd diff --git a/ports/nrf/modules/manifest.py b/ports/nrf/boards/manifest.py similarity index 100% rename from ports/nrf/modules/manifest.py rename to ports/nrf/boards/manifest.py diff --git a/ports/nrf/boards/manifest_minimal.py b/ports/nrf/boards/manifest_minimal.py new file mode 100644 index 0000000000000..674e0245271b5 --- /dev/null +++ b/ports/nrf/boards/manifest_minimal.py @@ -0,0 +1 @@ +module("_boot.py", base_path="$(PORT_DIR)/modules/scripts", opt=3) diff --git a/ports/nrf/mpconfigport.h b/ports/nrf/mpconfigport.h index d5cbab7310336..62e56fa1ebf13 100644 --- a/ports/nrf/mpconfigport.h +++ b/ports/nrf/mpconfigport.h @@ -97,6 +97,10 @@ #define MICROPY_PY_BINASCII (CORE_FEAT) #endif +#ifndef MICROPY_PY_SELECT +#define MICROPY_PY_SELECT (MICROPY_PY_ASYNCIO) +#endif + #ifndef MICROPY_PY_NRF #define MICROPY_PY_NRF (CORE_FEAT) #endif diff --git a/py/mpconfig.h b/py/mpconfig.h index 1553c28ae4d32..1574243e8ea99 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -1887,7 +1887,7 @@ typedef time_t mp_timestamp_t; // implementation). This is present for compatibility but can be disabled to // save space. #ifndef MICROPY_PY_SELECT_SELECT -#define MICROPY_PY_SELECT_SELECT (1) +#define MICROPY_PY_SELECT_SELECT (MICROPY_CONFIG_ROM_LEVEL_AT_LEAST_EXTRA_FEATURES) #endif // Whether to provide the "time" module