Skip to content

Commit e8c343b

Browse files
committed
[nrf noup] boot/zephyr/nrf54h20_custom_s2ram: direct-xip support
Added direct-xip support: * new API for marking active slot to be used by boot_go() routines. * jump vector assignment which is basing on above designation. Signed-off-by: Andrzej Puzdrowski <[email protected]>
1 parent f34b20b commit e8c343b

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

boot/zephyr/nrf54h20_custom_s2ram.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,20 @@ volatile struct mcuboot_resume_s mcuboot_resume;
3030
COND_CODE_0(DT_FIXED_PARTITION_EXISTS(DT_NODELABEL(node_label)), (0), \
3131
(DT_REG_ADDR(DT_GPARENT(DT_NODELABEL(node_label))))))
3232

33+
#define S2RAM_SLOT_INFO_A 0x37
34+
#define S2RAM_SLOT_INFO_B 0xA4
35+
36+
#ifdef CONFIG_BOOT_DIRECT_XIP
37+
/* Called by the image manager when setting the image as active for current boot. */
38+
void s2ram_designate_slot(uint8_t slot)
39+
{
40+
if (slot == 0) {
41+
mcuboot_resume.slot_info = S2RAM_SLOT_INFO_A;
42+
} else {
43+
mcuboot_resume.slot_info = S2RAM_SLOT_INFO_B;
44+
}
45+
}
46+
#endif
3347

3448
int soc_s2ram_suspend(pm_s2ram_system_off_fn_t system_off)
3549
{
@@ -72,8 +86,22 @@ bool pm_s2ram_mark_check_and_clear(void)
7286

7387
/* s2ram boot */
7488
struct arm_vector_table *vt;
89+
90+
#ifdef CONFIG_BOOT_DIRECT_XIP
91+
if (mcuboot_resume.slot_info == S2RAM_SLOT_INFO_A) {
92+
vt = (struct arm_vector_table *)
93+
(FIXED_PARTITION_ADDR(slot0_partition) + APP_EXE_START_OFFSET);
94+
} else if (mcuboot_resume.slot_info == S2RAM_SLOT_INFO_B) {
95+
vt = (struct arm_vector_table *)
96+
(FIXED_PARTITION_ADDR(slot1_partition) + APP_EXE_START_OFFSET);
97+
} else {
98+
/* invalid slot info */
99+
goto resume_failed;
100+
}
101+
#else
75102
vt = (struct arm_vector_table *)
76103
(FIXED_PARTITION_ADDR(slot0_partition) + APP_EXE_START_OFFSET);
104+
#endif
77105

78106
/* Jump to application */
79107
__asm__ volatile (

0 commit comments

Comments
 (0)