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

drivers/atwinc15x0: add Kconfig #17382

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

gschorcht
Copy link
Contributor

@gschorcht gschorcht commented Dec 11, 2021

Contribution description

This PR adds Kconfig to the atwinc15x0 driver and contains the following changes:

  1. Kconfig file is added to atwinc15x0. If the driver is selected, it automatically selects the required driver_atwinc15x0 package.This corresponds to the makefile dependencies.
  2. An according Kconfig file is added to the test application tests/driver_atwinc15x0.
  3. Since the Makefile of the test application includes tests/driver_netdev_common/Makefile that enables all required modules, a Kconfig file is also added to tests/driver_netdev_common by commit 6befb7d.
  4. Commit ff37253 fixes the dependencies of the driver and the package in Kconfig. The driver_atwinc15x0 package is a helper package that is required for the atwinc15x0 driver module and cannot be used standalone. Therfore it should depend on the atwinc15x0 driver module and only be visible and force selected when the atwinc15x0 driver module is used.
  5. feather-m0-wifi has an ATWINC15x0 module on-board. The atwinc15x0 driver is enable by default if module netdev_default is used (commit 49fb6fa). This corresponds to the makefile dependencies.
  6. The feather-m0-wifi board is just a feather-m0 board with an additional ATWINC15x0 module. The feather-m0 is in fact a base board. The board definition of feather-m0 should be therefore reused. Kconfig should be defined on top of feather-m0 because it shares all its features (commit 06345e9). If this is agreed, the same should be done for feather- m0-lora.
  7. The atwinc15x0 driver is enabled by default if a board has an ATWINC15x0 module (HAVE_ATWINC15X0) and module netdev_default is enabled (commit 57fc6f8).

Testing procedure

  1. Compilation limited to the feather-m0-wifi board should succeed in CI.
  2. Use command
    TEST_KCONFIG=1 make BOARD=feather-m0-wifi -C tests/driver_atwinc15x0 info-modules
    
    and check that the following modules are used:
    atwinc15x0
    driver_atwinc15x0
    driver_atwinc15x0_common
    driver_atwinc15x0_spi_flash
    
  3. Use command
    TEST_KCONFIG=1 make BOARD=feather-m0-wifi -C tests/driver_atwinc15x0 menuconfig
    
    and check that
    Drivers ---> Network Device Drivers ---> ATWINC15x0 WiFi module
    
    is selected by default and can't be deselected.
    -*- ATWINC15x0 WiFi module  --->
    
  4. Go into the menu and check the input fields.
    (RIOT_AP) WiFi SSID
    [ ] Use WPA2 authentication
    
    Check Use WPA2 authentication
    (RIOT_AP) WiFi SSID
    [*] Use WPA2 authentication
    (This is RIOT-OS) Passphrase for WPA2 Personal Mode authentication (NEW)
    
    
  5. Use command
    TEST_KCONFIG=1 make BOARD=feather-m0-wifi -C tests/shell menuconfig
    
    and check that
    Drivers ---> Network Device Drivers ---> ATWINC15x0 WiFi module
    
    is not selected and can be selected.
    [ ] ATWINC15x0 WiFi module  ---
    

Issues/PRs references

Depends on PR #17381
Part of #16875

@github-actions github-actions bot added Area: boards Area: Board ports Area: drivers Area: Device drivers Area: Kconfig Area: Kconfig integration Area: pkg Area: External package ports Area: tests Area: tests and testing framework labels Dec 11, 2021
@gschorcht gschorcht added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Type: new feature The issue requests / The PR implemements a new feature for RIOT labels Dec 12, 2021
@github-actions github-actions bot added the Area: CI Area: Continuous Integration of RIOT components label Dec 12, 2021
select HAS_PERIPH_UART
select HAS_PERIPH_USBDEV
select HAS_HIGHLEVEL_STDIO
select BOARD_FEATHER_M0
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd preferably split common feather_m0 features into its own symbol in boards/feather-m0/Kconfig and select that instead. The BOARD_ symbols are usually used to identify which board is used and to set the default to BOARD. Although in this case BOARD should get the proper value because of the order of inclusion I find it cleaner if we want to factor this out.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we split the board Kconfig from this PR?

