Skip to content

Commit

Permalink
suit: Remove SoC name from MCI symbols
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
tomchy committed Jan 21, 2025
1 parent fbec239 commit 6eb113e
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 11 deletions.
4 changes: 3 additions & 1 deletion subsys/suit/mci/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 9 additions & 4 deletions subsys/suit/mci/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,19 @@ menuconfig SUIT_MCI

if SUIT_MCI

config SUPPORT_SUIT_MCI_IMPL_SDFW
bool

Check warning on line 15 in subsys/suit/mci/Kconfig

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

LEADING_SPACE

subsys/suit/mci/Kconfig:15 please, no spaces at the start of a line
default y if SOC_SERIES_NRF54HX

Check warning on line 16 in subsys/suit/mci/Kconfig

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

LEADING_SPACE

subsys/suit/mci/Kconfig:16 please, no spaces at the start of a line

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"
Expand Down
2 changes: 2 additions & 0 deletions tests/subsys/suit/cmake/test_template.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
11 changes: 10 additions & 1 deletion tests/subsys/suit/component_compatibility_check/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
5 changes: 0 additions & 5 deletions tests/subsys/suit/component_compatibility_check/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,13 @@ 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
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
Expand Down

0 comments on commit 6eb113e

Please sign in to comment.