-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
tests: Enable MCUBoot test on additional platforms #51448
tests: Enable MCUBoot test on additional platforms #51448
Conversation
…uild Introduce SB_FULL_CONFIG, to enable systembuild to build zephyr.dts and a full output KConfig file. This option is experimental, and is intended to aid in filtering tests with sysbuild. Setting this flag with -DSB_FULL_CONFIG=y at the command line will enable the following behavior: - "Kconfig.zephyr" must now be sourced in Kconfig.sysbuild, instead of "share/sysbuild/Konfig" - All board configuration settings for a barebones (ie hello_world) build will be available in Kconfig.sysbuild and sysbuild.cmake for the application - All DTS filtering functions will work within Kconfig.sysbuild - A barebones .config and zephyr.dts file will be generated for the root sysbuild build, as well as each sysbuild application Signed-off-by: Daniel DeGrasse <[email protected]>
BOOTLOADER_MCUBOOT selects DT_USE_CODE_PARTITION, which itself depends on FLASH_HAS_LOAD_OFFSET. Remove the dependency on BOOTLOADER_MCUBOOT from FLASH_HAS_LOAD_OFFSET, so it can be used as a filtering criteria to enable mcuboot support Signed-off-by: Daniel DeGrasse <[email protected]>
Remove default y when BOOTLOADER_MCUBOOT is enabled from NORDIC_QSPI_NOR, as this creates a circular dependency when BOOTLOADER_MCUBOOT depends on FLASH_HAS_DRIVER_ENABLED. NORDIC_QSPI_NOR will be enabled when flash drivers are enabled via FLASH=y, so mcuboot support will still function. Signed-off-by: Daniel DeGrasse <[email protected]>
Update MCUBoot test to use twister filtering, using SB_FULL_CONFIG. The use of SB_FULL_CONFIG allows Kconfig.sysbuild to skip building MCUBoot if the platform will not support it, so that cmake configuration can still succeed. This enables twister to filter this sample, so it can be run on additional supported platforms. Signed-off-by: Daniel DeGrasse <[email protected]>
|
@rerickson1 should these boards be enabled for this test then? If not, how can we filter them out? I noticed that |
I would prefer these boards be enabled to work with MCUboot as we use MCUboot when building products based off these modules. Simplest way to solve would be board overlays for the test. Is that acceptable? |
|
This is where we should use package helper, and not start creating stuff in sysbuild for such purpose. For example one may run just
and for another board:
as seen, first board has a boot_partition, second board haven't got one. So |
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.
We should update twister to use package_helper before proceeding with this.
It was exactly for such use-cases I created package helper in first place.
@rerickson1 I have no problem with this. Twister will filter on the "main" sysbuild application's output devicetree and KConfig settings. What overlays would be required to enable these boards? |
It was exactly for such use-cases I created package helper in first place. @tejlmand Ok, I will look into adding support for package helper to twister when time permits. I am assuming that we'll want to enable package helper globally. Are there limitations of the package helper scripts that would prevent this, and require package helpers to be opt-in? |
For bl654_usb and bt610, CONFIG_MULTITHREADING=y is needed when building the mcuboot image. |
yes, that was always the plan, but seems there has not been time for this work, and without a hard pressure I guess it has been down on the list. It should indeed be enabled globally. |
@tejlmand @danieldegrasse I think the support for packed helper has to be global. I think the runner workflow can be modified in a way, that if keyword |
@danieldegrasse ESP32 boards should be filtered out as it can't be built in Zephyr's environment yet. |
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
@sylvioalves - is that still the case? |
Yes, for now. We have been working on it. |
I've opened a PR which adds the package helper support in twister to move us forward with mcuboot testing. #53499 It adds possibility to filter only on dts without the need to execute (and possibly fail) kconfigs and further steps. Without the PR: nrf52840dk_nrf52840: the filter finds matching nodes and build continues. Good. nsim_sem: fails with cmake kconfig error:
warning: FLASH_PAGE_LAYOUT (defined at drivers/flash/Kconfig:54) has direct dependencies FLASH_HAS_PAGE_LAYOUT && FLASH with value n, but is currently being y-selected by the following symbols:
warning: USE_DT_CODE_PARTITION (defined at Kconfig.zephyr:88) has direct dependencies HAS_FLASH_LOAD_OFFSET with value n, but is currently being y-selected by the following symbols:
error: Aborting due to Kconfig warnings With this PR (since with it only dt is required for filtering): INFO - 1/3 nsim_sem zephyr/tests/boot/test_mcuboot/boot.mcuboot SKIPPED (runtime filter) I also run a fuul scope (all platforms) locally on the PR and got such numbers: |
This is an initial attempt to enable testing MCUBoot using twister filtering on a broader variety of platforms, as a follow up to #49552. The test targeted here is
tests/boot/test_mcuboot
Introduction
The core issue with filtering tests for MCUBoot using twister is that twister must use the devicetree and KConfig outputs from CMake's configuration step to filter test cases. However, MCUBoot defines an application overlay with the following contents:
This overlay is added early in the build process, so it cannot be disabled based on a KConfig or devicetree property. Therefore, we must somehow only attempt to configure MCUBoot using CMake if a
boot_partition
is present in the base devicetree for the board.Approach
Currently, the approach I have chosen is to use sysbuild for this purpose. By default, sysbuild only configures a small set of KConfig values, and does not parse devicetree at all. However, by changing the included Zephyr modules we can enable devicetree parsing using sysbuild. In addition, by rewriting the included board's defconfig at build time (to use the
SB_CONFIG
Kconfig prefix), a broader set of KConfig values can be made available as dependencies for symbols inKconfig.sysbuild
. This behavior is currently controlled by passing-DSB_FULL_CONFIG
to CMake on the commandline.With
-DSB_FULL_CONFIG=y
,KConfig.sysbuild
can dynamically decide to skip configuring MCUBoot, allowing this sample to complete CMake for boards that do not support MCUBoot. From here, the test can be filtered normally using twister.Status of the PR
I have run twister against all in tree boards using this PR, targeting the
tests/boot/test_mcuboot
sample. Currently, twister fails to build this sample for 16 boards which I believe should support MCUBoot (based on their devicetrees), but do not currently:bl652_dvk failed: Build failure
bl654_usb failed: Build failure
thingy52_nrf52832 failed: Build failure
nrf5340dk_nrf5340_cpuapp_ns failed: Build failure
olimex_lora_stm32wl_devkit failed: Build failure
pinetime_devkit0 failed: Build failure
arduino_nicla_sense_me failed: Build failure
ruuvi_ruuvitag failed: Build failure
degu_evk failed: Build failure
thingy53_nrf5340_cpuapp failed: Cmake build failure
thingy53_nrf5340_cpuapp_ns failed: Build failure
nrf52840dongle_nrf52840 failed: Build failure
nrf9160dk_nrf9160_ns failed: Build failure
nucleo_g0b1re failed: Build failure
b_u585i_iot02a_ns failed: Build failure
bt610 failed: Build failure
I'd appreciate any feedback on if these board should support MCUBoot and are currently broken, or if they should not support it (and if that is the case, what filtering criteria could be used to determine this)
I have not performed any on device testing using twister with this PR, at this time. I'd appreciate community feedback as we work to narrow down which boards actually are capable of supporting MCUBoot.
Issues to address
-DSB_FULL_CONFIG=y
at the commandline to enable proper filtering for this test, but given how early in the CMake configuration Zephyr modules must be included, I was not sure where else to do so. @tejlmand, would appreciate any feedback here, or on the broader idea ofSB_FULL_CONFIG