Boot: Change the return type of flash_area_align()
Change from uint8_t to uint32_t to prevent an implicit cast. Update
variables and functions which use the return value of the function.
Change-Id: I55bcb1cf2b4b642d1cdf8a1d41c04e601289dea0
Signed-off-by: Raef Coles <raef.coles@arm.com>
diff --git a/bl2/ext/mcuboot/bootutil/src/bootutil_misc.c b/bl2/ext/mcuboot/bootutil/src/bootutil_misc.c
index 9ce0ff1..08f2a3c 100644
--- a/bl2/ext/mcuboot/bootutil/src/bootutil_misc.c
+++ b/bl2/ext/mcuboot/bootutil/src/bootutil_misc.c
@@ -172,7 +172,7 @@
}
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 +
@@ -204,7 +204,7 @@
boot_status_off(const struct flash_area *fap)
{
uint32_t off_from_end;
- uint8_t elem_sz;
+ uint32_t elem_sz;
elem_sz = flash_area_align(fap);
@@ -410,7 +410,7 @@
uint8_t val)
{
uint8_t buf[BOOT_MAX_ALIGN];
- uint8_t align;
+ uint32_t align;
uint8_t erased_val;
int rc;
@@ -478,7 +478,7 @@
uint32_t off;
int rc;
uint8_t buf[BOOT_MAX_ALIGN];
- uint8_t align;
+ uint32_t align;
uint8_t erased_val;
off = boot_swap_size_off(fap);
diff --git a/bl2/ext/mcuboot/bootutil/src/bootutil_priv.h b/bl2/ext/mcuboot/bootutil/src/bootutil_priv.h
index f8e1012..1235fc9 100644
--- a/bl2/ext/mcuboot/bootutil/src/bootutil_priv.h
+++ b/bl2/ext/mcuboot/bootutil/src/bootutil_priv.h
@@ -201,7 +201,7 @@
} scratch;
uint8_t swap_type[BOOT_IMAGE_NUMBER];
- uint8_t write_sz;
+ uint32_t write_sz;
};
uint32_t boot_secure_memequal(const void *s1, const void *s2, size_t n);
@@ -209,7 +209,7 @@
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(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);
diff --git a/bl2/ext/mcuboot/bootutil/src/loader.c b/bl2/ext/mcuboot/bootutil/src/loader.c
index 406257e..abf88df 100644
--- a/bl2/ext/mcuboot/bootutil/src/loader.c
+++ b/bl2/ext/mcuboot/bootutil/src/loader.c
@@ -209,11 +209,11 @@
return 0;
}
-static uint8_t
+static uint32_t
boot_write_sz(void)
{
- 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.
@@ -763,7 +763,7 @@
int area_id;
int rc;
uint8_t buf[BOOT_MAX_ALIGN];
- uint8_t align;
+ uint32_t align;
uint8_t erased_val;
/* NOTE: The first sector copied (that is the last sector on slot) contains
diff --git a/bl2/ext/mcuboot/flash_map.c b/bl2/ext/mcuboot/flash_map.c
index 5cbb824..2d865a7 100644
--- a/bl2/ext/mcuboot/flash_map.c
+++ b/bl2/ext/mcuboot/flash_map.c
@@ -257,7 +257,7 @@
return rc;
}
-uint8_t flash_area_align(const struct flash_area *area)
+uint32_t flash_area_align(const struct flash_area *area)
{
ARM_FLASH_INFO *flash_info;
diff --git a/bl2/ext/mcuboot/include/flash_map/flash_map.h b/bl2/ext/mcuboot/include/flash_map/flash_map.h
index 3f00a5d..8c73d8f 100644
--- a/bl2/ext/mcuboot/include/flash_map/flash_map.h
+++ b/bl2/ext/mcuboot/include/flash_map/flash_map.h
@@ -166,7 +166,7 @@
/*
* Alignment restriction for flash writes.
*/
-uint8_t flash_area_align(const struct flash_area *area);
+uint32_t flash_area_align(const struct flash_area *area);
/*
* Given flash area ID, return info about sectors within the area.