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:
parent
c323cc6fb1
commit
6640c04df6
6 changed files with 25 additions and 13 deletions
|
@ -9,9 +9,13 @@ ExternalZephyrProject_Add(
|
||||||
BOARD ${SB_CONFIG_IPM_REMOTE_BOARD}
|
BOARD ${SB_CONFIG_IPM_REMOTE_BOARD}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Add a dependency so that the remote sample will be built and flashed first
|
# Add dependencies so that the remote sample will be built first
|
||||||
# This is required because some primary cores need information from the
|
# This is required because some primary cores need information from the
|
||||||
# remote core's build, such as the output image's LMA
|
# remote core's build, such as the output image's LMA
|
||||||
add_dependencies(ipm_mcux ipm_mcux_remote)
|
add_dependencies(ipm_mcux ipm_mcux_remote)
|
||||||
# Place remote image first in the image list
|
sysbuild_add_dependencies(CONFIGURE ipm_mcux ipm_mcux_remote)
|
||||||
set(IMAGES "ipm_mcux_remote" ${IMAGES})
|
|
||||||
|
if(SB_CONFIG_BOOTLOADER_MCUBOOT)
|
||||||
|
# Make sure MCUboot is flashed first
|
||||||
|
sysbuild_add_dependencies(FLASH ipm_mcux_remote mcuboot)
|
||||||
|
endif()
|
||||||
|
|
|
@ -9,9 +9,13 @@ ExternalZephyrProject_Add(
|
||||||
BOARD ${SB_CONFIG_OPENAMP_REMOTE_BOARD}
|
BOARD ${SB_CONFIG_OPENAMP_REMOTE_BOARD}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Add a dependency so that the remote sample will be built and flashed first
|
# Add dependencies so that the remote sample will be built first
|
||||||
# This is required because some primary cores need information from the
|
# This is required because some primary cores need information from the
|
||||||
# remote core's build, such as the output image's LMA
|
# remote core's build, such as the output image's LMA
|
||||||
add_dependencies(openamp openamp_remote)
|
add_dependencies(openamp openamp_remote)
|
||||||
# Place remote image first in the image list
|
sysbuild_add_dependencies(CONFIGURE openamp openamp_remote)
|
||||||
set(IMAGES "openamp_remote" ${IMAGES})
|
|
||||||
|
if(SB_CONFIG_BOOTLOADER_MCUBOOT)
|
||||||
|
# Make sure MCUboot is flashed first
|
||||||
|
sysbuild_add_dependencies(FLASH openamp_remote mcuboot)
|
||||||
|
endif()
|
||||||
|
|
|
@ -24,9 +24,6 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} COMPONENTS ${zephyr_modules
|
||||||
|
|
||||||
project(sysbuild LANGUAGES)
|
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_DIR ${APP_DIR} ABSOLUTE)
|
||||||
get_filename_component(app_name ${APP_DIR} NAME)
|
get_filename_component(app_name ${APP_DIR} NAME)
|
||||||
|
|
||||||
|
@ -54,7 +51,6 @@ ExternalZephyrProject_Add(
|
||||||
SOURCE_DIR ${APP_DIR}
|
SOURCE_DIR ${APP_DIR}
|
||||||
APP_TYPE MAIN
|
APP_TYPE MAIN
|
||||||
)
|
)
|
||||||
list(APPEND IMAGES "${app_name}")
|
|
||||||
set(DEFAULT_IMAGE "${app_name}")
|
set(DEFAULT_IMAGE "${app_name}")
|
||||||
|
|
||||||
add_subdirectory(bootloader)
|
add_subdirectory(bootloader)
|
||||||
|
@ -63,6 +59,7 @@ add_subdirectory(bootloader)
|
||||||
include(${BOARD_DIR}/sysbuild.cmake OPTIONAL)
|
include(${BOARD_DIR}/sysbuild.cmake OPTIONAL)
|
||||||
|
|
||||||
# This allows image specific sysbuild.cmake to be processed.
|
# This allows image specific sysbuild.cmake to be processed.
|
||||||
|
get_property(IMAGES GLOBAL PROPERTY sysbuild_images)
|
||||||
list(LENGTH IMAGES images_length)
|
list(LENGTH IMAGES images_length)
|
||||||
while(NOT "${images_length}" EQUAL "${processed_length}")
|
while(NOT "${images_length}" EQUAL "${processed_length}")
|
||||||
foreach(image ${IMAGES})
|
foreach(image ${IMAGES})
|
||||||
|
@ -73,6 +70,7 @@ while(NOT "${images_length}" EQUAL "${processed_length}")
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
get_property(IMAGES GLOBAL PROPERTY sysbuild_images)
|
||||||
list(LENGTH IMAGES images_length)
|
list(LENGTH IMAGES images_length)
|
||||||
list(LENGTH images_sysbuild_processed processed_length_new)
|
list(LENGTH images_sysbuild_processed processed_length_new)
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ if(SB_CONFIG_BOOTLOADER_MCUBOOT)
|
||||||
)
|
)
|
||||||
# MCUBoot default configuration is to perform a full chip erase.
|
# MCUBoot default configuration is to perform a full chip erase.
|
||||||
# Placing MCUBoot first in list to ensure it is flashed before other images.
|
# 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}")
|
set_config_string(${image} CONFIG_BOOT_SIGNATURE_KEY_FILE "${SB_CONFIG_BOOT_SIGNATURE_KEY_FILE}")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -155,6 +155,11 @@ function(ExternalZephyrProject_Add)
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set_property(
|
||||||
|
GLOBAL
|
||||||
|
APPEND PROPERTY sysbuild_images ${ZBUILD_APPLICATION}
|
||||||
|
)
|
||||||
|
|
||||||
set(sysbuild_image_conf_dir ${APP_DIR}/sysbuild)
|
set(sysbuild_image_conf_dir ${APP_DIR}/sysbuild)
|
||||||
set(sysbuild_image_name_conf_dir ${APP_DIR}/sysbuild/${ZBUILD_APPLICATION})
|
set(sysbuild_image_name_conf_dir ${APP_DIR}/sysbuild/${ZBUILD_APPLICATION})
|
||||||
# User defined `-D<image>_CONF_FILE=<file.conf>` takes precedence over anything else.
|
# User defined `-D<image>_CONF_FILE=<file.conf>` takes precedence over anything else.
|
||||||
|
|
|
@ -15,11 +15,12 @@ ExternalZephyrProject_Add(
|
||||||
)
|
)
|
||||||
|
|
||||||
# Add the swapped app to the list of images to flash
|
# Add the swapped app to the list of images to flash
|
||||||
# Ensure the order of images is as follows:
|
# Ensure the flashing order of images is as follows:
|
||||||
# - mcuboot
|
# - mcuboot
|
||||||
# - swapped app
|
# - swapped app
|
||||||
# - primary app (test_mcuboot)
|
# - primary app (test_mcuboot)
|
||||||
# This order means that if the debugger resets the MCU in between flash
|
# This order means that if the debugger resets the MCU in between flash
|
||||||
# iterations, the MCUBoot swap won't be triggered until the secondary app
|
# iterations, the MCUBoot swap won't be triggered until the secondary app
|
||||||
# is actually present in flash.
|
# is actually present in flash.
|
||||||
set(IMAGES "mcuboot" "swapped_app" "test_mcuboot")
|
sysbuild_add_dependencies(FLASH test_mcuboot swapped_app)
|
||||||
|
sysbuild_add_dependencies(FLASH swapped_app mcuboot)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue