sysbuild: Remove IMAGES variable

This variable was originally provided for two indended purposes:

  * Let users manually add a new image in a desired order in the list.
  * Let users set build-only images, which are excluded from the list.

Given the recent additions of the `sysbuild_add_dependencies()` function
and the `BUILD_ONLY` parameter, `IMAGES` should be considered obsolete.

Furthermore, the list of images added to sysbuild should be updated
automatically when calling `ExternalZephyrProject_Add()`. This is now
possible by using a GLOBAL property internal to sysbuild.

With that, the `IMAGES` variable can be removed. Its existing usage for
image ordering is replaced with `sysbuild_add_dependencies()` treewide.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
This commit is contained in:
Grzegorz Swiderski 2023-05-15 11:19:47 +02:00 committed by Carles Cufí
commit 6640c04df6
6 changed files with 25 additions and 13 deletions

View file

@ -24,9 +24,6 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} COMPONENTS ${zephyr_modules
project(sysbuild LANGUAGES)
# Global list of images enabled in this multi image build system.
set(IMAGES)
get_filename_component(APP_DIR ${APP_DIR} ABSOLUTE)
get_filename_component(app_name ${APP_DIR} NAME)
@ -54,7 +51,6 @@ ExternalZephyrProject_Add(
SOURCE_DIR ${APP_DIR}
APP_TYPE MAIN
)
list(APPEND IMAGES "${app_name}")
set(DEFAULT_IMAGE "${app_name}")
add_subdirectory(bootloader)
@ -63,6 +59,7 @@ add_subdirectory(bootloader)
include(${BOARD_DIR}/sysbuild.cmake OPTIONAL)
# This allows image specific sysbuild.cmake to be processed.
get_property(IMAGES GLOBAL PROPERTY sysbuild_images)
list(LENGTH IMAGES images_length)
while(NOT "${images_length}" EQUAL "${processed_length}")
foreach(image ${IMAGES})
@ -73,6 +70,7 @@ while(NOT "${images_length}" EQUAL "${processed_length}")
endif()
endforeach()
get_property(IMAGES GLOBAL PROPERTY sysbuild_images)
list(LENGTH IMAGES images_length)
list(LENGTH images_sysbuild_processed processed_length_new)

View file

@ -12,7 +12,7 @@ if(SB_CONFIG_BOOTLOADER_MCUBOOT)
)
# MCUBoot default configuration is to perform a full chip erase.
# Placing MCUBoot first in list to ensure it is flashed before other images.
set(IMAGES ${image} ${IMAGES} PARENT_SCOPE)
sysbuild_add_dependencies(FLASH ${DEFAULT_IMAGE} ${image})
set_config_string(${image} CONFIG_BOOT_SIGNATURE_KEY_FILE "${SB_CONFIG_BOOT_SIGNATURE_KEY_FILE}")
endif()

View file

@ -155,6 +155,11 @@ function(ExternalZephyrProject_Add)
endif()
set_property(
GLOBAL
APPEND PROPERTY sysbuild_images ${ZBUILD_APPLICATION}
)
set(sysbuild_image_conf_dir ${APP_DIR}/sysbuild)
set(sysbuild_image_name_conf_dir ${APP_DIR}/sysbuild/${ZBUILD_APPLICATION})
# User defined `-D<image>_CONF_FILE=<file.conf>` takes precedence over anything else.