boards/samr21-xpro: Model features in Kconfig#13404
boards/samr21-xpro: Model features in Kconfig#13404MrKevinWeiss merged 8 commits intoRIOT-OS:masterfrom
Conversation
|
@aabadie @fjmolinas @cgundogan @jia200x It would be really good to have some feedback on the approach here |
89faf74 to
a3426b5
Compare
|
Moved from draft |
|
@jia200x suggested offline to split this PR. I will make one that only adds que common symbols. And this one will add the implementation for samr21-xpro. |
a3426b5 to
d6b8c6a
Compare
|
I'm splitting features declaration in #14151 |
d6b8c6a to
c42ea45
Compare
6d2938a to
a3ab0fd
Compare
a3ab0fd to
6eb85e5
Compare
|
|
|
Rebased and renamed the |
|
please squash |
4d12f4a to
7fa48d3
Compare
|
I approved the requested changes, but this doesn't count as an ACK because some commits are mine. I will block to avoid accidental merges |
jia200x
left a comment
There was a problem hiding this comment.
Intentional block to avoid accidental merges :)
This adds a target to print all features provided computed from Kconfig files for a given board.
The symbol now is HAS_PERIPH_WDT_WARNING_PERIOD.
7fa48d3 to
42e521b
Compare
MrKevinWeiss
left a comment
There was a problem hiding this comment.
Assuming documentation for HAS_ and MODULE_ get added to the documentation in a separate
PR, I ACK!
|
Thanks all for reviewing and testing! |
this now forces all features to be added to both Makefiles and kconfig, right? |
|
Yes, it is to keep sync with boards that already have the Kconfig symbols. |
|
#13404 (comment) was this addressed? Is |
| include ../Makefile.tests_common | ||
|
|
||
| BOARD_WHITELIST += samr21-xpro | ||
|
|
||
| kconfig-features: | ||
| @bash -c 'diff <($(MAKE) info-features-provided) \ | ||
| <($(MAKE) dependency-debug-features-provided-kconfig) || \ | ||
| (echo "ERROR: Kconfig features mismatch" && exit 1)' | ||
|
|
||
| all: kconfig-features | ||
|
|
||
| include $(RIOTBASE)/Makefile.include |
There was a problem hiding this comment.
I think this test should be extended to cover other variables in makefiles/dependencies_debug.inc.mk that intrinsically related to provided variables, so from what is missing BOARD CPU CPU_MODEL CPU_ARCH CPU_FAM.
Contribution description
This PR models the
FEATURES_PROVIDEDas Kconfig symbols. The idea is, similarly to the currentMakefile.features, to select the provided features at every level (i.e. board, CPU model, CPU series, etc.).Incpu/Kconfigandboard/KconfigI declared common CPU and board symbols, which take their value depending on the selected CPU model and board respectively. Here I proposed to haveBOARD,CPU_MODEL,CPU_SERIES,CPU_FAMILYandCPU_ARCH(more specific to less specific), plusCPUwhich matches the currentCPUvariable. We should evaluate if that cover our use cases properly.The selection of symbols starts with the board and goes like:Although this chain of symbols tries to mirror the common symbols, nothing prevents use from using other intermediate symbols (e.g. here I addedCPU_ARCH_CORTEX_M0PLUSwhich selectsCPU_ARCH_CORTEX_M).Done in #13715.
On features
I addedcpu/Kconfig.featuresfor the declaration of common feature-like symbols. For features specific to a CPU, board or architecture we can declare them directly on the corresponding Kconfig file. Here I used theHAS_prefix to indicate features, mostly because it is customary in Kconfig files across projects, but we could use something else.Done in #14151.
In the future, we could also indicate via this mechanism that, for instance, the
CPU_MODEL_SAMD21G18Apresents an at86rf233 radio.Testing procedure
I added the
debug-features-provided-kconfigtarget independencies_debug.inc.mk, which should print the same list asinfo-features-provided, and will allow us to test the migration process. To test it, make sure you setSHOULD_RUN_KCONFIG=1.Also, one can run
make menuconfigand either enable the 'show-all mode' (by pressinga) or search for a particular feature symbol (by presing/), likeHAS_PERIPH_GPIO. Once the symbol is selected, one can see more information on the symbol (by pressing?), like the description of the feature and who selects (provides) it (the board, the cpu model, etc.).Edit: A test
tests/kconfig_featureshas been added to check that boards provide the same features via Kconfig and viaMakefile.features. This is useful during migration process to ensure sync.Issues/PRs references
Depends on #14151