sysbuild: Allow board revisions to be specified for targets
Allows specifying board revisions when configuring target images
with sysbuild.
@@ -105,7 +105,7 @@ endfunction()
# Usage:
# ExternalZephyrProject_Add(APPLICATION <name>
# SOURCE_DIR <dir>
-# [BOARD <board>]
+# [BOARD <board> [BOARD_REVISION <revision>]]
# [MAIN_APP]
# )
#
@@ -116,6 +116,8 @@ endfunction()
# folder of the application
# SOURCE_DIR <dir>: Source directory of the application
# BOARD <board>: Use <board> for application build instead user defined BOARD.
+# BOARD_REVISION <revision>: Use <revision> of <board> for application (only valid if
+# <board> is also supplied).
# MAIN_APP: Flag indicating this application is the main application
# and where user defined settings should be passed on as-is
# except for multi image build flags.
@@ -123,7 +125,7 @@ endfunction()
# MAIN_APP unmodified.
#
function(ExternalZephyrProject_Add)
- cmake_parse_arguments(ZBUILD "MAIN_APP" "APPLICATION;BOARD;SOURCE_DIR" "" ${ARGN})
+ cmake_parse_arguments(ZBUILD "MAIN_APP" "APPLICATION;BOARD;BOARD_REVISION;SOURCE_DIR" "" ${ARGN})
if(ZBUILD_UNPARSED_ARGUMENTS)
message(FATAL_ERROR
@@ -198,8 +200,18 @@ function(ExternalZephyrProject_Add)
# Only set image specific board if provided.
# The sysbuild BOARD is exported through sysbuild cache, and will be used
# unless <image>_BOARD is defined.
+ if(DEFINED ZBUILD_BOARD_REVISION)
+ # Use provided board revision
+ list(APPEND sysbuild_cache_strings "${ZBUILD_APPLICATION}_BOARD:STRING=${ZBUILD_BOARD}@${ZBUILD_BOARD_REVISION}\n")
+ else()
list(APPEND sysbuild_cache_strings "${ZBUILD_APPLICATION}_BOARD:STRING=${ZBUILD_BOARD}\n")
endif()
+ elseif(DEFINED ZBUILD_BOARD_REVISION)
+ message(FATAL_ERROR
+ "ExternalZephyrProject_Add(... BOARD_REVISION ${ZBUILD_BOARD_REVISION})"
+ " requires BOARD."
+ )
+ endif()
file(WRITE ${sysbuild_cache_file}.tmp ${sysbuild_cache_strings})
zephyr_file_copy(${sysbuild_cache_file}.tmp ${sysbuild_cache_file} ONLY_IF_DIFFERENT)
