diff --git a/subsys/suit/storage/src/suit_storage_nrf54h20.c b/subsys/suit/storage/src/suit_storage_nrf54h20.c index 0f5ab9163c4e..7fc0c2788f04 100644 --- a/subsys/suit/storage/src/suit_storage_nrf54h20.c +++ b/subsys/suit/storage/src/suit_storage_nrf54h20.c @@ -12,6 +12,10 @@ LOG_MODULE_REGISTER(suit_storage, CONFIG_SUIT_LOG_LEVEL); +/* SUIT storage partition is defined as reserved-memory region, thus it uses absolute addresses. */ +#define SUIT_STORAGE_OFFSET \ + (FIXED_PARTITION_OFFSET(suit_storage_partition) - DT_REG_ADDR(DT_CHOSEN(zephyr_flash))) +#define SUIT_STORAGE_SIZE FIXED_PARTITION_SIZE(suit_storage_partition) #define SUIT_STORAGE_NORDIC_ADDRESS suit_plat_mem_nvm_ptr_get(SUIT_STORAGE_NORDIC_OFFSET) #define SUIT_STORAGE_NORDIC_OFFSET FIXED_PARTITION_OFFSET(cpusec_suit_storage) #define SUIT_STORAGE_NORDIC_SIZE FIXED_PARTITION_SIZE(cpusec_suit_storage) @@ -22,6 +26,21 @@ LOG_MODULE_REGISTER(suit_storage, CONFIG_SUIT_LOG_LEVEL); #define SUIT_STORAGE_APP_OFFSET FIXED_PARTITION_OFFSET(cpuapp_suit_storage) #define SUIT_STORAGE_APP_SIZE FIXED_PARTITION_SIZE(cpuapp_suit_storage) +BUILD_ASSERT((SUIT_STORAGE_OFFSET <= SUIT_STORAGE_NORDIC_OFFSET) && + (SUIT_STORAGE_NORDIC_OFFSET + SUIT_STORAGE_NORDIC_SIZE <= + SUIT_STORAGE_OFFSET + SUIT_STORAGE_SIZE), + "Secure storage must be defined within SUIT storage partition"); + +BUILD_ASSERT((SUIT_STORAGE_OFFSET <= SUIT_STORAGE_RAD_OFFSET) && + (SUIT_STORAGE_RAD_OFFSET + SUIT_STORAGE_RAD_SIZE <= + SUIT_STORAGE_OFFSET + SUIT_STORAGE_SIZE), + "Radiocore storage must be defined within SUIT storage partition"); + +BUILD_ASSERT((SUIT_STORAGE_OFFSET <= SUIT_STORAGE_APP_OFFSET) && + (SUIT_STORAGE_APP_OFFSET + SUIT_STORAGE_APP_SIZE <= + SUIT_STORAGE_OFFSET + SUIT_STORAGE_SIZE), + "Application storage must be defined within SUIT storage partition"); + typedef uint8_t suit_storage_digest_t[32]; struct suit_storage_nvv { diff --git a/tests/subsys/suit/orchestrator/orchestrator_sdfw_nrf54h20/boards/native_posix.overlay b/tests/subsys/suit/orchestrator/orchestrator_sdfw_nrf54h20/boards/native_posix.overlay index 85fa29b5f28a..27b8766c307c 100644 --- a/tests/subsys/suit/orchestrator/orchestrator_sdfw_nrf54h20/boards/native_posix.overlay +++ b/tests/subsys/suit/orchestrator/orchestrator_sdfw_nrf54h20/boards/native_posix.overlay @@ -14,19 +14,23 @@ #size-cells = <1>; /* Use the last 32 kB of SecDom SUIT NVM storage. */ + suit_storage_partition: partition@1e9000 { + reg = <0x1e9000 DT_SIZE_K(32)>; + }; + /* Use the first 4kB as area reserved for Secure domain. */ - cpusec_suit_storage: partition@1e7000 { - reg = <0x1e7000 DT_SIZE_K(4)>; + cpusec_suit_storage: partition@1eb000 { + reg = <0x1eb000 DT_SIZE_K(4)>; }; /* Use the next 4kB as area reserved for Radio domain. */ - cpurad_suit_storage: partition@1e8000 { - reg = <0x1e8000 DT_SIZE_K(4)>; + cpurad_suit_storage: partition@1ec000 { + reg = <0x1ec000 DT_SIZE_K(4)>; }; /* Use the next 8kB as area reserved for Application domain. */ - cpuapp_suit_storage: partition@1e9000 { - reg = <0x1e9000 DT_SIZE_K(8)>; + cpuapp_suit_storage: partition@1ed000 { + reg = <0x1ed000 DT_SIZE_K(8)>; }; }; }; diff --git a/tests/subsys/suit/storage_nrf54h20/boards/native_posix.overlay b/tests/subsys/suit/storage_nrf54h20/boards/native_posix.overlay index 85fa29b5f28a..27b8766c307c 100644 --- a/tests/subsys/suit/storage_nrf54h20/boards/native_posix.overlay +++ b/tests/subsys/suit/storage_nrf54h20/boards/native_posix.overlay @@ -14,19 +14,23 @@ #size-cells = <1>; /* Use the last 32 kB of SecDom SUIT NVM storage. */ + suit_storage_partition: partition@1e9000 { + reg = <0x1e9000 DT_SIZE_K(32)>; + }; + /* Use the first 4kB as area reserved for Secure domain. */ - cpusec_suit_storage: partition@1e7000 { - reg = <0x1e7000 DT_SIZE_K(4)>; + cpusec_suit_storage: partition@1eb000 { + reg = <0x1eb000 DT_SIZE_K(4)>; }; /* Use the next 4kB as area reserved for Radio domain. */ - cpurad_suit_storage: partition@1e8000 { - reg = <0x1e8000 DT_SIZE_K(4)>; + cpurad_suit_storage: partition@1ec000 { + reg = <0x1ec000 DT_SIZE_K(4)>; }; /* Use the next 8kB as area reserved for Application domain. */ - cpuapp_suit_storage: partition@1e9000 { - reg = <0x1e9000 DT_SIZE_K(8)>; + cpuapp_suit_storage: partition@1ed000 { + reg = <0x1ed000 DT_SIZE_K(8)>; }; }; };