Commit bd0d94ce authored by Dominik Ermel's avatar Dominik Ermel Committed by David Brown
Browse files

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: default avatarDominik Ermel <dominik.ermel@nordicsemi.no>
parent b1d4e001
Loading
Loading
Loading
Loading
+4 −0
Changes for boot/espressif/include/flash_map_backend/flash_map_backend.h: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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
+9 −0
Changes for boot/espressif/port/esp_mcuboot.c: 9 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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__);