cpu/nrf52: initial kconfig modeling (no netif) #16837
cpu/nrf52: initial kconfig modeling (no netif) #16837leandrolanzieri merged 4 commits intoRIOT-OS:masterfrom
Conversation
|
Is guess this depends on #16836 |
boards/common/nrf52/Kconfig
Outdated
| choice | ||
| bool "Backend" | ||
| depends on MODULE_NETDEV_DEFAULT | ||
| default NRF802154 | ||
| default NRFBLE | ||
|
|
||
| config NRF802154 | ||
| bool "nrf802154" | ||
| select MODULE_NRF802154 | ||
|
|
||
| config NRFBLE | ||
| bool "nrfble" | ||
| select MODULE_NRFBLE | ||
|
|
||
| config NRFMIN | ||
| bool "nrfmin" | ||
| select MODULE_NRFMIN | ||
|
|
||
| endchoice |
There was a problem hiding this comment.
I propose here a couple of changes:
- This should probably be in
cpu/nrf52 - I think we should define an aux symbol for this radio (e.g NRF52_RADIO) that declares a feature (HAVE_NRF52RF_RADIO). This one can be set to
yif MODULE_NETDEV_DEFAULT is present. Then, the backend selection depends on HAVE_NRF52_RADIO.
There was a problem hiding this comment.
* This should probably be in `cpu/nrf52`
Ups, yes of course.
* I think we should define an aux symbol for this radio (e.g NRF52_RADIO) that declares a feature (HAVE_NRF52RF_RADIO). This one can be set to `y` if MODULE_NETDEV_DEFAULT is present. Then, the backend selection depends on HAVE_NRF52_RADIO.
I don't understand why the auxiliary symbol needs to be used seems like a weird dependency. I don't see why HAVE_NRF52RF_RADIO would depend on NETDEV_DEFAULT either, if it's a feature it should always be selected. Maybe if you can add a code snipped I can understand better your suggestion.
There was a problem hiding this comment.
ping @leandrolanzieri I think this was the thing we were talking about.
There was a problem hiding this comment.
I started #16845 with the HAVE_* but think maybe that is not the best way to move forward. I think the stage of discussion we are at is:
The boards/cpu can select things based on other modules enabled (in my case STDIO, in your case NETDEV_DEFAULT) if selecting is simple and don't have many dependencies or so many options.
The HAVE_* is like FEATURES_PROVIDED for the features that are not provided in the makefile.
I am still pretty murky of the issues that can arise so it may be good to get together and work through the corner cases.
There was a problem hiding this comment.
According to what I see in the Makefile.dep, the selection of these modules depends on CPU_MODEL, I think it might have to do with having HAS_RADIO_NRF802154 but I'm not sure, as this is done by model name so far.
I think it makes sense to have a symbol like jose proposes, which selects a module that will enable this choice. I'm thinking of something in the direction of:
config HAVE_NRF52_RADIO
bool
select MODULE_NRF52_RADIO if MODULE_NETDEV_DEFAULT
help
Indicates that an NRF52 radio is present.
menuconfig MODULE_NRF52_RADIO
bool "NRF52 radio driver"
depends on HAVE_NRF52_RADIO
depends on TEST_KCONFIG
if MODULE_NRF52_RADIO
choice
bool "NRF52 radio backend"
config NRF802154
bool "nrf802154"
select MODULE_NRF802154
config NRFBLE
bool "nrfble"
select MODULE_NRFBLE
config NRFMIN
bool "nrfmin"
select MODULE_NRFMIN
endchoice
endif
leandrolanzieri
left a comment
There was a problem hiding this comment.
Thanks for this! Some initial thoughts
boards/common/nrf52/Kconfig
Outdated
| config MODULE_SAUL_DEFAULT | ||
| select MODULE_SAUL_NRF_TEMPERATURE |
There was a problem hiding this comment.
MODULE_SAUL_NRF_TEMPERATURE is already defined in drivers/saul/Kconfig.
Maybe we can follow here the 'feature selects module` approach?
config HAVE_SAUL_NRF_TEMPERATURE
bool
select MODULE_SAUL_NRF_TEMPERATURE if MODULE_SAUL_DEFAULT && HAS_PERIPH_TEMPERATURE
help
Indicates that a SAUL wrapper to the temperature peripheral is present.
boards/common/nrf52xxxdk/Kconfig
Outdated
| config MODULE_BOARDS_COMMON_NRF52XXDK | ||
| bool | ||
| default y | ||
| select MODULE_SAUL_GPIO if MODULE_SAUL_DEFAULT && HAS_PERIPH_GPIO |
There was a problem hiding this comment.
Enabling MODULE_SAUL_GPIO when MODULE_SAUL_DEFAULT is done already in drivers/saul/Kconfig if HAVE_SAUL_GPIO is provided.
There was a problem hiding this comment.
I still think this is not needed.
boards/dwm1001/Kconfig
Outdated
| config HAVE_LIS2DH12 | ||
| bool | ||
| select MODULE_LIS2DH12 if MODULE_SAUL_DEFAULT | ||
| help | ||
| Indicates that a lisdh12 is present | ||
|
|
There was a problem hiding this comment.
I think this feature should be placed in drivers/lisdh12/Kconfig and selected by the boards that have the device.
boards/common/nrf52/Kconfig
Outdated
| choice | ||
| bool "Backend" | ||
| depends on MODULE_NETDEV_DEFAULT | ||
| default NRF802154 | ||
| default NRFBLE | ||
|
|
||
| config NRF802154 | ||
| bool "nrf802154" | ||
| select MODULE_NRF802154 | ||
|
|
||
| config NRFBLE | ||
| bool "nrfble" | ||
| select MODULE_NRFBLE | ||
|
|
||
| config NRFMIN | ||
| bool "nrfmin" | ||
| select MODULE_NRFMIN | ||
|
|
||
| endchoice |
There was a problem hiding this comment.
According to what I see in the Makefile.dep, the selection of these modules depends on CPU_MODEL, I think it might have to do with having HAS_RADIO_NRF802154 but I'm not sure, as this is done by model name so far.
I think it makes sense to have a symbol like jose proposes, which selects a module that will enable this choice. I'm thinking of something in the direction of:
config HAVE_NRF52_RADIO
bool
select MODULE_NRF52_RADIO if MODULE_NETDEV_DEFAULT
help
Indicates that an NRF52 radio is present.
menuconfig MODULE_NRF52_RADIO
bool "NRF52 radio driver"
depends on HAVE_NRF52_RADIO
depends on TEST_KCONFIG
if MODULE_NRF52_RADIO
choice
bool "NRF52 radio backend"
config NRF802154
bool "nrf802154"
select MODULE_NRF802154
config NRFBLE
bool "nrfble"
select MODULE_NRFBLE
config NRFMIN
bool "nrfmin"
select MODULE_NRFMIN
endchoice
endif
|
I think this needs rebasing now |
c50bddb to
15db122
Compare
|
Rebased and I think I implemented your suggestions @jia200x and @leandrolanzieri. |
|
Since you suggested radio dependencies to be in CPU I moved the Makefile.dep as well... |
boards/common/nrf52xxxdk/Kconfig
Outdated
| config MODULE_BOARDS_COMMON_NRF52XXDK | ||
| bool | ||
| default y | ||
| select MODULE_SAUL_GPIO if MODULE_SAUL_DEFAULT && HAS_PERIPH_GPIO |
There was a problem hiding this comment.
I still think this is not needed.
boards/e104-bt5010a-tb/Makefile.dep
Outdated
|
|
||
| # use nrfmin for GNRC as nimble is too large for the board | ||
| include $(RIOTBOARD)/common/nrf52/Makefile.nrfmin.dep | ||
| include $(RIOTCPU)/nrf52/Makefile.nrfmin.dep |
There was a problem hiding this comment.
The static tests don't like this.
There was a problem hiding this comment.
lets see if I addressed it
|
Let's give it a try with the CI |
|
I'm seeing some unrelated failures, but lets let it run, if those are the only failures I could squash afterwards... |
|
Finally green! Ok to squash @leandrolanzieri? |
Please go ahead |
Using imply allow for user to deselect the default MTD backends
045d857 to
3e4b35c
Compare
leandrolanzieri
left a comment
There was a problem hiding this comment.
Thanks again @fjmolinas for tackling this one. Modelling looks good and the CI agrees -> ACK!
Contribution description
This PR provides Kconfig dependencies modeling for nrf52 and two nrf52 BOARDs.
Testing procedure
Issues/PRs references
Split out of #16780