From ee1b7b9d6ea232ae1d38c2e8ef0e6c612458c43b Mon Sep 17 00:00:00 2001 From: Jim Tan Date: Thu, 7 Apr 2022 11:26:28 +0800 Subject: [PATCH] zephyr: fix booting address incorrect in ram-load mode Signed-off-by: Jim Tan --- boot/zephyr/main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/boot/zephyr/main.c b/boot/zephyr/main.c index 09a6f40d..5e20cb1d 100644 --- a/boot/zephyr/main.c +++ b/boot/zephyr/main.c @@ -297,8 +297,12 @@ static void do_boot(struct boot_rsp *rsp) */ static void do_boot(struct boot_rsp *rsp) { - uintptr_t flash_base; void *start; + +#if defined(MCUBOOT_RAM_LOAD) + start = (void *)(rsp->br_hdr->ih_load_addr + rsp->br_hdr->ih_hdr_size); +#else + uintptr_t flash_base; int rc; rc = flash_device_base(rsp->br_flash_dev_id, &flash_base); @@ -306,6 +310,7 @@ static void do_boot(struct boot_rsp *rsp) start = (void *)(flash_base + rsp->br_image_off + rsp->br_hdr->ih_hdr_size); +#endif /* Lock interrupts and dive into the entry point */ irq_lock();