sim: get status area size from bootutil
Add new bootutil function that returns the size of the status area.
The simulator was updated to remove the custom calculation and get
the size directly from bootutil, avoiding breakages the happen when
both are not in sync.
Signed-off-by: Fabio Utzig <utzig@apache.org>
diff --git a/boot/bootutil/src/bootutil_misc.c b/boot/bootutil/src/bootutil_misc.c
index 6c05eff..a29a27d 100644
--- a/boot/bootutil/src/bootutil_misc.c
+++ b/boot/bootutil/src/bootutil_misc.c
@@ -148,10 +148,17 @@
}
uint32_t
+boot_status_sz(uint32_t min_write_sz)
+{
+ return /* state for all sectors */
+ BOOT_STATUS_MAX_ENTRIES * BOOT_STATUS_STATE_COUNT * min_write_sz;
+}
+
+uint32_t
boot_trailer_sz(uint32_t min_write_sz)
{
return /* state for all sectors */
- BOOT_STATUS_MAX_ENTRIES * BOOT_STATUS_STATE_COUNT * min_write_sz +
+ boot_status_sz(min_write_sz) +
#ifdef MCUBOOT_ENC_IMAGES
/* encryption keys */
BOOT_ENC_KEY_SIZE * 2 +