Skip to content

Commit e79c78e

Browse files
boot/zephyr: Load image to RAM on single loader
Now that's possible to load image to RAM on single loaders, add support on Zephyr port for that. Signed-off-by: Ederson de Souza <[email protected]>
1 parent db454d2 commit e79c78e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

boot/zephyr/single_loader.c

+15
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,29 @@ boot_go(struct boot_rsp *rsp)
111111
if (rc != 0)
112112
goto out;
113113

114+
#ifdef MCUBOOT_RAM_LOAD
115+
static struct boot_loader_state state;
116+
state.imgs[0][0].hdr = _hdr;
117+
118+
rc = boot_load_image_to_sram(&state);
119+
if (rc != 0)
120+
goto out;
121+
#endif
122+
114123
#ifdef MCUBOOT_VALIDATE_PRIMARY_SLOT
115124
FIH_CALL(boot_image_validate, fih_rc, _fa_p, &_hdr);
116125
if (FIH_NOT_EQ(fih_rc, FIH_SUCCESS)) {
126+
#ifdef MCUBOOT_RAM_LOAD
127+
boot_remove_image_from_sram(&state);
128+
#endif
117129
goto out;
118130
}
119131
#elif defined(MCUBOOT_VALIDATE_PRIMARY_SLOT_ONCE)
120132
FIH_CALL(boot_image_validate_once, fih_rc, _fa_p, &_hdr);
121133
if (FIH_NOT_EQ(fih_rc, FIH_SUCCESS)) {
134+
#ifdef MCUBOOT_RAM_LOAD
135+
boot_remove_image_from_sram(&state);
136+
#endif
122137
goto out;
123138
}
124139
#else

0 commit comments

Comments
 (0)