-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
zephyr: use feature levels for minimal and standard build configurations #17680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
zephyr: use feature levels for minimal and standard build configurations #17680
Conversation
…ython#17680. @dpgeorge's PR micropython#17680 defines the standard Zephyr config based on MICROPY_CONFIG_ROM_LEVEL_BASIC. This allows for simplifying the XIAO BLE board's mpconfigport-xiao.h. Signed-off-by: Ned Konz <ned@metamagix.tech>
62da5b0
to
46965b0
Compare
#define MICROPY_COMP_CONST_FOLDING (0) | ||
#define MICROPY_COMP_CONST (0) | ||
#define MICROPY_COMP_DOUBLE_TUPLE_ASSIGN (0) | ||
// These features are enabled to get the test suite passing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Long term, I wonder if we should aim to have MICROPY_CONFIG_ROM_LEVEL_MINIMUM
pass the test suite - presumably with a mixture of automatically skipping some tests and adding some features to the minimum level...
Anyway, that's not relevant for this PR which looks like a good improvement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Long term, I wonder if we should aim to have
MICROPY_CONFIG_ROM_LEVEL_MINIMUM
pass the test suite
Yes, totally agree. We do have unix minimal variant that runs the tests under CI, but only the tests/basics
directory, and it explicitly skips some tests.
So, something to improve in the future.
This commit adjusts the configuration of the minimal zephyr build to use MICROPY_CONFIG_ROM_LEVEL_MINIMUM. That's a lot cleaner than explicitly enabling/disabling options. Prior to this change the minimal build for qemu_cortex_m3 had size: Memory region Used Size Region Size %age Used FLASH: 114436 B 256 KB 43.65% RAM: 26320 B 64 KB 40.16% and had the following test results (running using the CI settings, ie `-d basics float --exclude inf_nan_arith`): 352 tests performed (7092 individual testcases) 352 tests passed 254 tests skipped: ... With the changes here the qemu_cortex_m3 size is now: Memory region Used Size Region Size %age Used FLASH: 99428 B 256 KB 37.93% RAM: 26312 B 64 KB 40.15% That's a good decrease of about 15k firmware size. And the test suite still passes with: 342 tests performed (6776 individual testcases) 341 tests passed 265 tests skipped: ... Signed-off-by: Damien George <damien@micropython.org>
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 <damien@micropython.org>
46965b0
to
4360da1
Compare
…ython#17680. @dpgeorge's PR micropython#17680 defines the standard Zephyr config based on MICROPY_CONFIG_ROM_LEVEL_BASIC. This allows for simplifying the XIAO BLE board's mpconfigport-xiao.h. Signed-off-by: Ned Konz <ned@metamagix.tech>
Summary
There are two commits here, both simplifying the zephyr configuration to use ROM feature level settings.
The minimal configuration now uses MICROPY_CONFIG_ROM_LEVEL_MINIMUM. This decreases firmware size by about 15k, and the tests still pass.
The standard configuration now uses MICROPY_CONFIG_ROM_LEVEL_BASIC_FEATURES. This increases firmware size by about 6.5k, but adds some useful things:
filter
,property
andreversed
builtinsrange
attributesstr.count()
methodarray
module witharray.array
objectcollections
module withcollections.namedtuple
objectstruct
module with everythingid = const()
and constant folding in the compiler__all__
support in modulesUsing feature levels simplifies the configurations and allows boards to better fine-tune their config, eg #17679 should be much simpler with this PR.
Testing
Tested locally with qemu_cortex_m3 build, both minimal and standard. Tested also with frdm_k64f and the standard configuration.
Will also be tested by CI.
Trade-offs and Alternatives
This should be a win all round. After all, this is what the feature levels are for (and zephyr so far didn't convert to use them, that's what's done here).