diff options
| author | Laurens Valk <laurens@pybricks.com> | 2022-11-29 10:38:57 +0100 |
|---|---|---|
| committer | Damien George <damien.p.george@gmail.com> | 2022-12-06 13:34:17 +1100 |
| commit | f724d90e6c0c6dadf0a746ba1413517d6ce497db (patch) | |
| tree | acaa09d8dd752c7cd059454c15fb54b254da4821 /py | |
| parent | fb7d211530d842b6efdc230c8834d9d0bd6f6f67 (diff) | |
py/modmicropython: Make module optional.
This module is useful, but it is not always needed. Disabling it saves
several kilobytes of build size, depending on other config options.
Signed-off-by: Laurens Valk <laurens@pybricks.com>
Diffstat (limited to 'py')
| -rw-r--r-- | py/modmicropython.c | 4 | ||||
| -rw-r--r-- | py/mpconfig.h | 5 |
2 files changed, 9 insertions, 0 deletions
diff --git a/py/modmicropython.c b/py/modmicropython.c index eafff90c6..c717926e6 100644 --- a/py/modmicropython.c +++ b/py/modmicropython.c @@ -32,6 +32,8 @@ #include "py/gc.h" #include "py/mphal.h" +#if MICROPY_PY_MICROPYTHON + // Various builtins specific to MicroPython runtime, // living in micropython module @@ -211,3 +213,5 @@ const mp_obj_module_t mp_module_micropython = { }; MP_REGISTER_MODULE(MP_QSTR_micropython, mp_module_micropython); + +#endif // MICROPY_PY_MICROPYTHON diff --git a/py/mpconfig.h b/py/mpconfig.h index 0ae6fcdd1..62c123bc0 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -1311,6 +1311,11 @@ typedef double mp_float_t; #define MICROPY_PY_CMATH (MICROPY_CONFIG_ROM_LEVEL_AT_LEAST_EXTRA_FEATURES) #endif +// Whether to provide "micropython" module +#ifndef MICROPY_PY_MICROPYTHON +#define MICROPY_PY_MICROPYTHON (1) +#endif + // Whether to provide "gc" module #ifndef MICROPY_PY_GC #define MICROPY_PY_GC (MICROPY_CONFIG_ROM_LEVEL_AT_LEAST_CORE_FEATURES) |
