From 025235f761af07eae33bd15d411122aa7a653a08 Mon Sep 17 00:00:00 2001 From: Ederson de Souza Date: Thu, 15 Aug 2024 16:35:07 -0700 Subject: [PATCH] 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 Signed-off-by: Tom Burdick --- boot/zephyr/single_loader.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/boot/zephyr/single_loader.c b/boot/zephyr/single_loader.c index 75374d2db..858f294ad 100644 --- a/boot/zephyr/single_loader.c +++ b/boot/zephyr/single_loader.c @@ -111,14 +111,29 @@ boot_go(struct boot_rsp *rsp) if (rc != 0) goto out; +#ifdef MCUBOOT_RAM_LOAD + static struct boot_loader_state state; + state.imgs[0][0].hdr = _hdr; + + rc = boot_load_image_to_sram(&state); + if (rc != 0) + goto out; +#endif + #ifdef MCUBOOT_VALIDATE_PRIMARY_SLOT FIH_CALL(boot_image_validate, fih_rc, _fa_p, &_hdr); if (FIH_NOT_EQ(fih_rc, FIH_SUCCESS)) { +#ifdef MCUBOOT_RAM_LOAD + boot_remove_image_from_sram(&state); +#endif goto out; } #elif defined(MCUBOOT_VALIDATE_PRIMARY_SLOT_ONCE) FIH_CALL(boot_image_validate_once, fih_rc, _fa_p, &_hdr); if (FIH_NOT_EQ(fih_rc, FIH_SUCCESS)) { +#ifdef MCUBOOT_RAM_LOAD + boot_remove_image_from_sram(&state); +#endif goto out; } #else