Commit ab449187 authored by David Brown's avatar David Brown Committed by David Brown
Browse files

boot: store write align as uint32_t

In overwrite-only mode, the write alignment is not used for much.
Making this a larger value will allow the alignment for a particular
device to be larger than a uint8_t.  This will make the trailer size
very large for these devices (and prevent
!defined(MCUBOOT_OVERWRITE_ONLY) from being used), but at least allows
the overwrite only mode to be used on these devices.

Signed-off-by: default avatarDavid Brown <david.brown@linaro.org>
parent 477ff5ba
Loading
Loading
Loading
Loading
+1 −1
Changes for boot/bootutil/src/bootutil_misc.c: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -148,7 +148,7 @@ boot_magic_compatible_check(uint8_t tbl_val, uint8_t val)
}

uint32_t
boot_trailer_sz(uint8_t min_write_sz)
boot_trailer_sz(uint32_t min_write_sz)
{
    return /* state for all sectors */
           BOOT_STATUS_MAX_ENTRIES * BOOT_STATUS_STATE_COUNT * min_write_sz +
+2 −2
Changes for boot/bootutil/src/bootutil_priv.h: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -214,7 +214,7 @@ struct boot_loader_state {
    } scratch;

    uint8_t swap_type[BOOT_IMAGE_NUMBER];
    uint8_t write_sz;
    uint32_t write_sz;

#if defined(MCUBOOT_ENC_IMAGES)
    struct enc_key_data enc[BOOT_IMAGE_NUMBER][BOOT_NUM_SLOTS];
@@ -229,7 +229,7 @@ int bootutil_verify_sig(uint8_t *hash, uint32_t hlen, uint8_t *sig,
                        size_t slen, uint8_t key_id);

int boot_magic_compatible_check(uint8_t tbl_val, uint8_t val);
uint32_t boot_trailer_sz(uint8_t min_write_sz);
uint32_t boot_trailer_sz(uint32_t min_write_sz);
int boot_status_entries(int image_index, const struct flash_area *fap);
uint32_t boot_status_off(const struct flash_area *fap);
uint32_t boot_swap_info_off(const struct flash_area *fap);
+3 −3
Changes for boot/bootutil/src/loader.c: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -363,11 +363,11 @@ boot_read_image_headers(struct boot_loader_state *state, bool require_all)
    return 0;
}

static uint8_t
static uint32_t
boot_write_sz(struct boot_loader_state *state)
{
    uint8_t elem_sz;
    uint8_t align;
    uint32_t elem_sz;
    uint32_t align;

    /* Figure out what size to write update status update as.  The size depends
     * on what the minimum write size is for scratch area, active image slot.