File tree Expand file tree Collapse file tree 2 files changed +70
-0
lines changed Expand file tree Collapse file tree 2 files changed +70
-0
lines changed Original file line number Diff line number Diff line change @@ -487,6 +487,12 @@ zephyr_library_sources(
487487)
488488endif ()
489489
490+ if (CONFIG_SOC_NRF54H20_PM_S2RAM_OVERRIDE)
491+ zephyr_library_sources(
492+ ${BOOT_DIR} /zephyr/nrf54h20_custom_s2ram.c
493+ )
494+ endif ()
495+
490496if (CONFIG_MCUBOOT_BOOT_BANNER)
491497 # Replace Zephyr's boot banner with the MCUboot one
492498 zephyr_sources(kernel/banner.c)
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) 2025 Nordic Semiconductor ASA
3+ * SPDX-License-Identifier: Apache-2.0
4+ */
5+
6+ #include <stdbool.h>
7+ #include <zephyr/arch/common/pm_s2ram.h>
8+ #include <hal/nrf_resetinfo.h>
9+ #include "pm_s2ram.h"
10+ #include "power.h"
11+
12+ #include <zephyr/devicetree.h>
13+ #include <zephyr/storage/flash_map.h>
14+
15+ int soc_s2ram_suspend (pm_s2ram_system_off_fn_t system_off )
16+ {
17+ (void )(system_off );
18+ return -1 ;
19+ }
20+
21+ void pm_s2ram_mark_set (void )
22+ {
23+ /* empty */
24+ }
25+
26+ struct arm_vector_table {
27+ uint32_t msp ;
28+ uint32_t reset ;
29+ };
30+
31+ bool pm_s2ram_mark_check_and_clear (void )
32+ {
33+ uint32_t reset_reason = nrf_resetinfo_resetreas_local_get (NRF_RESETINFO );
34+
35+ if (reset_reason != NRF_RESETINFO_RESETREAS_LOCAL_UNRETAINED_MASK ) {
36+ // normal boot
37+ return false;
38+ }
39+
40+ // s2ram boot
41+ struct arm_vector_table * vt ;
42+ vt = (struct arm_vector_table * )(FIXED_PARTITION_OFFSET (slot0_partition ) + 0x800 );
43+
44+ // Jump to application
45+ __asm__ volatile (
46+ /* vt->reset -> r0 */
47+ " mov r0, %0\n"
48+ /* vt->msp -> r1 */
49+ " mov r1, %1\n"
50+ /* set stack pointer */
51+ " msr msp, r1\n"
52+ /* jump to reset vector of an app */
53+ " bx r0\n"
54+ :
55+ : "r" (vt -> reset ), "r" (vt -> msp )
56+ : "r0" , "r1" , "memory"
57+ );
58+
59+ while (1 )
60+ {
61+ }
62+
63+ return true;
64+ }
You can’t perform that action at this time.
0 commit comments