From b91a4cfef78ccf8f6fe63457c39ac36119275768 Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Tue, 21 Jan 2025 14:58:19 +0100 Subject: [PATCH] suit: Remove SoC name from MCI symbols Use CMake to select MCI implementation, based on the SoC. Use Kconfig to enable SDFW (common for all nordic platforms) or custom implementation. Refactor one of the tests to allow for such change. Ref: NCSDK-NONE Signed-off-by: Tomasz Chyrowicz --- subsys/suit/mci/CMakeLists.txt | 4 +++- subsys/suit/mci/Kconfig | 13 +++++++++---- tests/subsys/suit/cmake/test_template.cmake | 2 ++ .../component_compatibility_check/CMakeLists.txt | 11 ++++++++++- .../suit/component_compatibility_check/prj.conf | 5 ----- 5 files changed, 24 insertions(+), 11 deletions(-) diff --git a/subsys/suit/mci/CMakeLists.txt b/subsys/suit/mci/CMakeLists.txt index b0807dbb58cb..7cfc6eb3d238 100644 --- a/subsys/suit/mci/CMakeLists.txt +++ b/subsys/suit/mci/CMakeLists.txt @@ -11,7 +11,9 @@ target_link_libraries(suit_mci INTERFACE suit_platform_err) target_link_libraries(suit_mci INTERFACE suit_metadata) zephyr_library() -zephyr_library_sources_ifdef(CONFIG_SUIT_MCI_IMPL_NRF54H20_SDFW src/suit_mci_nrf54h20.c) +if(CONFIG_SUIT_MCI_IMPL_SDFW) + zephyr_library_sources(src/suit_mci_${CONFIG_SOC}.c) +endif() zephyr_library_sources(src/suit_generic_ids.c) zephyr_library_link_libraries(suit_mci) diff --git a/subsys/suit/mci/Kconfig b/subsys/suit/mci/Kconfig index 4f61a91e0328..99a681f37032 100644 --- a/subsys/suit/mci/Kconfig +++ b/subsys/suit/mci/Kconfig @@ -11,14 +11,19 @@ menuconfig SUIT_MCI if SUIT_MCI +config SUPPORT_SUIT_MCI_IMPL_SDFW + bool + default y if SOC_SERIES_NRF54HX + choice SUIT_MCI_IMPL prompt "MCI implementation" - default SUIT_MCI_IMPL_NRF54H20_SDFW if SOC_SERIES_NRF54HX - default SUIT_MCI_IMPL_CUSTOM if !SOC_SERIES_NRF54HX + default SUIT_MCI_IMPL_SDFW if SUPPORT_SUIT_MCI_IMPL_SDFW + default SUIT_MCI_IMPL_CUSTOM -config SUIT_MCI_IMPL_NRF54H20_SDFW - bool "nRF54H20: Secure domain" +config SUIT_MCI_IMPL_SDFW + bool "Secure domain" depends on SUIT_PLATFORM_VARIANT_SDFW + depends on SUPPORT_SUIT_MCI_IMPL_SDFW config SUIT_MCI_IMPL_CUSTOM bool "custom" diff --git a/tests/subsys/suit/cmake/test_template.cmake b/tests/subsys/suit/cmake/test_template.cmake index e0dd89929b8b..1a8211ee2fd6 100644 --- a/tests/subsys/suit/cmake/test_template.cmake +++ b/tests/subsys/suit/cmake/test_template.cmake @@ -23,5 +23,7 @@ if (CONFIG_64BIT) set(bit_arg -b 64) endif() +set(SUIT_SUBSYS_DIR ${ZEPHYR_NRF_MODULE_DIR}/subsys/suit) + add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/../common" "${PROJECT_BINARY_DIR}/test_common") add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/../mocks" "${PROJECT_BINARY_DIR}/test_mocks") diff --git a/tests/subsys/suit/component_compatibility_check/CMakeLists.txt b/tests/subsys/suit/component_compatibility_check/CMakeLists.txt index 472db230fa44..b76d34956a56 100644 --- a/tests/subsys/suit/component_compatibility_check/CMakeLists.txt +++ b/tests/subsys/suit/component_compatibility_check/CMakeLists.txt @@ -11,8 +11,17 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(integration_suit_component_compatibility_check) include(../cmake/test_template.cmake) +target_include_directories(app PRIVATE + ${SUIT_SUBSYS_DIR}/mci//include +) + +target_sources(app PRIVATE + # Use nRF54H20-specific MCI implementation. + ${SUIT_SUBSYS_DIR}/mci/src/suit_mci_nrf54h20.c + ${SUIT_SUBSYS_DIR}/platform/sdfw/src/suit_plat_component_compatibility.c +) + # Link with the CMake target, that includes SUIT platform internal APIs header zephyr_library_link_libraries(suit_utils) -zephyr_library_link_libraries(suit_mci) zephyr_library_link_libraries(suit_storage_interface) zephyr_library_link_libraries(suit_platform_interface) diff --git a/tests/subsys/suit/component_compatibility_check/prj.conf b/tests/subsys/suit/component_compatibility_check/prj.conf index 739c2fc55327..65bd9712b236 100644 --- a/tests/subsys/suit/component_compatibility_check/prj.conf +++ b/tests/subsys/suit/component_compatibility_check/prj.conf @@ -14,7 +14,6 @@ CONFIG_SUIT_MEMPTR_STORAGE=y # Enable component-compatibility checks CONFIG_SUIT_PLATFORM=y CONFIG_SUIT_PLATFORM_VARIANT_SDFW=y -CONFIG_SUIT_PLAT_CHECK_COMPONENT_COMPATIBILITY=y # Force SUIT storage memory layout to match nRF54H20-specific implementation. CONFIG_SUIT_STORAGE=y @@ -22,10 +21,6 @@ CONFIG_SUIT_STORAGE_LAYOUT_NRF54H20=y CONFIG_SUIT_METADATA=y # nRF54H20 storage uses SHA-256 to protect MPI and NVVs: CONFIG_SUIT_CRYPTO=y - -# Use nRF54H20-specific MCI implementation. -CONFIG_SUIT_MCI=y -CONFIG_SUIT_MCI_IMPL_NRF54H20_SDFW=y CONFIG_SUIT_EXECUTION_MODE=y CONFIG_ZCBOR=y