Update trailer format
This implements changes according to MCUB-14, easing the process
of making external apps parse and read/write the trailer.
Signed-off-by: Fabio Utzig <utzig@apache.org>
diff --git a/boot/bootutil/src/loader.c b/boot/bootutil/src/loader.c
index bd92df0..dc1e88d 100644
--- a/boot/bootutil/src/loader.c
+++ b/boot/bootutil/src/loader.c
@@ -471,7 +471,7 @@
uint32_t off;
int area_id;
int rc;
- uint8_t buf[8];
+ uint8_t buf[BOOT_MAX_ALIGN];
uint8_t align;
/* NOTE: The first sector copied (that is the last sector on slot) contains
@@ -498,7 +498,7 @@
BOOT_WRITE_SZ(&boot_data));
align = hal_flash_align(fap->fa_device_id);
- memset(buf, 0xFF, 8);
+ memset(buf, 0xFF, BOOT_MAX_ALIGN);
buf[0] = bs->state;
rc = flash_area_write(fap, off, buf, align);
@@ -945,7 +945,7 @@
/* copy current status that is being maintained in scratch */
rc = boot_copy_sector(FLASH_AREA_IMAGE_SCRATCH, FLASH_AREA_IMAGE_0,
scratch_trailer_off,
- img_off + copy_sz + BOOT_MAGIC_SZ,
+ img_off + copy_sz,
BOOT_STATUS_STATE_COUNT * BOOT_WRITE_SZ(&boot_data));
assert(rc == 0);