diff --git a/boot/espressif/include/flash_map_backend/flash_map_backend.h b/boot/espressif/include/flash_map_backend/flash_map_backend.h index 804b7683..4bd3d2ee 100644 --- a/boot/espressif/include/flash_map_backend/flash_map_backend.h +++ b/boot/espressif/include/flash_map_backend/flash_map_backend.h @@ -80,6 +80,10 @@ int flash_area_get_sectors(int fa_id, uint32_t *count, //! Retrieve the flash sector a given offset belongs to. int flash_area_sector_from_off(uint32_t off, struct flash_sector *sector); +//! Retrieve the flash sector a given offset belongs to. +int flash_area_get_sector(const struct flash_area *area, uint32_t off, + struct flash_sector *sector); + //! Returns the `fa_id` for slot, where slot is 0 (primary) or 1 (secondary). //! //! `image_index` (0 or 1) is the index of the image. Image index is diff --git a/boot/espressif/port/esp_mcuboot.c b/boot/espressif/port/esp_mcuboot.c index 088749c3..ea0661fd 100644 --- a/boot/espressif/port/esp_mcuboot.c +++ b/boot/espressif/port/esp_mcuboot.c @@ -372,6 +372,15 @@ int flash_area_sector_from_off(uint32_t off, struct flash_sector *sector) return 0; } +int flash_area_get_sector(const struct flash_area *fa, uint32_t off, + struct flash_sector *sector) +{ + sector->fs_off = (off / FLASH_SECTOR_SIZE) * FLASH_SECTOR_SIZE; + sector->fs_size = FLASH_SECTOR_SIZE; + + return 0; +} + int flash_area_id_from_multi_image_slot(int image_index, int slot) { BOOT_LOG_DBG("%s", __func__);