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

Makefile.features: introduce FEATURES_COMPATIBLE_feature += feature_2 #12427

Closed

Conversation

cladmi
Copy link
Contributor

@cladmi cladmi commented Oct 11, 2019

Contribution description

This introduces a new concept that a feature can declare other feature it provides. I used the name "compatible" here as we just heard about the 'compatible' string in device trees.

Naming can be changed of course.
I used here 'driver_DRIVERNAME' to allow automatic mapping to the module, but not sure I like it.

This currently means that we do

FEATURES_COMPATIBLE_driver_at86rf231 = driver_at86rf2xx
FEATURES_COMPATIBLE_driver_at86rf2xx = radio_802154
FEATURES_COMPATIBLE_radio_802154 = netif

The handling is correct and complete but could still get some refinement.
It is just a 2 hours version.

Drivers and examples are at example state but give the idea of what should be done.

This currently breaks info-boards-supported by making really really slow do not build with CI !!! fixed by using 'FEATURES_COMPATIBLE_name = auie'

Testing procedure

Requesting a "child" feature, correctly triggers the inclusion of the "parent" features.

In examples/hello_world:

FEATURES_OPTIONAL=netif BOARD=iotlab-m3 make info-debug-variable-USEMODULE
at86rf231 at86rf2xx auto_init board boards_common_iotlab core core_msg cortexm_common cortexm_common_periph cpu div ieee802154 luid netdev_ieee802154 netif newlib newlib_nano newlib_syscalls_default periph periph_common periph_cpuid periph_gpio periph_gpio_irq periph_pm periph_spi periph_timer periph_uart pm_layered prng prng_tinymt32 random stdio_uart stm32_common stm32_common_periph sys tinymt32 xtimer
With a lot of debugging variables showing each intermediat variables, and the `FEATURES_PROVIDERS_*` debug variables too.
FEATURES_OPTIONAL=netif BOARD=iotlab-m3 make info-debug-variable-FEATURES_PROVIDED info-debug-variable-FEATURES_COMPATIBLES info-debug-variable-FEATURES_COMPATIBLES_ONLY info-debug-variable-emptyline info-debug-variable-FEATURES_PROVIDERS_netif info-debug-variable-FEATURES_PROVIDERS_radio_802154 info-debug-variable-emptyline2 info-debug-variable-FEATURES_PROVIDERS_ALL_netif info-debug-variable-FEATURES_PROVIDERS_ALL_radio_802154 info-debug-variable-FEATURES_USED_EXPLICIT  info-debug-variable-FEATURES_USED info-debug-variable-emptyline3 info-debug-variable-USEMODULE
periph_i2c periph_rtt periph_spi periph_timer periph_uart riotboot driver_at86rf231 periph_dma periph_flashpage periph_flashpage_raw periph_cpuid periph_gpio periph_gpio_irq puf_sram periph_uart_modecfg periph_wdt periph_pm cpp cpu_check_address
cpp cpu_check_address driver_at86rf231 driver_at86rf2xx netif periph_cpuid periph_dma periph_flashpage periph_flashpage_raw periph_gpio periph_gpio_irq periph_i2c periph_pm periph_rtt periph_spi periph_timer periph_uart periph_uart_modecfg periph_wdt puf_sram radio_802154 riotboot
driver_at86rf2xx netif radio_802154

radio_802154
driver_at86rf2xx

radio_802154 driver_at86rf2xx driver_at86rf231
driver_at86rf2xx driver_at86rf231
netif periph_cpuid periph_gpio periph_gpio_irq periph_pm periph_spi periph_timer periph_uart
driver_at86rf231 driver_at86rf2xx netif periph_cpuid periph_gpio periph_gpio_irq periph_pm periph_spi periph_timer periph_uart radio_802154

at86rf231 at86rf2xx auto_init board boards_common_iotlab core core_msg cortexm_common cortexm_common_periph cpu div ieee802154 luid netdev_ieee802154 netif newlib newlib_nano newlib_syscalls_default periph periph_common periph_cpuid periph_gpio periph_gpio_irq periph_pm periph_spi periph_timer periph_uart pm_layered prng prng_tinymt32 random stdio_uart stm32_common stm32_common_periph sys tinymt32 xtimer

Try listing the modules for samr21-xpro, iotlab-m3 and mulle for tests/driver_at86rf2xx. The driver is selected without explicit value in the application.

BOARD=samr21-xpro make --no-print-directory -C tests/driver_at86rf2xx/ info-debug-variable-USEMODULE
BOARD=samr21-xpro make --no-print-directory -C tests/driver_at86rf2xx/ info-debug-variable-USEMODULE
at86rf233 at86rf2xx board core core_msg cortexm_common cortexm_common_periph cpu div fmt ieee802154 isrpipe luid netdev_ieee802154 netif newlib newlib_nano newlib_syscalls_default od periph periph_common periph_cpuid periph_gpio periph_gpio_irq periph_pm periph_spi periph_timer periph_uart pm_layered prng prng_tinymt32 ps random sam0_common_periph shell shell_commands stdin stdio_uart stdio_uart_rx sys tinymt32 tsrb xtimer