boards/feather-m0-wifi/Kconfig Outdated Show resolved Hide resolved
pkg/driver_atwinc15x0/Kconfig Show resolved Hide resolved
Comment on lines 11 to 12
imply MODULE_ATWINC15X0
imply DRIVER_NETDEV_COMMON
Copy link
Contributor

Choose a reason for hiding this comment

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

Application configurations of visible symbols are done through .config files. During migration we use a special name for testing.

# this file enables modules defined in Kconfig. Do not use this file for
# application configuration. This is only needed during migration.
CONFIG_MODULE_BMX280=y
CONFIG_MODULE_BME280_I2C=y
CONFIG_MODULE_FMT=y
CONFIG_MODULE_XTIMER=y

Copy link
Contributor Author

@gschorcht gschorcht Dec 12, 2021

Choose a reason for hiding this comment

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

I know. In the case of tests/driver_atwinc15x0, the Makefile is including a common Makefile.netdev.mk that is used by all netdev driver tests from tests/driver_netdev_common which enables all required modules.

Therefore, I was looking for a possibility to do the same in Kconfig. Since I found a Kconfig file in a number of tests, e.g. tests/periph_gpio, I thought that this could be the possible way because Kconfig can source other Kconfig files. Using app.config.test I have to enable all these modules, that have to enabled by each other netdev driver test application again and again:

CONFIG_MODULE_ATWINC15X0=y
CONFIG_MODULE_SHELL=y
CONFIG_MODULE_SHELL_COMMANDS=y
CONFIG_MODULE_PS=y
CONFIG_MODULE_GNRC=y
CONFIG_MODULE_AUTO_INIT_GNRC_NETIF=y
CONFIG_MODULE_GNRC_TXTSND=y
CONFIG_MODULE_GNRC_PKTDUMP=y

Furthermore, with these definitions I get errors for all GNRC modules. That's why I was asking in comment #13135 (comment) how to enable GNRC modules in Kconfig for testing.

[genconfig.py]:ERROR-Treating Kconfig warnings as errors:
[genconfig.py]:ERROR-=> /home/gs/src/RIOT-Xtensa-ESP.working/tests/driver_atwinc15x0/app.config.test:7: warning: attempt to assign the value 'y' to the undefined symbol MODULE_GNRC
[genconfig.py]:ERROR-=> /home/gs/src/RIOT-Xtensa-ESP.working/tests/driver_atwinc15x0/app.config.test:8: warning: attempt to assign the value 'y' to the undefined symbol MODULE_AUTO_INIT_GNRC_NETIF
[genconfig.py]:ERROR-=> /home/gs/src/RIOT-Xtensa-ESP.working/tests/driver_atwinc15x0/app.config.test:9: warning: attempt to assign the value 'y' to the undefined symbol MODULE_GNRC_TXTSND
[genconfig.py]:ERROR-=> /home/gs/src/RIOT-Xtensa-ESP.working/tests/driver_atwinc15x0/app.config.test:10: warning: attempt to assign the value 'y' to the undefined symbol MODULE_GNRC_PKTDUMP

Copy link
Contributor Author

@gschorcht gschorcht Dec 24, 2021

Choose a reason for hiding this comment

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

Application configurations of visible symbols are done through .config files.

If I understand it right

  • FEATURES_REQUIRED += xyz is modeled in app.config.test as CONFIG_MODULE_XYZ = y
  • FEATURES_OPTIONAL += xyz is modeled as part of config APPLICATION in Kconfig as imply MODULE_XYZ
  • USEMODULE += xyz is modeled in app.config.test as CONFIG_MODULE_XYZ = y

