zephyr/mpconfigport: Enable import of mpy and a few related features.

Support for importing .mpy files is quite fundamental to MicroPython these
days, eg it allows installing more efficient .mpy code via "mip install"
(and installing `unittest` only works with the .mpy version because the .py
version uses f-strings, which are not enabled on the zephyr port).  So
enable it generally for use by all boards.

As part of this, also enable:
- min/max: needed by `micropython/import_mpy_invalid.py`, and widely used
- sys.modules: needed by `run-tests.py` to run .mpy tests with --via-mpy
- io module: needed to run .mpy tests, and useful for `io.IOBase`
- array slice assign: needed to run .mpy tests, and generally useful as a
  way to do a memory copy.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2025-06-23 13:01:33 +10:00
parent 16b00cd6e7
commit 07285323cf

View File

@@ -36,6 +36,7 @@
#define MICROPY_HEAP_SIZE (16 * 1024) #define MICROPY_HEAP_SIZE (16 * 1024)
#endif #endif
#define MICROPY_PERSISTENT_CODE_LOAD (1)
#define MICROPY_ENABLE_SOURCE_LINE (1) #define MICROPY_ENABLE_SOURCE_LINE (1)
#define MICROPY_STACK_CHECK (1) #define MICROPY_STACK_CHECK (1)
#define MICROPY_ENABLE_GC (1) #define MICROPY_ENABLE_GC (1)
@@ -46,7 +47,6 @@
#define MICROPY_PY_ASYNC_AWAIT (0) #define MICROPY_PY_ASYNC_AWAIT (0)
#define MICROPY_PY_BUILTINS_BYTES_HEX (1) #define MICROPY_PY_BUILTINS_BYTES_HEX (1)
#define MICROPY_PY_BUILTINS_FILTER (0) #define MICROPY_PY_BUILTINS_FILTER (0)
#define MICROPY_PY_BUILTINS_MIN_MAX (0)
#define MICROPY_PY_BUILTINS_PROPERTY (0) #define MICROPY_PY_BUILTINS_PROPERTY (0)
#define MICROPY_PY_BUILTINS_RANGE_ATTRS (0) #define MICROPY_PY_BUILTINS_RANGE_ATTRS (0)
#define MICROPY_PY_BUILTINS_REVERSED (0) #define MICROPY_PY_BUILTINS_REVERSED (0)
@@ -55,9 +55,9 @@
#define MICROPY_PY_BUILTINS_HELP (1) #define MICROPY_PY_BUILTINS_HELP (1)
#define MICROPY_PY_BUILTINS_HELP_TEXT zephyr_help_text #define MICROPY_PY_BUILTINS_HELP_TEXT zephyr_help_text
#define MICROPY_PY_ARRAY (0) #define MICROPY_PY_ARRAY (0)
#define MICROPY_PY_ARRAY_SLICE_ASSIGN (1)
#define MICROPY_PY_COLLECTIONS (0) #define MICROPY_PY_COLLECTIONS (0)
#define MICROPY_PY_CMATH (0) #define MICROPY_PY_CMATH (0)
#define MICROPY_PY_IO (0)
#define MICROPY_PY_MICROPYTHON_MEM_INFO (1) #define MICROPY_PY_MICROPYTHON_MEM_INFO (1)
#define MICROPY_PY_MACHINE (1) #define MICROPY_PY_MACHINE (1)
#define MICROPY_PY_MACHINE_INCLUDEFILE "ports/zephyr/modmachine.c" #define MICROPY_PY_MACHINE_INCLUDEFILE "ports/zephyr/modmachine.c"
@@ -97,7 +97,6 @@
#define MICROPY_PY_TIME_INCLUDEFILE "ports/zephyr/modtime.c" #define MICROPY_PY_TIME_INCLUDEFILE "ports/zephyr/modtime.c"
#define MICROPY_PY_ZEPHYR (1) #define MICROPY_PY_ZEPHYR (1)
#define MICROPY_PY_ZSENSOR (1) #define MICROPY_PY_ZSENSOR (1)
#define MICROPY_PY_SYS_MODULES (0)
#define MICROPY_PY_SYS_STDFILES (1) #define MICROPY_PY_SYS_STDFILES (1)
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ) #define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT) #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)