boot: Add a RAM base to support testing
Add a macro `IMAGE_RAM_BASE` that will support a simulated device RAM
that can be different per test. This will be zero on targets. Define
an invalid value (3) in the simulator environment. As there are not yet
tests of this configuration, all tests will continue to pass.
Signed-off-by: David Brown <david.brown@linaro.org>
diff --git a/boot/bootutil/src/bootutil_priv.h b/boot/bootutil/src/bootutil_priv.h
index c3807af..3d48225 100644
--- a/boot/bootutil/src/bootutil_priv.h
+++ b/boot/bootutil/src/bootutil_priv.h
@@ -403,10 +403,14 @@
#endif /* !defined(MCUBOOT_USE_FLASH_AREA_GET_SECTORS) */
#ifdef MCUBOOT_RAM_LOAD
+#define IMAGE_RAM_BASE ((uintptr_t)0)
+
#define LOAD_IMAGE_DATA(hdr, fap, start, output, size) \
- (memcpy((output),(void*)((hdr)->ih_load_addr + (start)), \
+ (memcpy((output),(void*)(IMAGE_RAM_BASE + (hdr)->ih_load_addr + (start)), \
(size)), 0)
#else
+#define IMAGE_RAM_BASE ((uintptr_t)0)
+
#define LOAD_IMAGE_DATA(hdr, fap, start, output, size) \
(flash_area_read((fap), (start), (output), (size)))
#endif /* MCUBOOT_RAM_LOAD */