Skip to content

Commit

Permalink
[nrf fromlist] sysbuild: cmake: Fix ExternalZephyrProject_Add() revis…
Browse files Browse the repository at this point in the history
…ion 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 <jamie.mccrae@nordicsemi.no>
(cherry picked from commit faed66f)
(cherry picked from commit bcb795a)
  • Loading branch information
nordicjm authored and jukkar committed Dec 5, 2024
1 parent aa05262 commit f1ba687
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion share/sysbuild/cmake/modules/sysbuild_extensions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,22 @@ function(ExternalZephyrProject_Add)
# unless <image>_BOARD is defined.
if(DEFINED ZBUILD_BOARD_REVISION)
# Use provided board revision
set_target_properties(${ZBUILD_APPLICATION} PROPERTIES BOARD ${ZBUILD_BOARD}@${ZBUILD_BOARD_REVISION})
if(ZBUILD_BOARD MATCHES "/")
# HWMv2 requires adding version to the board, split elements up, attach version, then
# reassemble into a complete string
string(REPLACE "/" ";" split_board_qualifiers "${ZBUILD_BOARD}")
list(GET split_board_qualifiers 0 target_board)
set(target_board ${target_board}@${ZBUILD_BOARD_REVISION})
list(REMOVE_AT split_board_qualifiers 0)
list(PREPEND split_board_qualifiers ${target_board})
string(REPLACE ";" "/" board_qualifiers "${split_board_qualifiers}")
set_target_properties(${ZBUILD_APPLICATION} PROPERTIES BOARD ${board_qualifiers})
set(split_board_qualifiers)
set(board_qualifiers)
else()
# Legacy HWMv1 support, version goes at end
set_target_properties(${ZBUILD_APPLICATION} PROPERTIES BOARD ${ZBUILD_BOARD}@${ZBUILD_BOARD_REVISION})
endif()
else()
set_target_properties(${ZBUILD_APPLICATION} PROPERTIES BOARD ${ZBUILD_BOARD})
endif()
Expand Down

0 comments on commit f1ba687

Please sign in to comment.