zephyr: use feature levels for minimal and standard build configurations #17680
+21
−37
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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).