Skip to content

Commit 05b77ec

Browse files
rugeGerritsenkartben
authored andcommitted
soc: nordic: nrf54h: s2ram: Support disabled MPU
This commit adds support using pm_s2ram for 54H when the MPU is disabled. This is the case for the out of tree sample `sdk-nrf/samples/nrf54h/empty_app_core`. Without this commit the linker will fail to link `z_arm_mpu_init` and `z_arm_configure_static_mpu_regions`. Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
1 parent 5dd3bd5 commit 05b77ec

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

soc/nordic/nrf54h/pm_s2ram.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ typedef struct {
7676

7777
struct backup {
7878
_nvic_context_t nvic_context;
79+
#if defined(CONFIG_MPU)
7980
_mpu_context_t mpu_context;
81+
#endif
8082
_scb_context_t scb_context;
8183
#if defined(CONFIG_FPU) && !defined(CONFIG_FPU_SHARING)
8284
_fpu_context_t fpu_context;
@@ -88,6 +90,7 @@ static __noinit struct backup backup_data;
8890
extern void z_arm_configure_static_mpu_regions(void);
8991
extern int z_arm_mpu_init(void);
9092

93+
#if defined(CONFIG_MPU)
9194
/* MPU registers cannot be simply copied because content of RBARx RLARx registers
9295
* depends on region which is selected by RNR register.
9396
*/
@@ -130,6 +133,7 @@ static void mpu_restore(_mpu_context_t *backup)
130133
MPU->RNR = rnr;
131134
MPU->CTRL = backup->CTRL;
132135
}
136+
#endif /* defined(CONFIG_MPU) */
133137

134138
static void nvic_save(_nvic_context_t *backup)
135139
{
@@ -231,7 +235,9 @@ int soc_s2ram_suspend(pm_s2ram_system_off_fn_t system_off)
231235
fpu_power_down();
232236
#endif
233237
nvic_save(&backup_data.nvic_context);
238+
#if defined(CONFIG_MPU)
234239
mpu_save(&backup_data.mpu_context);
240+
#endif
235241
ret = arch_pm_s2ram_suspend(system_off);
236242
/* Cache and FPU are powered down so power up is needed even if s2ram failed. */
237243
nrf_power_up_cache();
@@ -246,7 +252,9 @@ int soc_s2ram_suspend(pm_s2ram_system_off_fn_t system_off)
246252
return ret;
247253
}
248254

255+
#if defined(CONFIG_MPU)
249256
mpu_restore(&backup_data.mpu_context);
257+
#endif
250258
nvic_restore(&backup_data.nvic_context);
251259
scb_restore(&backup_data.scb_context);
252260

0 commit comments

Comments
 (0)