-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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: shields: use Kconfig.defconfig system for shields #17310
Comments
@avisconti , would it also help you in your microphone shield? |
Yes, definetely.
|
For reference, they were previously available but been removed in #12403 when we put dt parsing ahead of Kconfig. This was done since we were also providing Kconfig.shield defining Shield Kconfig ( Thought instead of previous:
We can do simply:
So it extends the board's Kconfig.defconfig, but w/o needing shield Kconfig symbol anymore. @ulfalizer, do you think this would be a sound approach ? |
Thinking about it more, I think we should allow Kconfig.defconfig and replace existing shields.conf by these files.
We should have :
This way we can keep application compatible with either a board with embedded modem or a board with a shield providing the same modem. @mike-scott, I know we discussed this a bit earlier. How do you feel about this proposal. |
@erwango Yep, that makes sense. Perfect example is Particle Boron board (w/ embedded SARA R4 modem) vs. K64F + SparkFun modem shield. |
I had a quick look on how to implement support of Kconfig.defconfig for shields.
This is globally how boards are handled:
So, this would definitely work, but I wonder if this is the best option. |
Let assume the case where the shield needs to specify in the dts other things other than the peripherals connected to the expansion connector. For example a microphone shield may need to enable a specific I2S controller on the mother board. Is the overlay file enough for that? |
If this is dts then this is not related to current issue (which relates only to shields Kconfig). Can you raise a new issue to discuss this? |
Taked to @ulfalizer on this and think we could do something like:
or
And have SHIELD pass into kconfig from the build system. |
Need to update https://github.com/zephyrproject-rtos/zephyr/blob/master/cmake/kconfig.cmake#L60 to pass |
@ulfalizer: if looking at previous example from @galak, anyway we can check if ""wnc_m14a2a" is part of a ${SHIELD_LIST} list ? |
@erwango Could look something like this: def contains(kconf, _, sub, s):
"""
Returns "y" if 'sub' appears in 's' after split()ing it, and "n" otherwise.
"""
return "y" if sub in s.split() else "n"
functions = {
"contains": (contains, 2, 2),
...
} Then it could be used like
|
Is your enhancement proposal related to a problem? Please describe.
I am currently porting a BLE shield that use BlueNRG-MS chip (X-NUCLEO-IDB05A). The shield needs to set some specific CONFIG to work, such as CONFIG_SPI=y, that should in theory be enabled only if CONFIG_BT=y is set in a project.
The current way of doing this for shields is to add every config in configuration overlays, meaning that when a shield is added as a -DSHIELD during compilation, config value are automatically set.
For example, is this case, this mean as soon as we compile with specifying the BLE shield, CONFIG_SPI will automatically be set, even if CONFIG_BT isn't.
Describe the solution you'd like
Using Kconfig.defconfig system for shields would allow us to do things such as :
preventing the setting of configuration that might be unused.
Describe alternatives you've considered
The current way of doing it is to set configuration in overlays
which will automatically set those configurations even if we don't use BT (when compiling with the shield specified)
Additional context
This might be useful for projects that interface multiple shields
The text was updated successfully, but these errors were encountered: