Rename br_image_addr to br_image_off.
The boot response returns a flash offset, not a flash address. This is
causing confusion and leading to crashes on some platforms which don't
have flash at address 0.
Rename the field to make it more clear what its purpose is; future
patches can start fixing up usages.
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
diff --git a/boot/bootutil/include/bootutil/bootutil.h b/boot/bootutil/include/bootutil/bootutil.h
index 0947f50..7f76877 100644
--- a/boot/bootutil/include/bootutil/bootutil.h
+++ b/boot/bootutil/include/bootutil/bootutil.h
@@ -51,10 +51,10 @@
/**
* The flash offset of the image to execute. Indicates the position of
- * the image header.
+ * the image header within its flash device.
*/
uint8_t br_flash_id;
- uint32_t br_image_addr;
+ uint32_t br_image_off;
};
/* you must have pre-allocated all the entries within this structure */
diff --git a/boot/bootutil/src/loader.c b/boot/bootutil/src/loader.c
index c4a292a..74c297c 100644
--- a/boot/bootutil/src/loader.c
+++ b/boot/bootutil/src/loader.c
@@ -1288,7 +1288,7 @@
/* Always boot from the primary slot. */
rsp->br_flash_id = boot_img_fa_device_id(&boot_data, 0);
- rsp->br_image_addr = boot_img_slot_off(&boot_data, 0);
+ rsp->br_image_off = boot_img_slot_off(&boot_data, 0);
rsp->br_hdr = boot_img_hdr(&boot_data, slot);
out:
diff --git a/boot/bootutil/test/src/boot_test_utils.c b/boot/bootutil/test/src/boot_test_utils.c
index 30297c8..54fa338 100644
--- a/boot/bootutil/test/src/boot_test_utils.c
+++ b/boot/bootutil/test/src/boot_test_utils.c
@@ -505,7 +505,7 @@
TEST_ASSERT(memcmp(rsp.br_hdr, slot0hdr, sizeof *slot0hdr) == 0);
TEST_ASSERT(rsp.br_flash_id == boot_test_img_addrs[0].flash_id);
- TEST_ASSERT(rsp.br_image_addr == boot_test_img_addrs[0].address);
+ TEST_ASSERT(rsp.br_image_off == boot_test_img_addrs[0].address);
boot_test_util_verify_flash(slot0hdr, orig_slot_0,
slot1hdr, orig_slot_1);