Commit 707a69d4 authored by Almir Okato's avatar Almir Okato Committed by Gustavo Henrique Nihei
Browse files

boot_serial: espressif: enable erase progressively option on serial recovery

parent 0dcdbab8
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -143,6 +143,18 @@
#define CONFIG_MCUBOOT_SERIAL
#endif

/*
 * When a serial recovery process is receiving the image data, this option
 * enables it to erase flash progressively (by sectors) instead of the
 * default behavior that is erasing whole image size of flash area after
 * receiving first frame.
 * Enabling this options prevents stalling the beginning of transfer
 * for the time needed to erase large chunk of flash.
 */
#ifdef CONFIG_ESP_MCUBOOT_ERASE_PROGRESSIVELY
#define MCUBOOT_ERASE_PROGRESSIVELY
#endif

/* Serial extensions are not implemented
 */
#define MCUBOOT_PERUSER_MGMT_GROUP_ENABLED 0
+3 −0
Original line number Diff line number Diff line
@@ -77,6 +77,9 @@ uint8_t flash_area_erased_val(const struct flash_area *area);
int flash_area_get_sectors(int fa_id, uint32_t *count,
                           struct flash_sector *sectors);

//! Retrieve the flash sector a given offset belongs to.
int flash_area_sector_from_off(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
+3 −0
Original line number Diff line number Diff line
@@ -15,6 +15,9 @@ CONFIG_ESP_SCRATCH_SIZE=0x40000
# Enables the MCUboot Serial Recovery, that allows the use of
# MCUMGR to upload a firmware through the serial port
# CONFIG_ESP_MCUBOOT_SERIAL=y
# Use sector erasing instead of entire image size erasing
# when uploading through Serial Recovery
# CONFIG_ESP_MCUBOOT_ERASE_PROGRESSIVELY=y
# GPIO used to boot on Serial Recovery
# CONFIG_ESP_SERIAL_BOOT_GPIO_DETECT=32
# GPIO input type (0 for Pull-down, 1 for Pull-up)
+8 −0
Original line number Diff line number Diff line
@@ -364,6 +364,14 @@ int flash_area_get_sectors(int fa_id, uint32_t *count,
    return 0;
}

int flash_area_sector_from_off(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__);