Skip to content

Commit 4360da1

Browse files
committed
zephyr/mpconfigport: Use MICROPY_CONFIG_ROM_LEVEL_BASIC_FEATURES.
This commit adjusts the configuration of the standard zephyr build to use MICROPY_CONFIG_ROM_LEVEL_BASIC_FEATURES. That's a lot cleaner than explicitly enabling/disabling options, and allows boards to more easily fine-tune the settings, eg select a different feature level. Features that are now enabled are: - async/await keyword support - `filter`, `property` and `reversed` builtins - `range` attributes - `str.count()` method - `array` module with `array.array` object - `collections` module with `collections.namedtuple` object - `struct` module with everything - `id = const()` and constant folding in the compiler Bulding qemu_cortex_m3, the code size was originally: Memory region Used Size Region Size %age Used FLASH: 193864 B 256 KB 73.95% RAM: 61992 B 64 KB 94.59% and with this commit it is now: Memory region Used Size Region Size %age Used FLASH: 200698 B 256 KB 76.56% RAM: 61992 B 64 KB 94.59% That's a mild increase of +6834 bytes flash usage for a good selection of new features. Signed-off-by: Damien George <[email protected]>
1 parent 68434b4 commit 4360da1

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

ports/zephyr/mpconfigport.h

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131
#include <zephyr/kernel.h>
3232
#include <zephyr/drivers/spi.h>
3333

34+
// Use the basic configuration level to get a balance between size and features.
35+
#ifndef MICROPY_CONFIG_ROM_LEVEL
36+
#define MICROPY_CONFIG_ROM_LEVEL (MICROPY_CONFIG_ROM_LEVEL_BASIC_FEATURES)
37+
#endif
38+
3439
// Usually passed from Makefile
3540
#ifndef MICROPY_HEAP_SIZE
3641
#define MICROPY_HEAP_SIZE (16 * 1024)
@@ -48,20 +53,11 @@
4853
#define MICROPY_REPL_AUTO_INDENT (1)
4954
#define MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF (1)
5055
#define MICROPY_KBD_EXCEPTION (1)
51-
#define MICROPY_PY_ASYNC_AWAIT (0)
5256
#define MICROPY_PY_BUILTINS_BYTES_HEX (1)
53-
#define MICROPY_PY_BUILTINS_FILTER (0)
54-
#define MICROPY_PY_BUILTINS_PROPERTY (0)
55-
#define MICROPY_PY_BUILTINS_RANGE_ATTRS (0)
56-
#define MICROPY_PY_BUILTINS_REVERSED (0)
57-
#define MICROPY_PY_BUILTINS_STR_COUNT (0)
5857
#define MICROPY_PY_BUILTINS_MEMORYVIEW (1)
5958
#define MICROPY_PY_BUILTINS_HELP (1)
6059
#define MICROPY_PY_BUILTINS_HELP_TEXT zephyr_help_text
61-
#define MICROPY_PY_ARRAY (0)
6260
#define MICROPY_PY_ARRAY_SLICE_ASSIGN (1)
63-
#define MICROPY_PY_COLLECTIONS (0)
64-
#define MICROPY_PY_CMATH (0)
6561
#define MICROPY_PY_MICROPYTHON_MEM_INFO (1)
6662
#define MICROPY_PY_MACHINE (1)
6763
#define MICROPY_PY_MACHINE_INCLUDEFILE "ports/zephyr/modmachine.c"
@@ -80,7 +76,6 @@
8076
#endif
8177
#define MICROPY_PY_MACHINE_PWM (1)
8278
#define MICROPY_PY_MACHINE_PWM_INCLUDEFILE "ports/zephyr/machine_pwm.c"
83-
#define MICROPY_PY_STRUCT (0)
8479
#ifdef CONFIG_NETWORKING
8580
// If we have networking, we likely want errno comfort
8681
#define MICROPY_PY_ERRNO (1)
@@ -96,7 +91,6 @@
9691
#define MICROPY_PY_BINASCII (1)
9792
#define MICROPY_PY_HASHLIB (1)
9893
#define MICROPY_PY_OS (1)
99-
#define MICROPY_PY_TIME (1)
10094
#define MICROPY_PY_TIME_TIME_TIME_NS (1)
10195
#define MICROPY_PY_TIME_INCLUDEFILE "ports/zephyr/modtime.c"
10296
#define MICROPY_PY_ZEPHYR (1)
@@ -117,11 +111,6 @@
117111
#define MICROPY_FATFS_RPATH (2)
118112
#define MICROPY_FATFS_NORTC (1)
119113

120-
// Saving extra crumbs to make sure binary fits in 128K
121-
#define MICROPY_COMP_CONST_FOLDING (0)
122-
#define MICROPY_COMP_CONST (0)
123-
#define MICROPY_COMP_DOUBLE_TUPLE_ASSIGN (0)
124-
125114
// When CONFIG_THREAD_CUSTOM_DATA is enabled, MICROPY_PY_THREAD is enabled automatically
126115
#ifdef CONFIG_THREAD_CUSTOM_DATA
127116
#define MICROPY_PY_THREAD (1)

0 commit comments

Comments
 (0)