From dcce23c2e4fcfe08ca63861c2c4c0ff06e8bd250 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 30 Sep 2024 14:41:18 +0100 Subject: [PATCH] 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 #79208 Signed-off-by: Jamie McCrae --- .../cmake/modules/sysbuild_extensions.cmake | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/share/sysbuild/cmake/modules/sysbuild_extensions.cmake b/share/sysbuild/cmake/modules/sysbuild_extensions.cmake index c1b2513d192f57..135160f564993d 100644 --- a/share/sysbuild/cmake/modules/sysbuild_extensions.cmake +++ b/share/sysbuild/cmake/modules/sysbuild_extensions.cmake @@ -398,7 +398,22 @@ function(ExternalZephyrProject_Add) # unless _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()