BOARD=iotlab-m3 make --no-print-directory -C tests/driver_at86rf2xx/ info-debug-variable-USEMODULE
at86rf231 at86rf2xx board boards_common_iotlab core core_msg cortexm_common cortexm_common_periph cpu div fmt ieee802154 isrpipe luid netdev_ieee802154 netif newlib newlib_nano newlib_syscalls_default od periph periph_common periph_cpuid periph_gpio periph_gpio_irq periph_pm periph_spi periph_timer periph_uart pm_layered prng prng_tinymt32 ps random shell shell_commands stdin stdio_uart stdio_uart_rx stm32_common stm32_common_periph sys tinymt32 tsrb xtimer

BOARD=mulle make --no-print-directory -C tests/driver_at86rf2xx/ info-debug-variable-USEMODULE
at86rf21b at86rf2xx board core core_msg cortexm_common cortexm_common_periph cpu devfs div fmt ieee802154 isrpipe luid mtd mtd_spi_nor netdev_ieee802154 netif newlib newlib_nano newlib_syscalls_default nvram nvram_spi od periph periph_common periph_cpuid periph_gpio periph_gpio_irq periph_hwrng periph_mcg periph_pm periph_rtt periph_spi periph_timer periph_uart periph_wdog posix_headers prng prng_tinymt32 ps random shell shell_commands stdin stdio_uart stdio_uart_rx sys tinymt32 tsrb vfs xtimer

In master it was the same

BOARD=samr21-xpro make --no-print-directory -C tests/driver_at86rf2xx/ info-debug-variable-USEMODULE
at86rf233 at86rf2xx board core core_msg cortexm_common cortexm_common_periph cpu div fmt ieee802154 isrpipe luid netdev_ieee802154 netif newlib newlib_nano newlib_syscalls_default od periph periph_common periph_cpuid periph_gpio periph_gpio_irq periph_pm periph_spi periph_timer periph_uart pm_layered prng prng_tinymt32 ps random sam0_common_periph shell shell_commands stdin stdio_uart stdio_uart_rx sys tinymt32 tsrb xtimer

BOARD=iotlab-m3 make --no-print-directory -C tests/driver_at86rf2xx/ info-debug-variable-USEMODULE
at86rf231 at86rf2xx board boards_common_iotlab core core_msg cortexm_common cortexm_common_periph cpu div fmt ieee802154 isrpipe luid netdev_ieee802154 netif newlib newlib_nano newlib_syscalls_default od periph periph_common periph_cpuid periph_gpio periph_gpio_irq periph_pm periph_spi periph_timer periph_uart pm_layered prng prng_tinymt32 ps random shell shell_commands stdin stdio_uart stdio_uart_rx stm32_common stm32_common_periph sys tinymt32 tsrb xtimer

BOARD=mulle make --no-print-directory -C tests/driver_at86rf2xx/ info-debug-variable-USEMODULE
at86rf212b at86rf2xx board core core_msg cortexm_common cortexm_common_periph cpu devfs div fmt ieee802154 isrpipe luid mtd mtd_spi_nor netdev_ieee802154 netif newlib newlib_nano newlib_syscalls_default nvram nvram_spi od periph periph_common periph_cpuid periph_gpio periph_gpio_irq periph_hwrng periph_mcg periph_pm periph_rtt periph_spi periph_timer periph_uart periph_wdog posix_headers prng prng_tinymt32 ps random shell shell_commands stdin stdio_uart stdio_uart_rx sys tinymt32 tsrb vfs xtimer

It finds unsatisfied features.

BOARD=native make --no-print-directory -C tests/driver_at86rf2xx/ 
There are unsatisfied feature requirements: driver_at86rf2xx periph_gpio_irq periph_spi


EXPECT ERRORS!


Building application "tests_driver_at86rf2xx" for "native" with MCU "native".

Issues/PRs references

Implementation of #11676 (comment)

Declare FEATURES_COMPATIBLES to describe provided features and
compatible features that are inherited.
This also adds
* FEATURES_COMPATIBLES_ONLY to only see compatible ones that are not directly
  provided
* FEATURES_USED_EXPLICIT to get the feature used before resolving providers
  of such features
…e' features

Features can now provide other features by defining them as

FEATURES_COMPATIBLE_name_of_the_feature += features_also_provided
@fjmolinas fjmolinas added Area: boards Area: Board ports Area: build system Area: Build system Area: network Area: Networking Area: tests Area: tests and testing framework Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation labels Oct 11, 2019
@fjmolinas
Copy link
Contributor

Now I'm very convinced that the netif feature should be provided by radio drivers themselves. What is missing is a consensus on how this should be managed by the build system.

Originally posted by @aabadie in #12423 (comment)

I think this is a good way of implementing the buildsystem part of #11676.

…FEATURES_COMPATIBLE'

FEATURES_COMPATIBLE should only be defined with '=' otherwise it
explodes when parsing with 'info-boards-supported'
@stale
Copy link

stale bot commented Apr 13, 2020

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 Apr 13, 2020
@fjmolinas fjmolinas removed the State: stale State: The issue / PR has no activity for >185 days label Apr 14, 2020
@stale
Copy link

stale bot commented Oct 16, 2020

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 Oct 16, 2020
@stale stale bot closed this Nov 20, 2020
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: build system Area: Build system Area: network Area: Networking Area: tests Area: tests and testing framework Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR State: stale State: The issue / PR has no activity for >185 days Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants