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

Allow custom FEATURE to be defined from an external source #20743

Open
HendrikVE opened this issue Jun 11, 2024 · 2 comments
Open

Allow custom FEATURE to be defined from an external source #20743

HendrikVE opened this issue Jun 11, 2024 · 2 comments
Labels
Area: build system Area: Build system

Comments

@HendrikVE
Copy link
Contributor

Description

We are using the RIOT repository as a base for our apps and custom boards. While it is possible to add external MODULEs and BOARDs, as far as I understand it's not possible to add custom FEATUREs. In case some of my boards provide a custom feature I'd like to be able to add it to the list of available features, because otherwise the build would fail as the buildsystem does not recognize the given feature. But since this list (RIOT/makefiles/features_existing.inc.mk) is hardcoded and auto-generated there is currently no way to do that as far as I can see.

@HendrikVE HendrikVE added the Area: build system Area: Build system label Jun 11, 2024
@maribu
Copy link
Member

maribu commented Jun 28, 2024

That is indeed true.

It would be possible to also -include an features_existing.inc.mk within the board's folder, or for each folder in EXTERNAL_BOARD_DIRS to extend this.

Could you elaborate a bit more your use case?

To me, it is not obvious how a custom feature provided in a board would be useful. After all, only that board would know about that custom feature. And usually the value of features is that code in RIOT can depend on features or unlock extra functionality (via FEATURES_OPTIONAL) based on a feature - but that won't work for features RIOT is not aware of anyway.

(Just to rule out this is that this is not an XY problem. If there is indeed value in allowing external boards to add custom features, we should implement this.)

@HendrikVE
Copy link
Contributor Author

HendrikVE commented Jun 28, 2024

My use case is to allow a common API function that boards can optionally provide via the board.h, e.g. an extended initialization routine for testing environments. It's not a hardware but a software feature of a board that can be shared throughout the repository. So if I have an application, which works for several boards, that wants to call this extended board feature conditionally it needs to know whether it is available for the compiled board.

Theoretically one could do it as described here, but that's not very clean.

As a workaround the Makefile.features of my boards can add a custom feature with
CFLAGS += -DFEATURES_PROVIDED_BOARD_<feature_name>
which will then be respected in the applications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: build system Area: Build system
Projects
None yet
Development

No branches or pull requests

2 participants