File tree Expand file tree Collapse file tree 3 files changed +31
-4
lines changed Expand file tree Collapse file tree 3 files changed +31
-4
lines changed Original file line number Diff line number Diff line change @@ -343,19 +343,26 @@ zephyr_udc0: &usbhs {
343343
344344/* Trim this RAM block for making room on all run-time common S2RAM cpu context. */
345345&cpuapp_ram0 {
346- reg = <0x22000000 (DT_SIZE_K(32) - 48 )>;
347- ranges = <0x0 0x22000000 (0x8000 - 0x30 )>;
346+ reg = <0x22000000 (DT_SIZE_K(32) - 52 )>;
347+ ranges = <0x0 0x22000000 (0x8000 - 0x34 )>;
348348};
349349
350350/ {
351351 soc {
352352 /* temporary stack for S2RAM resume logic */
353- pm_s2ram_stack: cpuapp_s2ram_stack@22007fd0 {
353+ pm_s2ram_stack: cpuapp_s2ram_stack@22007fcc {
354354 compatible = "zephyr,memory-region", "mmio-sram";
355- reg = <0x22007fd0 16>;
355+ reg = <0x22007fcc 16>;
356356 zephyr,memory-region = "pm_s2ram_stack";
357357 };
358358
359+ /* run-time common mcuboot S2RAM support section */
360+ mcuboot_s2ram: cpuapp_s2ram@22007fdc {
361+ compatible = "zephyr,memory-region", "mmio-sram";
362+ reg = <0x22007fdc 4>;
363+ zephyr,memory-region = "mcuboot_s2ram_context";
364+ };
365+
359366 /* run-time common S2RAM cpu context RAM */
360367 pm_s2ram: cpuapp_s2ram@22007fe0 {
361368 compatible = "zephyr,memory-region", "mmio-sram";
Original file line number Diff line number Diff line change @@ -219,10 +219,24 @@ static void fpu_restore(_fpu_context_t *backup)
219219#endif /* !defined(CONFIG_FPU_SHARING) */
220220#endif /* defined(CONFIG_FPU) */
221221
222+ #if DT_NODE_EXISTS (DT_NODELABEL (mcuboot_s2ram )) && \
223+ DT_NODE_HAS_COMPAT (DT_NODELABEL (mcuboot_s2ram ), zephyr_memory_region )
224+ /* Linker section name is given by `zephyr,memory-region` property of
225+ * `zephyr,memory-region` compatible DT node with nodelabel `mcuboot_s2ram`.
226+ */
227+ __attribute__((section (DT_PROP (DT_NODELABEL (mcuboot_s2ram ), zephyr_memory_region ))))
228+ volatile struct mcuboot_resume_s _mcuboot_resume ;
229+
230+ #define SET_MCUBOOT_RESUME_MAGIC () _mcuboot_resume.magic = MCUBOOT_S2RAM_RESUME_MAGIC
231+ #else
232+ #define SET_MCUBOOT_RESUME_MAGIC ()
233+ #endif
234+
222235int soc_s2ram_suspend (pm_s2ram_system_off_fn_t system_off )
223236{
224237 int ret ;
225238
239+ SET_MCUBOOT_RESUME_MAGIC ();
226240 scb_save (& backup_data .scb_context );
227241#if defined(CONFIG_FPU )
228242#if !defined(CONFIG_FPU_SHARING )
Original file line number Diff line number Diff line change 1010#ifndef _ZEPHYR_SOC_ARM_NORDIC_NRF_PM_S2RAM_H_
1111#define _ZEPHYR_SOC_ARM_NORDIC_NRF_PM_S2RAM_H_
1212
13+ #define MCUBOOT_S2RAM_RESUME_MAGIC 0x75832419
14+
15+ struct mcuboot_resume_s {
16+ uint32_t magic ; /* magic value to identify valid structure */
17+ };
18+
1319/**
1420 * @brief Save CPU state on suspend
1521 *
You can’t perform that action at this time.
0 commit comments