-
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
boards: examples: tests: refactor the way boards providing netif is defined #11676
boards: examples: tests: refactor the way boards providing netif is defined #11676
Conversation
examples/default/Makefile
Outdated
openmote-cc2538 pba-d-01-kw2x remote-pa remote-reva samr21-xpro \ | ||
spark-core telosb yunjia-nrf51822 z1 | ||
|
||
ifneq (,$(filter $(BOARD),$(BOARD_PROVIDES_NETIF))) |
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.
Discussing this @fjmolinas offline and this is changing the previous behaviour: this application is not built for boards not providing a netif which was the case previously. So we still need BOARD_PROVIDES_NETIF
here...
b26f6a6
to
4df31f0
Compare
Going for However for the issue in It is something I am also interested in but that I keep for after #9913 |
examples/default/Makefile
Outdated
|
||
ifneq (,$(filter $(BOARD),$(BOARD_PROVIDES_NETIF))) | ||
# Use modules for networking | ||
FEATURES_REQUIRED += netif |
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.
Is not the 'FEATURES_REQUIRED' supposed to be in a dependency of one of the used module ?
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.
Maybe but which one ? ;)
I wanted to put this as a dependency of gnrc_netif
or netdev_default
but the problem then is that it will be difficult to build an application for a board where one wires manually an external radio. That's why I left it at the application level.
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.
Maybe but which one ? ;)
I would say netdev_default
as it is the one that pulls the radio in boards/board/Makefile.dep
but maybe gnrc_netif
is better suited. @miri64 knows better than me.
I wanted to put this as a dependency of gnrc_netif or netdev_default but the problem then is that it will be difficult to build an application for a board where one wires manually an external radio. That's why I left it at the application level.
If you wire an external radio, it is for me a "different" board. And you need to write you external radio configuration too
boards/hamilton/include/board.h: * @name AT86RF233 configuration
boards/hamilton/include/board.h:#define AT86RF2XX_PARAM_SPI SPI_DEV(0)
boards/hamilton/include/board.h:#define AT86RF2XX_PARAM_SPI_CLK SPI_CLK_5MHZ
boards/hamilton/include/board.h:#define AT86RF2XX_PARAM_CS GPIO_PIN(PB, 31)
boards/hamilton/include/board.h:#define AT86RF2XX_PARAM_INT GPIO_PIN(PB, 0)
boards/hamilton/include/board.h:#define AT86RF2XX_PARAM_SLEEP GPIO_PIN(PA, 20)
boards/hamilton/include/board.h:#define AT86RF2XX_PARAM_RESET GPIO_PIN(PB, 15)
So would need to have some files adapted.
However, for me the re-use of a board or modifying a board is its own topic. Something I would like but has lots of dependencies #11674
Is it possible to "modify" a board from an application Makefile ? not entirely as it does not define Makefile.include
and Makefile.dep
that are parsed with the others.
That last point could be addressed. To include $(APPDIR)/Makefile.features
, $(APPDIR)/Makefile.include
and $(APPDIR)/Makefile.dep
in they exist.
However it would not currently entirely work currently due to the hacks:
RIOT/boards/common/nrf52/Makefile.include
Lines 12 to 23 in 761530c
# The following configuration is dependencies specific | |
# but they are resolved later | |
# Hack to know now if 'nordic_softdevice_ble' is used | |
include $(RIOTBOARD)/$(BOARD)/Makefile.dep | |
PROGRAMMER ?= jlink | |
ifeq (jlink,$(PROGRAMMER)) | |
# setup JLink for flashing | |
export JLINK_DEVICE := nrf52 | |
# special options when using SoftDevice | |
ifneq (,$(filter nordic_softdevice_ble,$(USEPKG))) |
The hacks will be able to be removed after #9913 if we can move forward with #11478
I started with |
The not available could be solved by doing |
Question, if However RIOT/boards/nrf52dk/Makefile.dep Lines 4 to 6 in 761530c
|
I think the best would be to put the |
@cladmi, I've reworked a bit this PR to add a mecanism where drivers can provide high level features. Now only networking related features (netif, radio_802154, radio_lora) are provided. I'm not sure about the integration in the build system though. I know there's room for improvements but I'd like to have your opinion if possible. |
Interestingly, the number of jobs has dropped from 38860 to 34538. This is because now applications requiring |
makefiles/info-global.inc.mk
Outdated
@@ -28,6 +28,9 @@ define board_missing_features | |||
|
|||
include $(RIOTBASE)/Makefile.dep | |||
|
|||
# Include provided features from drivers after all dependencies are known | |||
include $(RIOTBASE)/drivers/Makefile.features |
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.
If it is "features" it should be included in Makefile.features
.
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 features provided by (radio) drivers must already know the driver modules used in the application. Because of this Makefile.features
has to be included after Makefile.dep
. I don't know if we want this or not.
If I put the drivers/Makefile.features
file in the global Makefile.features
, I have to change a few things in Makefile.include that break the build. This is still unclear for me why.
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.
Indeed, I found why it does not work. I will explain in the main comments.
e1a2269
to
778f1f4
Compare
I slept on the concept and found what was the issue for me. A module cannot provide a feature. Providing a feature means that there is:
If on an arduino-mega2560, it is not because I use the I cannot enable Which means it is he role of the bsp/board to say "HEATURES_PROVIDED +=". And then, when the features is used it must select which implementation to use and which configuration (usually already defined in the board headers). Lines 880 to 881 in d5bdb5d
But here, it may need to be done by the board. |
I think we need to clarify a bit the concept of feature.
Why not if the module is about a driver. A driver could also provide the filesystem feature (SD card SPI), the saul feature, etc
Drivers provides hardware support, a specific (but overridable) configuration and modules to use them.
But the setup potentially have it. I admit it's not as automatic as for CPU peripherals with boards but I think it's worth having this mecanism. |
By doing this, "wiring" and "putting params" you add the radio to your board and you somehow modify your board.
If the module is a driver, without the hardware it does nothing. For the I know there may be cases where it could indeed be working "features rng" that you can provide as software but it is not the default case. |
The fact that it is possible or not to do it from the application directory (or outside of riot) is a different topic from what means feature. |
Any nucleo 64 board can be become a lora device by just plugging on it an mbed Lora shield. This is the same with x-nucleo-xxxx sensor shields, etc. It's not a different board, it's a different setup. Providing features from drivers takes advantages of the flexibility of build system modules to enable netif without changing a line of code in this case. |
That is what I call a different "board" in RIOT. If you may need to have a device mapping, I call it a different board as we store this in the board/periph_conf
Is this really wanted ? I do not fully understood yet what
This is currently not removed, so the refactoring does not get to the the goal yet. The fact that provided features depends on used modules really changes the way we currently handle features, and I do not like the direction.
Something I would prefer is that the The I would even try to use a specific pattern that does not use immediate evaluation, and maybe be declarative completely. At least I would prefer staying on the One other issue then, would be to be clear how should one include the radio module. |
I guess somehow we should then say, with maybe a helper function
or
Or do the recursive resolution at the end to another variable with a recursive
|
7195522
to
50adda4
Compare
The BOARD_PROVIDES_NETIF variable is now useless and can be removed
50adda4
to
89016d7
Compare
The Murdock build succeeded before I restarted it. I did restart Murdock for a random PR it previously succeed to verify that Murdock is currently having issues, which it apparently has :-/ |
As you may see, I have to parse dependencies before parsing the features, but also after. Which is quite ugly... |
Did you look at #12427? |
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. |
Ping @aabadie? |
Once module dependencies and provided features will be handled in Kconfig, I think it will be simpler to declare the availability of high-level features (or API features). So I'm closing this PR. |
Contribution description
This PR is RFC because I'm not 100% sure of the approach but the idea behind is to get rid of the
BOARDS_PROVIDES_NETIF
variables inexamples/default
andtests/netstat_l2
applications by using a specific feature for boards providing an interface (usingFEATURES_REQUIRED += <something>
). The<something>
should be generic enough to cover 802154, ble, lora, wifi, ethernet, etc and must be provided at board level, similar to other features.Using
netif
was the best choice but I realized it was already defined as a pseudomodule by the build system. And after looking a bit closer I realized it was not really useful.So the 3 first commits of this PR are just removing the existing
netif
pseudomodule.The rest of the commits are providing the
netif
to boards with an interface. The last 2 commits are just dropping theBOARDS_PROVIDES_NETIF
variables from the related application and useFEATURES_REQUIRED += netif
instead.This is simpler to maintain and IMHO way cleaner than the actual design.
Testing procedure
Issues/PRs references
None