How could it be modeled that tests/driver_atwinc15x0/Makefile includes a common tests/driver_netdev_common/Makefile.netdev.mk that is used by all netdev driver tests to enable all required modules and to avoid to do it again and again for each netdev driver test? Would it be correct to model it like in 6581176 and d8b5a1c?

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 the way would be to have a .config file and add it to the loaded configurations by adding it to the list of the KCONFIG_ADD_CONFIG makefile variable.

select MODULE_PERIPH_GPIO
select MODULE_PERIPH_GPIO_IRQ
select MODULE_PERIPH_SPI
select MODULE_NETDEV_ETH
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm sorry but I think this is not modelled yet. That's the main reason we did not move yet to modelling networking drivers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

drivers/net/netdev seems not to be so much complicated. Since there were no error messages, maybe we should keep it so it won't be forgotten later?

drivers/atwinc15x0/Kconfig Outdated Show resolved Hide resolved
drivers/atwinc15x0/Kconfig Show resolved Hide resolved
@gschorcht gschorcht force-pushed the drivers/atwinc15x0/Kconfig branch 2 times, most recently from e49d21d to d8b5a1c Compare December 24, 2021 12:35
@github-actions github-actions bot removed the Area: boards Area: Board ports label Dec 24, 2021
@gschorcht gschorcht force-pushed the drivers/atwinc15x0/Kconfig branch 4 times, most recently from 766e792 to ca957cd Compare December 26, 2021 14:45
@gschorcht gschorcht added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Dec 27, 2021
@github-actions github-actions bot removed the Area: CI Area: Continuous Integration of RIOT components label Dec 27, 2021
@github-actions github-actions bot added Area: cpu Area: CPU/MCU ports Area: sys Area: System Platform: ARM Platform: This PR/issue effects ARM-based platforms labels Dec 29, 2021
Just for test compilations in CI.
@aabadie
Copy link
Contributor

aabadie commented Jan 5, 2022

This PR contains lots of changes related to modeling netdev drivers in Kconfig that would be worth adding in a separate PR. For the moment they are in a test app but they should move to each related module Kconfig files. @gschorcht do you plan to add them ?

@gschorcht
Copy link
Contributor Author

To be honest, I don't know what @leandrolanzieri's plans for netdev driver modeling are. I just made everything available that is needed by any netdev default in tests/driver_netdev_common to get Murdock happy. Most of them aren't needed for the ATWINC15x0 Kconfig. But tests/driver_netdev_common with all these definitions might help to start with adding real definitions in all these moduels and removing them there step by step.

@aabadie
Copy link
Contributor

aabadie commented Jan 6, 2022

To be honest, I don't know what @leandrolanzieri's plans for netdev driver modeling are. I just made everything available that is needed by any netdev default in tests/driver_netdev_common to get Murdock happy.

I don't know either what are his plans but here I see that you made the Kconfig modeling job, it just needs to be moved to the right places. Once done, that would be a big step for the Kconfig migration, so very useful IMHO.

@gschorcht
Copy link
Contributor Author

Kconfig modeling job, it just needs to be moved to the right places.

That's true for a number of these definitions. For others, however, it is necessary to model configuration parameters that may require more detailed knowledge about the according modules, e.g. nimble.

@@ -7,7 +7,7 @@

config HAVE_NRF5X_RADIO
bool
select NRF5X_RADIO if MODULE_NETDEV_DEFAULT
select NRF5X_RADIO if MODULE_NETDEV_DEFAULT && !PACKAGE_NIMBLE
Copy link
Contributor

Choose a reason for hiding this comment

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

@fjmolinas can you check if this is needed?

Copy link
Contributor

Choose a reason for hiding this comment

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

Nimble has not been modeled so far, but what should be done is change the default NRF5X_RADIO backend if using Nimble no? I think something like this:

