Skip to content

Commit faed66f

Browse files
nordicjmbjarki-andreasen
authored andcommitted
[nrf fromlist] sysbuild: cmake: Fix ExternalZephyrProject_Add() revision handling
Fixes an issue with HWMv2 boards whereby the specified board revision was not applied at the correct place, which would cause the target image to fail configuration Fixes zephyrproject-rtos#79208 Upstream PR: zephyrproject-rtos#79209 Signed-off-by: Jamie McCrae <[email protected]>
1 parent 26bd28e commit faed66f

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

share/sysbuild/cmake/modules/sysbuild_extensions.cmake

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,22 @@ function(ExternalZephyrProject_Add)
398398
# unless <image>_BOARD is defined.
399399
if(DEFINED ZBUILD_BOARD_REVISION)
400400
# Use provided board revision
401-
set_target_properties(${ZBUILD_APPLICATION} PROPERTIES BOARD ${ZBUILD_BOARD}@${ZBUILD_BOARD_REVISION})
401+
if(ZBUILD_BOARD MATCHES "/")
402+
# HWMv2 requires adding version to the board, split elements up, attach version, then
403+
# reassemble into a complete string
404+
string(REPLACE "/" ";" split_board_qualifiers "${ZBUILD_BOARD}")
405+
list(GET split_board_qualifiers 0 target_board)
406+
set(target_board ${target_board}@${ZBUILD_BOARD_REVISION})
407+
list(REMOVE_AT split_board_qualifiers 0)
408+
list(PREPEND split_board_qualifiers ${target_board})
409+
string(REPLACE ";" "/" board_qualifiers "${split_board_qualifiers}")
410+
set_target_properties(${ZBUILD_APPLICATION} PROPERTIES BOARD ${board_qualifiers})
411+
set(split_board_qualifiers)
412+
set(board_qualifiers)
413+
else()
414+
# Legacy HWMv1 support, version goes at end
415+
set_target_properties(${ZBUILD_APPLICATION} PROPERTIES BOARD ${ZBUILD_BOARD}@${ZBUILD_BOARD_REVISION})
416+
endif()
402417
else()
403418
set_target_properties(${ZBUILD_APPLICATION} PROPERTIES BOARD ${ZBUILD_BOARD})
404419
endif()

0 commit comments

Comments
 (0)