Skip to content

Commit

Permalink
hw/hal: Use 32 bit for flash alignment
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
kasjer committed Dec 2, 2024
1 parent 3fbd10b commit b822d0f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion hw/hal/include/hal/hal_flash.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ int hal_flash_isempty_no_buf(uint8_t id, uint32_t address, uint32_t num_bytes);
*
* @return The flash device's minimum write alignment.
*/
uint8_t hal_flash_align(uint8_t flash_id);
uint32_t hal_flash_align(uint8_t flash_id);

/**
* @brief Determines the value of an erased byte for a particular flash device.
Expand Down
2 changes: 1 addition & 1 deletion hw/hal/src/hal_flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ hal_flash_init(void)
return rc;
}

uint8_t
uint32_t
hal_flash_align(uint8_t flash_id)
{
const struct hal_flash *hf;
Expand Down
4 changes: 2 additions & 2 deletions sys/flash_map/include/flash_map/flash_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ struct flash_sector_range {
uint16_t fsr_first_sector;
uint16_t fsr_sector_count;
uint32_t fsr_sector_size;
uint8_t fsr_align;
uint32_t fsr_align;
};

extern const struct flash_area *flash_map;
Expand Down Expand Up @@ -106,7 +106,7 @@ int flash_area_read_is_empty(const struct flash_area *, uint32_t off, void *dst,
/*
* Alignment restriction for flash writes.
*/
uint8_t flash_area_align(const struct flash_area *);
uint32_t flash_area_align(const struct flash_area *fa);

/*
* Value read from flash when it is erased.
Expand Down
2 changes: 1 addition & 1 deletion sys/flash_map/src/flash_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ flash_area_erase(const struct flash_area *fa, uint32_t off, uint32_t len)
return hal_flash_erase(fa->fa_device_id, fa->fa_off + off, len);
}

uint8_t
uint32_t
flash_area_align(const struct flash_area *fa)
{
return hal_flash_align(fa->fa_device_id);
Expand Down

0 comments on commit b822d0f

Please sign in to comment.