Skip to content

Commit 6ae2bac

Browse files
[nrf fromlist] soc: nordic: nrf54h: Disable code relocation for MCUBOOT
MCUBOOT requires LTO to be enabled, while using code relocation forces switching it off. When `__ramfunc` is used, LTO can also be used. Then the `cache_retain_and_sleep` function will execute properly, but a bit slower. Upstream PR #: Signed-off-by: Adam Kondraciuk <[email protected]>
1 parent 4d3597a commit 6ae2bac

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ config POWER_DOMAIN
1515
default y
1616

1717
config CODE_DATA_RELOCATION
18-
default y if PM || POWEROFF
18+
default y if (PM || POWEROFF) && !MCUBOOT
1919

2020
endif # SOC_NRF54H20_CPUAPP

soc/nordic/nrf54h/power.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,12 @@ void nrf_poweroff(void)
8888
CODE_UNREACHABLE;
8989
}
9090

91-
static __attribute__((__used__, noinline)) void cache_retain_and_sleep(void)
91+
#if CONFIG_MCUBOOT
92+
static __ramfunc
93+
#else
94+
static __attribute__((__used__, noinline))
95+
#endif
96+
void cache_retain_and_sleep(void)
9297
{
9398
nrf_cache_task_trigger(NRF_DCACHE, NRF_CACHE_TASK_SAVE);
9499
nrf_cache_task_trigger(NRF_ICACHE, NRF_CACHE_TASK_SAVE);

0 commit comments

Comments
 (0)