Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion arch/arm/core/cortex_m/pm_s2ram.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2022, Carlo Caione <[email protected]>
* Copyright (c) 2025 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand All @@ -14,7 +15,18 @@
/**
* CPU context for S2RAM
*/
__noinit _cpu_context_t _cpu_context;

#if DT_NODE_EXISTS(DT_NODELABEL(pm_s2ram)) &&\
DT_NODE_HAS_COMPAT(DT_NODELABEL(pm_s2ram), zephyr_memory_region)

Check notice on line 20 in arch/arm/core/cortex_m/pm_s2ram.c

View workflow job for this annotation

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

You may want to run clang-format on this change

arch/arm/core/cortex_m/pm_s2ram.c:20 -#if DT_NODE_EXISTS(DT_NODELABEL(pm_s2ram)) &&\ +#if DT_NODE_EXISTS(DT_NODELABEL(pm_s2ram)) && \

/* Linker section name is given by `zephyr,memory-region` property of
* `zephyr,memory-region` compatible DT node with nodelabel `pm_s2ram`.
*/
__attribute__((section(DT_PROP(DT_NODELABEL(pm_s2ram), zephyr_memory_region))))
#else
__noinit
#endif
_cpu_context_t _cpu_context;

#ifndef CONFIG_PM_S2RAM_CUSTOM_MARKING
/**
Expand Down
17 changes: 17 additions & 0 deletions boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts
Original file line number Diff line number Diff line change
Expand Up @@ -340,3 +340,20 @@ zephyr_udc0: &usbhs {
memory-regions = <&cpuapp_dma_region>;
status = "okay";
};

/* Trim this RAM block for making room on all run-time common S2RAM cpu context. */
&cpuapp_ram0 {
reg = <0x22000000 (DT_SIZE_K(32)-32)>;
ranges = <0x0 0x22000000 (0x8000-0x20)>;
};

/ {
soc {
/* run-time common S2RAM cpu context RAM */
pm_s2ram: cpuapp_s2ram@22007fe0 {
compatible = "zephyr,memory-region", "mmio-sram";
reg = <0x22007fe0 32>;
zephyr,memory-region = "pm_s2ram_context";
};
};
};
3 changes: 3 additions & 0 deletions subsys/pm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ config PM_S2RAM
depends on ARCH_HAS_SUSPEND_TO_RAM
help
This option enables suspend-to-RAM (S2RAM).
When enabled on Cortex-M, and a 'zephyr,memory-region' compatible node with nodelabel
'pm_s2ram' is defined in DT, _cpu_context symbol (located in arch/arm/core/cortex_m/pm_s2ram.c)
is placed in linker section given by 'zephyr,memory-region' property of aforementioned node.

config PM_S2RAM_CUSTOM_MARKING
bool "Use custom marking functions"
Expand Down
Loading