-
Notifications
You must be signed in to change notification settings - Fork 2k
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
cpu/nrf52: initial kconfig modeling (no netif) #16837
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
y
if MODULE_NETDEV_DEFAULT is present. Then, the backend selection depends on HAVE_NRF52_RADIO.
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.
* 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping @leandrolanzieri I think this was the thing we were talking about.
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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.
addressed
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think this is not needed.
boards/e104-bt5010a-tb/Makefile.dep
Outdated
@@ -1,5 +1,5 @@ | |||
USEMODULE += boards_common_e104_bt50xxa_tb | |||
|
|||
# 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The static tests don't like this.
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.
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
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.
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