diff --git a/cpu/nrf5x_common/radio/Kconfig.nrf5x b/cpu/nrf5x_common/radio/Kconfig.nrf5x
index c98a0059b6..05ca54067b 100644
--- a/cpu/nrf5x_common/radio/Kconfig.nrf5x
+++ b/cpu/nrf5x_common/radio/Kconfig.nrf5x
@@ -22,6 +22,7 @@ if NRF5X_RADIO

 choice NRF5X_RADIO_BACKEND
     bool "nrf5x radio backend"
+    default MODULE_NRFBLE if PACKAGE_NIMBLE

 config MODULE_NRF802154
     bool "Implementation of the IEEE 802.15.4 for nRF52 radio"

Copy link
Contributor

Choose a reason for hiding this comment

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

If when using nimble the backend is fixed, then we should also hide the prompt, so it cannot be changed.

Copy link
Contributor

Choose a reason for hiding this comment

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

True

Comment on lines +29 to +50
config WIFI_SSID
string "WiFi SSID"
default "RIOT_AP"
help
SSID of the AP to be used. The SSID must not contain more
than 32 characters.

config WIFI_USE_WPA2
bool "Use WPA2 authentication"
default n
help
Specify whether WPA2 authentication is used to connect to the
AP. If WPA2 authentication is enabled, the passphrase has to be
defined.

config WIFI_PASS
string "Passphrase for WPA2 Personal Mode authentication"
depends on WIFI_USE_WPA2
default "This is RIOT-OS"
help
The passphrase is defined as a clear text string with a maximum
of 64 characters. It is used for WPA2 personal mode authentication.
Copy link
Contributor

Choose a reason for hiding this comment

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

Definitely outside the scope of this PR, but at some point we need to handle this system-wide and not driver-specific.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm, this seems to be a hen's egg problem because it is required for the compilation of the driver.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, as it is currently done. Perhaps we can think about some key management (something similar to credman?). Would it be possible (on a separate PR) to start unifying the macro name and have one system-wide for other modules (e.g., ESP)?


config WIFI_USE_WPA2
bool "Use WPA2 authentication"
default n
Copy link
Contributor

Choose a reason for hiding this comment

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

default n is the default behaviour, no need to specify it.

Comment on lines +161 to +162
#WIFI_SSID | "RIOT_AP" | SSID of the AP to be used.
#WIFI_PASS | - | Passphrase used for the AP as clear text (max. 64 chars) [1].
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd suggest to migrate these values to include the CONFIG_ prefix

Copy link
Contributor Author

@gschorcht gschorcht Jan 18, 2022

Choose a reason for hiding this comment

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

My concern is that user applications may have already used these documented configuration settings. We can change them but we should have some deprecation mechanism which. My approach was to use it in that way

#ifndef WIFI_SSID
#ifndef CONFIG_WIFI_SSID
#define WIFI_SSID       "RIOT_AP"
#else /* CONFIG_WIFI_SSID */
#define WIFI_SSID       CONFIG_WIFI_SSID
#endif /* CONFIG_WIFI_SSID */
#endif /* WIFI_SSID */

