mcuboot icon indicating copy to clipboard operation
mcuboot copied to clipboard

[doc] Update PORTING.md with the required `flash_area_get_sector()` function footprint.

Open Nabav opened this issue 4 months ago • 0 comments

The mcuboot/boot/bootutil/src/bootutil_misc.c uses the flash_area_get_sector() function from flash map backend porting at flash_map_backend/flash_map_backend.h. Therefore the porting attempt should also implement and expose this function. However, this is missing in the porting guide.

/* Retrieve the flash sector withing given flash area, at a given offset.
 *
 * @param fa        flash area where the sector is taken from.
 * @param off       offset within flash area.
 * @param sector    structure of sector information.
 * Returns 0 on success, -ERANGE if @p off is beyond flash area size,
 *         other negative errno code on failure.
 */
int flash_area_get_sector(const struct flash_area *fa,
                          off_t off,
                          struct flash_sector *sector);

It's worth mentioning that the offset specified by off parameter and the resulting offset in sector->fs_off are both with respect to the origin of the given flash area not the whole flash device, if I have understood it correctly.

Nabav avatar Jul 18 '25 10:07 Nabav