Skip to content

Commit ce31799

Browse files
nordicjmcarlescufi
authored andcommitted
sysbuild: Allow board revisions to be specified for targets
Allows specifying board revisions when configuring target images with sysbuild. Signed-off-by: Jamie McCrae <[email protected]>
1 parent 02ab878 commit ce31799

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

share/sysbuild/cmake/modules/sysbuild_extensions.cmake

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -105,25 +105,27 @@ endfunction()
105105
# Usage:
106106
# ExternalZephyrProject_Add(APPLICATION <name>
107107
# SOURCE_DIR <dir>
108-
# [BOARD <board>]
108+
# [BOARD <board> [BOARD_REVISION <revision>]]
109109
# [MAIN_APP]
110110
# )
111111
#
112112
# This function includes a Zephyr based build system into the multiimage
113113
# build system
114114
#
115-
# APPLICATION: <name>: Name of the application, name will also be used for build
116-
# folder of the application
117-
# SOURCE_DIR <dir>: Source directory of the application
118-
# BOARD <board>: Use <board> for application build instead user defined BOARD.
119-
# MAIN_APP: Flag indicating this application is the main application
120-
# and where user defined settings should be passed on as-is
121-
# except for multi image build flags.
122-
# For example, -DCONF_FILES=<files> will be passed on to the
123-
# MAIN_APP unmodified.
115+
# APPLICATION: <name>: Name of the application, name will also be used for build
116+
# folder of the application
117+
# SOURCE_DIR <dir>: Source directory of the application
118+
# BOARD <board>: Use <board> for application build instead user defined BOARD.
119+
# BOARD_REVISION <revision>: Use <revision> of <board> for application (only valid if
120+
# <board> is also supplied).
121+
# MAIN_APP: Flag indicating this application is the main application
122+
# and where user defined settings should be passed on as-is
123+
# except for multi image build flags.
124+
# For example, -DCONF_FILES=<files> will be passed on to the
125+
# MAIN_APP unmodified.
124126
#
125127
function(ExternalZephyrProject_Add)
126-
cmake_parse_arguments(ZBUILD "MAIN_APP" "APPLICATION;BOARD;SOURCE_DIR" "" ${ARGN})
128+
cmake_parse_arguments(ZBUILD "MAIN_APP" "APPLICATION;BOARD;BOARD_REVISION;SOURCE_DIR" "" ${ARGN})
127129

128130
if(ZBUILD_UNPARSED_ARGUMENTS)
129131
message(FATAL_ERROR
@@ -198,7 +200,17 @@ function(ExternalZephyrProject_Add)
198200
# Only set image specific board if provided.
199201
# The sysbuild BOARD is exported through sysbuild cache, and will be used
200202
# unless <image>_BOARD is defined.
201-
list(APPEND sysbuild_cache_strings "${ZBUILD_APPLICATION}_BOARD:STRING=${ZBUILD_BOARD}\n")
203+
if(DEFINED ZBUILD_BOARD_REVISION)
204+
# Use provided board revision
205+
list(APPEND sysbuild_cache_strings "${ZBUILD_APPLICATION}_BOARD:STRING=${ZBUILD_BOARD}@${ZBUILD_BOARD_REVISION}\n")
206+
else()
207+
list(APPEND sysbuild_cache_strings "${ZBUILD_APPLICATION}_BOARD:STRING=${ZBUILD_BOARD}\n")
208+
endif()
209+
elseif(DEFINED ZBUILD_BOARD_REVISION)
210+
message(FATAL_ERROR
211+
"ExternalZephyrProject_Add(... BOARD_REVISION ${ZBUILD_BOARD_REVISION})"
212+
" requires BOARD."
213+
)
202214
endif()
203215

204216
file(WRITE ${sysbuild_cache_file}.tmp ${sysbuild_cache_strings})

0 commit comments

Comments
 (0)