Skip to content
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

Merged
merged 4 commits into from
Sep 30, 2021

Conversation

fjmolinas
Copy link
Contributor

Contribution description

This PR provides Kconfig dependencies modeling for nrf52 and two nrf52 BOARDs.

Testing procedure

  • check the modeling
  • murdock should do
  • look at menuconfig

Issues/PRs references

Split out of #16780

@fjmolinas fjmolinas added the Area: Kconfig Area: Kconfig integration label Sep 10, 2021
@github-actions github-actions bot added Area: boards Area: Board ports Area: CI Area: Continuous Integration of RIOT components Area: cpu Area: CPU/MCU ports Area: drivers Area: Device drivers Area: tests Area: tests and testing framework Platform: ARM Platform: This PR/issue effects ARM-based platforms Platform: native Platform: This PR/issue effects the native platform labels Sep 10, 2021
@MrKevinWeiss MrKevinWeiss self-requested a review September 13, 2021 08:40
@MrKevinWeiss
Copy link
Contributor

Is guess this depends on #16836

Comment on lines 18 to 36
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
Copy link
Member

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.

Copy link
Contributor Author

@fjmolinas fjmolinas Sep 19, 2021

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.

Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor

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

Copy link
Contributor

@leandrolanzieri leandrolanzieri left a 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

Comment on lines 15 to 16
config MODULE_SAUL_DEFAULT
select MODULE_SAUL_NRF_TEMPERATURE
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed

config MODULE_BOARDS_COMMON_NRF52XXDK
bool
default y
select MODULE_SAUL_GPIO if MODULE_SAUL_DEFAULT && HAS_PERIPH_GPIO
Copy link
Contributor

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.

Copy link
Contributor

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.

config HAVE_LIS2DH12
bool
select MODULE_LIS2DH12 if MODULE_SAUL_DEFAULT
help
Indicates that a lisdh12 is present

Copy link
Contributor

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.

Comment on lines 18 to 36
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
Copy link
Contributor

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

@leandrolanzieri
Copy link
Contributor

I think this needs rebasing now

@github-actions github-actions bot removed Area: tests Area: tests and testing framework Platform: native Platform: This PR/issue effects the native platform labels Sep 22, 2021
@fjmolinas
Copy link
Contributor Author

Rebased and I think I implemented your suggestions @jia200x and @leandrolanzieri.

@fjmolinas
Copy link
Contributor Author

Since you suggested radio dependencies to be in CPU I moved the Makefile.dep as well...

config MODULE_BOARDS_COMMON_NRF52XXDK
bool
default y
select MODULE_SAUL_GPIO if MODULE_SAUL_DEFAULT && HAS_PERIPH_GPIO
Copy link
Contributor

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.

@@ -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
Copy link
Contributor

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.

Copy link
Contributor Author

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

cpu/nrf52/Kconfig Outdated Show resolved Hide resolved
cpu/nrf52/periph/Kconfig Outdated Show resolved Hide resolved
cpu/nrf52/periph/Kconfig Outdated Show resolved Hide resolved
cpu/nrf52/radio/Kconfig Outdated Show resolved Hide resolved
cpu/nrf5x_common/radio/Kconfig.nrf5x Show resolved Hide resolved
cpu/nrf5x_common/radio/Kconfig.nrf5x Show resolved Hide resolved
cpu/nrf52/Kconfig Outdated Show resolved Hide resolved
@leandrolanzieri
Copy link
Contributor

Let's give it a try with the CI

@leandrolanzieri leandrolanzieri added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Sep 28, 2021
@fjmolinas
Copy link
Contributor Author

I'm seeing some unrelated failures, but lets let it run, if those are the only failures I could squash afterwards...

@leandrolanzieri leandrolanzieri added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Sep 28, 2021
@fjmolinas
Copy link
Contributor Author

Finally green! Ok to squash @leandrolanzieri?

@leandrolanzieri
Copy link
Contributor

Finally green! Ok to squash @leandrolanzieri?

Please go ahead

@fjmolinas fjmolinas added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Sep 29, 2021
@leandrolanzieri leandrolanzieri added Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines Reviewed: 2-code-design The code design of the PR was reviewed according to the maintainer guidelines Reviewed: 3-testing The PR was tested according to the maintainer guidelines Reviewed: 4-code-style The adherence to coding conventions by the PR were reviewed according to the maintainer guidelines Reviewed: 5-documentation The documentation details of the PR were reviewed according to the maintainer guidelines Type: new feature The issue requests / The PR implemements a new feature for RIOT labels Sep 30, 2021
@leandrolanzieri leandrolanzieri added this to the Release 2022.01 milestone Sep 30, 2021
Copy link
Contributor

@leandrolanzieri leandrolanzieri left a 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!

@leandrolanzieri leandrolanzieri merged commit b160e43 into RIOT-OS:master Sep 30, 2021
@fjmolinas fjmolinas deleted the pr_kconfig_nrf52 branch September 30, 2021 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: boards Area: Board ports Area: CI Area: Continuous Integration of RIOT components Area: cpu Area: CPU/MCU ports Area: drivers Area: Device drivers Area: Kconfig Area: Kconfig integration CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ARM Platform: This PR/issue effects ARM-based platforms Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines Reviewed: 2-code-design The code design of the PR was reviewed according to the maintainer guidelines Reviewed: 3-testing The PR was tested according to the maintainer guidelines Reviewed: 4-code-style The adherence to coding conventions by the PR were reviewed according to the maintainer guidelines Reviewed: 5-documentation The documentation details of the PR were reviewed according to the maintainer guidelines Type: new feature The issue requests / The PR implemements a new feature for RIOT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants