From 09f6539629612cd9e7774589bb0eab62cd40d803 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Thu, 18 Sep 2025 15:56:42 +0200 Subject: [PATCH 1/2] [nrf noup] boot/zephyr: improve S2RAM resume support using dedicated API nrf-squash! [nrf noup] boot/zephyr: nRF54h20 resume from S2RAM (hardened) CONFIG_PM_S2RAM_RESUME_INTERMEDIARY=y allow to rework the resume from S2RAM code to work without PM_S2RAM mocking. Its allow to implement only what really needed from the MCUboot perspective. Signed-off-by: Andrzej Puzdrowski --- boot/zephyr/CMakeLists.txt | 2 +- boot/zephyr/nrf54h20_custom_s2ram.c | 18 ++---------------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/boot/zephyr/CMakeLists.txt b/boot/zephyr/CMakeLists.txt index 6bd93f35a..d49bcb64e 100644 --- a/boot/zephyr/CMakeLists.txt +++ b/boot/zephyr/CMakeLists.txt @@ -496,7 +496,7 @@ if(CONFIG_MCUBOOT_CLEANUP_ARM_CORE) ) endif() -if(CONFIG_SOC_NRF54H20_PM_S2RAM_OVERRIDE) +if(CONFIG_ARCH_PM_S2RAM_RESUME) zephyr_library_sources(${BOOT_DIR}/zephyr/nrf54h20_custom_s2ram.c) endif() diff --git a/boot/zephyr/nrf54h20_custom_s2ram.c b/boot/zephyr/nrf54h20_custom_s2ram.c index 7b70e22fe..cd57f001d 100644 --- a/boot/zephyr/nrf54h20_custom_s2ram.c +++ b/boot/zephyr/nrf54h20_custom_s2ram.c @@ -30,18 +30,6 @@ volatile struct mcuboot_resume_s mcuboot_resume; COND_CODE_0(DT_FIXED_PARTITION_EXISTS(DT_NODELABEL(node_label)), (0), \ (DT_REG_ADDR(DT_GPARENT(DT_NODELABEL(node_label)))))) - -int soc_s2ram_suspend(pm_s2ram_system_off_fn_t system_off) -{ - (void)(system_off); - return -1; -} - -void pm_s2ram_mark_set(void) -{ - /* empty */ -} - struct arm_vector_table { uint32_t msp; uint32_t reset; @@ -52,13 +40,13 @@ struct arm_vector_table { */ #define APP_EXE_START_OFFSET 0x800 /* nRF54H20 */ -bool pm_s2ram_mark_check_and_clear(void) +void pm_s2ram_mark_check_and_mediate(void) { uint32_t reset_reason = nrf_resetinfo_resetreas_local_get(NRF_RESETINFO); if (reset_reason != NRF_RESETINFO_RESETREAS_LOCAL_UNRETAINED_MASK) { /* Normal boot */ - return false; + return; } /* S2RAM resume expected, do doublecheck */ @@ -92,6 +80,4 @@ bool pm_s2ram_mark_check_and_clear(void) resume_failed: FIH_PANIC; - - return true; } From d2dd6193193b083235a5a579b2bf2679e6cec9a7 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Fri, 26 Sep 2025 13:56:46 +0200 Subject: [PATCH 2/2] [nrf noup] boot/zephyr/socs: update nrf54h20 prj.conf for S2RAM nrf-squash! [nrf noup] boot/zephyr/socs: nrf54h20 prj.conf for S2RAM Updated in order to use optimized configuration. Signed-off-by: Andrzej Puzdrowski --- boot/zephyr/socs/nrf54h20_cpuapp.conf | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/boot/zephyr/socs/nrf54h20_cpuapp.conf b/boot/zephyr/socs/nrf54h20_cpuapp.conf index 9e75ccbb9..8dd5fbebd 100644 --- a/boot/zephyr/socs/nrf54h20_cpuapp.conf +++ b/boot/zephyr/socs/nrf54h20_cpuapp.conf @@ -7,8 +7,4 @@ # after suspend to RAM (S2RAM) requested by the application. # MCUboot does not support S2RAM itself, but serves as an immediate actor while waking up # from suspension. -CONFIG_PM=y -CONFIG_PM_DEVICE=n -CONFIG_PM_S2RAM=y -CONFIG_PM_S2RAM_CUSTOM_MARKING=y -CONFIG_SOC_NRF54H20_PM_S2RAM_OVERRIDE=y +CONFIG_ARCH_PM_S2RAM_RESUME=y