espressif: Add flash_area_get_sector

Commits adds implementation of flash_area_get_sector that
is supposed to replace flash_area_sector_from_off.
The flash_area_get_sector gets additional parameter of flash_area
type, while flash_area_sector_from_off uses hardcoded flash_area.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
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 804b768..4bd3d2e 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 @@
 //! 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 088749c..ea0661f 100644
--- a/boot/espressif/port/esp_mcuboot.c
+++ b/boot/espressif/port/esp_mcuboot.c
@@ -372,6 +372,15 @@
     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__);