Skip to content

Commit fac2c22

Browse files
d3zd3zcfriedt
authored andcommitted
storage/flash_map: Use larger type for alignment
In MCUboot: commit 4aa286d2db2d02a8f0ff29cdc3304f3185dbe261 Author: Gustavo Henrique Nihei <[email protected]> Date: Wed Nov 24 14:54:56 2021 -0300 flash_map: Increase minimum supported write align via flash_area_align MCUboot changed the type of the alignment value in flash from a uint8_t to a uint32_t. Indeed, Zephyr contains flash devices that have a larger alignment than will fit in an 8-bit value. This generally means that `flash_area_align` will just return 0 on these platforms. Change call in Zephyr as well. This shouldn't cause any observable behavior changes in Zephyr, other than making some cases that don't work currently begin to work. If a client is storing these results in a u8, it will be truncated, the same as things were previously. If, however, the caller is prepared to handle a larger type, this will result in having correct information, instead of the truncated value. Signed-off-by: David Brown <[email protected]>
1 parent 8660457 commit fac2c22

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

include/storage/flash_map.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ int flash_area_erase(const struct flash_area *fa, off_t off, size_t len);
191191
*
192192
* @return Alignment restriction for flash writes in [B].
193193
*/
194-
uint8_t flash_area_align(const struct flash_area *fa);
194+
uint32_t flash_area_align(const struct flash_area *fa);
195195

196196
/**
197197
* Retrieve info about sectors within the area.

subsys/storage/flash_map/flash_map.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ int flash_area_erase(const struct flash_area *fa, off_t off, size_t len)
9393
return rc;
9494
}
9595

96-
uint8_t flash_area_align(const struct flash_area *fa)
96+
uint32_t flash_area_align(const struct flash_area *fa)
9797
{
9898
const struct device *dev;
9999

0 commit comments

Comments
 (0)