-
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
cmake: dts: move to specifying shield on the command line #12403
Conversation
Codecov Report
@@ Coverage Diff @@
## master #12403 +/- ##
==========================================
- Coverage 53.81% 49.73% -4.09%
==========================================
Files 242 292 +50
Lines 27719 42433 +14714
Branches 6733 9969 +3236
==========================================
+ Hits 14917 21102 +6185
- Misses 9997 17180 +7183
- Partials 2805 4151 +1346
Continue to review full report at Codecov.
|
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.
This works fine, few comments plus following additions:
In samples/shields/x_nucleo_iks01a1/CMakeLists.txt
:
# This sample is specific to x_nucleo_iks01a1 shield. Enforce -DSHIELD option
set(SHIELD x_nucleo_iks01a1)
Doc doc change required in doc/porting/shields.rst
:
Shield activation
*****************
Activate support for a shield by adding the matching -DSHIELD arg to CMake
command
.. zephyr-app-commands::
:zephyr-app: your_app
:gen-args: -DSHIELD=x_nucleo_iks01a1
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.
doc changes LGTM
5e45e93
to
dfe3839
Compare
@SebastianBoe can you take a look, I'm also trying to figure out how to export ${shield_list} to cmake/app/boilerplate.cmake, but can't figure out scope rules. |
I need more information to be able to help you. What seems to be the problem? |
I wanted to print ${shield_list} in the usage message, when I try to access it in cmake/usage/usage.cmake its empty. |
I see. usage.cmake is executed by it's own CMake process, see https://github.com/zephyrproject-rtos/zephyr/blob/master/cmake/usage/CMakeLists.txt#L5. So it only has access to the variables that has been explicitly exported to it, see https://github.com/zephyrproject-rtos/zephyr/blob/master/cmake/usage/CMakeLists.txt#L6 for an example of exporting a variable to usage.cmake. Also, usage.cmake is executed twice, so any additional variables must be applied both here: https://github.com/zephyrproject-rtos/zephyr/blob/master/cmake/usage/CMakeLists.txt#L6 and here: https://github.com/zephyrproject-rtos/zephyr/blob/master/cmake/extensions.cmake#L1114 |
All checks are passing now. Review history of this comment for details about previous failed status. |
Ah thanks, that makes sense now. |
@SebastianBoe can you re-review the full PR. Should be complete now. |
cmake/app/boilerplate.cmake
Outdated
|
||
list(APPEND SHIELD_LIST ${shield}) | ||
if(DEFINED SHIELD) | ||
if(${shield} STREQUAL ${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.
With Kconfig, it was possible to enable multiple shields.
To retain this functionality we need to check if ${shield} is in the list ${SHIELD}.
... and possibly rename from SHIELD to SHIELDS.
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 would we specify multiple shields, as a 'space separated' list?
-DSHIELD="frdm_kw41z x_nucleo_iks01a1"
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.
Yes, CONF_FILE should be able to demonstrate how to do it if you see any problems.
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.
Yes, CONF_FILE should be able to demonstrate how to do it if you see any problems.
Ok, should now handle this case.
45b55ec
to
737f41e
Compare
Rather than specifying SHIELD via Kconfig, we move it to being specified via the command line, similar to board. So we can do: -DSHIELD=x_nucleo_iks01a1 or, for multiple shields: -DSHIELD="x_nucleo_iks01a1 frdm_kw41z" Following cmake change, update x_nucleo_iks01a1 sample in order not to enable CONFIG option anymore but set SHIELD cmake option. Last, update documentation to reflect this change. Signed-off-by: Erwan Gouriou <[email protected]> Signed-off-by: Kumar Gala <[email protected]>
Following change of selection mechanism, clean boards/shields from Kconfig related code. Signed-off-by: Erwan Gouriou <[email protected]>
if(BOARD STREQUAL mimxrt1020_evk OR | ||
BOARD STREQUAL mimxrt1050_evk OR | ||
BOARD STREQUAL mimxrt1060_evk OR | ||
BOARD STREQUAL frdm_k64f) |
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.
Well that's unfortunate. :(
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.
Eventually we are going to need something more sophisticated than CMake variables to give input to DT.
Like a separate Kconfig root/tree for DT for instance.
harness: bluetooth | ||
extra_args: OVERLAY_CONFIG=overlay-shield_frdm_kw41z.conf | ||
platform_whitelist: mimxrt1020_evk mimxrt1050_evk mimxrt1060_evk frdm_k64f | ||
platform_whitelist: qemu_cortex_m3 qemu_x86 mimxrt1020_evk mimxrt1050_evk mimxrt1060_evk frdm_k64f |
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.
Instead of the modification to CMakeLists.txt, could you leave the two tests and set extra_args: SHIELD=frdm_kw41
in the second one?
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 went ahead and merged this as I wanted to close on the base -DSHIELD support this week. I'll open a new PR for reworking the bluetooth test as you've asked in here.
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 opened PR #12585 for the BT Periph Sample change.
After the rework in zephyrproject-rtos#12403, specifying a shield which has overlay out of the tree causes unnecessary inclusions of overlays. For every board root, overlays that have same index as expected overlay are being included. Fix this by removing already included overlays from SHIELD list. Signed-off-by: Marcin Szymczyk <[email protected]>
After the rework in #12403, specifying a shield which has overlay out of the tree causes unnecessary inclusions of overlays. For every board root, overlays that have same index as expected overlay are being included. Fix this by removing already included overlays from SHIELD list. Signed-off-by: Marcin Szymczyk <[email protected]>
After the rework in #12403, specifying a shield which has overlay out of the tree causes unnecessary inclusions of overlays. For every board root, overlays that have same index as expected overlay are being included. Fix this by removing already included overlays from SHIELD list. Signed-off-by: Marcin Szymczyk <[email protected]>
After the rework in zephyrproject-rtos#12403, specifying a shield which has overlay out of the tree causes unnecessary inclusions of overlays. For every board root, overlays that have same index as expected overlay are being included. Fix this by removing already included overlays from SHIELD list. Signed-off-by: Marcin Szymczyk <[email protected]>
After the rework in #12403, specifying a shield which has overlay out of the tree causes unnecessary inclusions of overlays. For every board root, overlays that have same index as expected overlay are being included. Fix this by removing already included overlays from SHIELD list. Signed-off-by: Marcin Szymczyk <[email protected]>
Rather than specifying SHIELD via Kconfig, we move it to being specified
via the command line, similar to board.
Fixes #12102