Take flash base address into account when booting.
Use flash_device_base() in the boot code to compute a real address,
given the offset returned by boot_go().
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
diff --git a/apps/boot/src/boot.c b/apps/boot/src/boot.c
index 9371186..0a26edb 100755
--- a/apps/boot/src/boot.c
+++ b/apps/boot/src/boot.c
@@ -47,6 +47,7 @@
main(void)
{
struct boot_rsp rsp;
+ uintptr_t flash_base;
int rc;
#if MYNEWT_VAL(BOOT_SERIAL)
@@ -70,7 +71,11 @@
rc = boot_go(&rsp);
assert(rc == 0);
- hal_system_start((void *)(rsp.br_image_off + rsp.br_hdr->ih_hdr_size));
+ rc = flash_device_base(rsp->br_flash_dev_id, &flash_base);
+ assert(rc == 0);
+
+ hal_system_start((void *)(flash_base + rsp.br_image_off +
+ rsp.br_hdr->ih_hdr_size));
return 0;
}