zephyr: warn on boot if flash areas are still open
Add reference counting to the flash areas, and a zephyr-only routine
which warns when areas are still open when none should be. Call the
warn routine right before chain-loading.
This prints warnings due to code in loader.c. Future work will be
needed to clean this up.
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
diff --git a/boot/zephyr/main.c b/boot/zephyr/main.c
index 054c466..e5a1eb8 100644
--- a/boot/zephyr/main.c
+++ b/boot/zephyr/main.c
@@ -38,6 +38,8 @@
uint32_t reset;
};
+extern void zephyr_flash_area_warn_on_open(void);
+
static void do_boot(struct boot_rsp *rsp)
{
struct arm_vector_table *vt;
@@ -108,6 +110,7 @@
BOOT_LOG_INF("Bootloader chainload address offset: 0x%x",
rsp.br_image_off);
+ zephyr_flash_area_warn_on_open();
BOOT_LOG_INF("Jumping to the first image slot");
do_boot(&rsp);