-
Notifications
You must be signed in to change notification settings - Fork 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
Shields: Allow shields conditional configuration #20934
Conversation
All checks are passing now. Tip: The bot edits this comment instead of posting a new one, so you can check the comment's history to see earlier messages. |
f6c2e38
to
2feb272
Compare
@@ -22,6 +22,8 @@ endmenu | |||
# Note: $ARCH and $BOARD_DIR might be glob patterns. | |||
source "$(BOARD_DIR)/Kconfig.defconfig" | |||
|
|||
source "boards/shields/*/Kconfig.defconfig" |
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.
Are the enabled shields known pre-Kconfig?
If so we want to limit the sourced files to just those enabled.
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.
Are the enabled shields known pre-Kconfig?
Yes and no.
When running a west build command this is known... But user can modify shields selection using menuconfig
.
If so we want to limit the sourced files to just those enabled.
If we do so (need to figure it out how, though), we prevent the ability to select shields in menuconfig
.
So we need to chose between this and build performance (which, I guess, is your point).
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.
But user can modify shields selection using menuconfig.
Never mind then, thank you for the explanation.
doc/guides/kconfig/index.rst
Outdated
For example, we can get the default value for a Kconfig symbol | ||
from the devicetree. | ||
See the Python docstrings in ``scripts/kconfig/kconfigfunctions.py`` for more |
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.
OK for now, but we can also use the sphinx autodoc capabilities (as done for west).
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.
OK on the docs, but we should take advantage of the sphinx autodoc capabilities (as done with west), to extract and process docstrings.
scripts/kconfig/kconfigfunctions.py
Outdated
@@ -335,6 +335,15 @@ def dt_compat_enabled(kconf, _, compat): | |||
return "n" | |||
|
|||
|
|||
def cmake_in_list(kconf, _, elem, list): |
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.
Could call it in_cmake_list()
maybe. I read cmake_in_list
as "CMake is in the list" at first and was a bit confused.
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.
I though about it, but finally opted to use cmake as namespace to follow logic used for other dt functions (dt_foo
, ..).
Up to you!
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.
How about cmake_list_contains
?
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.
For def_bool
stuff.
2feb272
to
6b560fa
Compare
@ulfalizer, Thanks for the review. I've pushed a new version fixing the points you reported. About:
I answered, let me know what you prefer. |
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.
Looks like a much better way to do this. +1 from me for the approach, nice work!
scripts/kconfig/kconfigfunctions.py
Outdated
@@ -335,6 +335,15 @@ def dt_compat_enabled(kconf, _, compat): | |||
return "n" | |||
|
|||
|
|||
def cmake_in_list(kconf, _, elem, list): |
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.
How about cmake_list_contains
?
@mbolivar, @ulfalizer, thanks for reviews. For the remaining controversial point, what about
We can even drop the
|
Either |
6b560fa
to
3afd4ac
Compare
Add Kconfig.shield file for x_nucleo_iks01ax shields. Signed-off-by: Erwan Gouriou <[email protected]>
378bd43
to
31f52d9
Compare
@ulfalizer, can you review once more ? |
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.
Thanks, just one comment.
default 250 if SHIELD_WAVESHARE_EPAPER_GDEH0213B72 | ||
|
||
config LVGL_VER_RES | ||
default 128 |
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.
Should be:
default 128 if SHIELD_WAVESHARE_EPAPER_GDEH029A1
default 120 if SHIELD_WAVESHARE_EPAPER_GDEH0213B1
default 120 if SHIELD_WAVESHARE_EPAPER_GDEH0213B72
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.
Fixed, thanks
Move wavehare epaper shields to conditional Kconfig. As part of this change, direct drivers Kconfig symbols enabling (SPI, SSD16XX) are removed as they are application responsibility. GPIO is removed as well as it should be 'y' by default on all boards according to Default board configuration guidelines. Signed-off-by: Erwan Gouriou <[email protected]>
Factorize definitions for ssd1306_128x32 and sd1306_128x64 shields and move to conditional Kconfig. As part of this change, direct drivers Kconfig symbols enabling (I2C, SSD1306) are removed as they are application responsibility. Also disabling SSD16XX is removed as SSD16XX should not be enabled by default. Signed-off-by: Erwan Gouriou <[email protected]>
Move sparkfun_sara_r4 to conditional Kconfig. As part of this change, remove disco_l475_iot1 specific configuration as it is already part of board default configuration. Signed-off-by: Erwan Gouriou <[email protected]>
Move link_board_eth to conditional Kconfig. Signed-off-by: Erwan Gouriou <[email protected]>
Move link_board_can to conditional Kconfig. As part of this change, some board specific symbols are moved to reel_board specific file. Signed-off-by: Erwan Gouriou <[email protected]>
Add Kconfig.shield to frdm_kw41z. Signed-off-by: Erwan Gouriou <[email protected]>
Move shield to Kconfig.shield format. Signed-off-by: Erwan Gouriou <[email protected]>
Move dfrobot_can_bus_v2_0 to Kcondig.shield foramt and as part of this change introduce nrf52_pca10040 board specific configuration. Signed-off-by: Erwan Gouriou <[email protected]>
Move adafruit_2_8_tft_touch_v2 to Kconfig.defconfig format. As part of this change Kconfig flags SPI and DISPLAY are removed from the shield configuration as they are part of application configuration. Signed-off-by: Erwan Gouriou <[email protected]>
Update doc with new Kconfig.shield files. Signed-off-by: Erwan Gouriou <[email protected]>
31f52d9
to
a778c21
Compare
@ulfalizer, when you have some time, a new review would be welcome |
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.
Some nits.
Did you consider putting the shield stuff in the main board Kconfig.defconfig
file by the way (e.g. after a # Shield configuration
comment)? It's a bit confusing that we have so many Kconfig files.
@@ -23,6 +23,9 @@ source "$(BOARD_DIR)/Kconfig.board" | |||
|
|||
endchoice | |||
|
|||
# Parse shields references | |||
# Don't do it as a menuconfig, as shield selection is a CMake feature. | |||
rsource "shields/*/Kconfig.shield" |
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.
FWIW, I prefer source
over rsource
where rsource
isn't needed, because it makes the path easier to grep for.
The globbing kinda breaks grepping already though.
# Copyright (c) 2019, NXP | ||
# Copyright (c) 2019 Linaro Limited | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# |
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.
Inconsistent header. Make it
# Copyright (c) 2019, NXP
# Copyright (c) 2019 Linaro Limited
# SPDX-License-Identifier: Apache-2.0
...
# Copyright (c) 2019 Linaro Limited | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# |
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.
Make it
# Copyright (c) 2019, NXP
# Copyright (c) 2019 Linaro Limited
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2019 Linaro Limited | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# |
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.
Ditto
Also wondering if |
Wouldn't that require O(boards*shields) snippets of shield code instead of O(shields) ? |
Use conditional Kconfig, as introduced by PR zephyrproject-rtos#20934, for ST7789V based shields. Signed-off-by: Jan Van Winkel <[email protected]>
Use conditional Kconfig, as introduced by PR #20934, for ST7789V based shields. Signed-off-by: Jan Van Winkel <[email protected]>
Today shields Kconfig configuration (set of Kconfig symbols defined in
<shield>_defconfig
files) is applied unconditionally when a specific shield is selected by user (or indirectly in a sample/test via cmake configuration or with a yaml configuration when running sanitycheck).This must be changed. Indeed, for application portability matter, board default configuration guidelines states that features activation is application responsibility and should not be done on board side (and shields are on board side).
This is applied for boards and should then be aslo applied for shields, so applications can rely on the fact that a HW component can be configured the same way, either it is directly available on the board or added via a shield.
To make shield conditional configuration possible:
boards/shields/my_shieldx/Kconfig.shield
Kconfig.shield
in boards/Kconfig (which by the way enable the selection of shields in menuconfig)x_nucleo_idb05a1
andwnc_m14a2a
to this new scheme. Eventually all shields will be converted as part of this PR if RFC get positive feedback.EDIT: 11-27-19: Pushed a new version using a more readable Kconfig function (
shields_list_contains
)EDIT: 12-10-19: Pushed a new version which updates all shields
TODO:
Fixes #17310