which allows to use both definitions.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, we should add a deprecation warning if we change them. It already has been done with other configurations (e.g., #13129).

@@ -16,7 +16,7 @@ if MODULE_RANDOM
choice RANDOM_IMPLEMENTATION
bool "PRNG Implementation"
depends on TEST_KCONFIG
default MODULE_PRNG_HWRNG if HAS_PERIPH_HWRNG
default MODULE_PRNG_HWRNG if HAS_PERIPH_HWRNG && !MODULE_NETDEV_DEFAULT
Copy link
Contributor

Choose a reason for hiding this comment

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

why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To be honest, I don't remember but there was a problem when module netdev_default is used.

select MODULE_PS

# gnrc is a meta module including all required, basic gnrc networking modules
select MODULE_GNRC
Copy link
Contributor

Choose a reason for hiding this comment

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

If we need the stack modelled to enable this application then we should do it properly first. As @aabadie mentions, all these modules should be on their own files. Networking is the next big step in the migration.

I wonder if it is actually possible to use the driver without GNRC, in that case we could test the driver modelling alone.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As @aabadie mentions, all these modules should be on their own files.

That is clear. It was just an attempt to test the netdev driver Kconfigs before the modeling of the network stack is complete. I was able to get green CI with them. As said, I thought that tests/driver_netdev_common with all these dummy definitions might help to model network related drivers and models step by step and remove them from tests/driver_netdev_common once they are modeled.

I wonder if it is actually possible to use the driver without GNRC, in that case we could test the driver modelling alone.

Since the feather-m0-wifi board uses the driver as netdev_default, which in turn is activated by all GNRC applications, you will not be able to successfully compile these applications into CI without it being modeled somehow, even if it is a dummy definition to begin with.

Copy link
Contributor

Choose a reason for hiding this comment

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

Since the feather-m0-wifi board uses the driver as netdev_default, which in turn is activated by all GNRC applications, you will not be able to successfully compile these applications into CI without it being modeled somehow, even if it is a dummy definition to begin with.

But couldn't we model just the driver + netdev without GNRC? We would not test GNRC-based applications but at least the one from the driver, right? AFAIU netdev_default should not pull the stack.

Copy link
Contributor

Choose a reason for hiding this comment

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

@gschorcht regarding this point, what I'm attempting for Ethernet (#17739) and IEEE 802.15.4 (#17789) is to change the tests to use the driver and netdev only, without pulling any stack.

Comment on lines +38 to +52
config MODULE_NETDEV
bool
default y if BOARD_ATXMEGA_A1_XPLAINED && MODULE_NETDEV_DEFAULT
default y if BOARD_ATXMEGA_A3BU_XPLAINED && MODULE_NETDEV_DEFAULT
select MODULE_EUI_PROVIDER

config MODULE_NETDEV_ETH
bool
default y if HAS_PERIPH_ETH
select MODULE_NATIVE_CLI_EUI_PROVIDER if BOARD_NATIVE
select MODULE_NETDEV
select MODULE_NETDEV_REGISTER if !MODULE_GNRC_NETIF_SINGLE

select MODULE_STM32_ETH if HAS_PERIPH_ETH && HAS_CPU_STM32 && !MODULE_ATWINC15X0
select MODULE_SAM0_ETH if HAS_PERIPH_ETH && HAS_CPU_SAMD5X && !MODULE_ATWINC15X0
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this is here just for testing, but we can use it as a starting point.

As I understand the current modules, MODULE_NETDEV_DEFAULT will only enable networking devices that are declared by the board (via HAVE_ symbols). Each driver would select the required netdev module, which would in turn select the generic netdev module. I don't think there is need to actually add prompts to these netdev modules, as they are needed.

Perhaps we need one more abstraction between driver module and netdev module, as some devices work without netdev (e.g., they use the IEEE802154 radio HAL). In that case the device would select instead a HAVE_IEEE802154_DEVICE or so, and the selection of the netdev may be optional if the driver supports something else than the netdev interface.

Copy link
Contributor

Choose a reason for hiding this comment

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

Although highly outdated (both name schemes and some patterns), #14055 did some modelling in this direction, both netdev and IEEE802154-related GNRC modules. Note that the netdev modules had prompt in that proposal, but I'd not go with that now.

@stale
Copy link

stale bot commented Sep 21, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.

@stale stale bot added the State: stale State: The issue / PR has no activity for >185 days label Sep 21, 2022
@gschorcht gschorcht removed the State: stale State: The issue / PR has no activity for >185 days label Sep 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: cpu Area: CPU/MCU ports Area: doc Area: Documentation Area: drivers Area: Device drivers Area: Kconfig Area: Kconfig integration Area: pkg Area: External package ports Area: sys Area: System Area: tests Area: tests and testing framework CI: full build disable CI build filter 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 Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation 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