Skip to content

Commit b822d0f

Browse files
committed
hw/hal: Use 32 bit for flash alignment
This changes alignment type from uint8_t to uint32_t in several places. For flash_area_align() function 32 bits are already used by other platform supported by mcuboot. struct hal_flash also was using 32 bits before. Signed-off-by: Jerzy Kasenberg <[email protected]>
1 parent 3fbd10b commit b822d0f

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

hw/hal/include/hal/hal_flash.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ int hal_flash_isempty_no_buf(uint8_t id, uint32_t address, uint32_t num_bytes);
159159
*
160160
* @return The flash device's minimum write alignment.
161161
*/
162-
uint8_t hal_flash_align(uint8_t flash_id);
162+
uint32_t hal_flash_align(uint8_t flash_id);
163163

164164
/**
165165
* @brief Determines the value of an erased byte for a particular flash device.

hw/hal/src/hal_flash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ hal_flash_init(void)
5353
return rc;
5454
}
5555

56-
uint8_t
56+
uint32_t
5757
hal_flash_align(uint8_t flash_id)
5858
{
5959
const struct hal_flash *hf;

sys/flash_map/include/flash_map/flash_map.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ struct flash_sector_range {
6060
uint16_t fsr_first_sector;
6161
uint16_t fsr_sector_count;
6262
uint32_t fsr_sector_size;
63-
uint8_t fsr_align;
63+
uint32_t fsr_align;
6464
};
6565

6666
extern const struct flash_area *flash_map;
@@ -106,7 +106,7 @@ int flash_area_read_is_empty(const struct flash_area *, uint32_t off, void *dst,
106106
/*
107107
* Alignment restriction for flash writes.
108108
*/
109-
uint8_t flash_area_align(const struct flash_area *);
109+
uint32_t flash_area_align(const struct flash_area *fa);
110110

111111
/*
112112
* Value read from flash when it is erased.

sys/flash_map/src/flash_map.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ flash_area_erase(const struct flash_area *fa, uint32_t off, uint32_t len)
275275
return hal_flash_erase(fa->fa_device_id, fa->fa_off + off, len);
276276
}
277277

278-
uint8_t
278+
uint32_t
279279
flash_area_align(const struct flash_area *fa)
280280
{
281281
return hal_flash_align(fa->fa_device_id);

0 commit comments

Comments
 (0)