Merge branch 'bugfix/size_calculation_in_ota_v3.3' into 'release/v3.3'
Fix size calculation to erase partition range for OTA image (v3.3) See merge request espressif/esp-idf!8268
This commit is contained in:
commit
04d46d5d61
1 changed files with 2 additions and 1 deletions
|
@ -165,7 +165,8 @@ esp_err_t esp_ota_begin(const esp_partition_t *partition, size_t image_size, esp
|
||||||
if ((image_size == 0) || (image_size == OTA_SIZE_UNKNOWN)) {
|
if ((image_size == 0) || (image_size == OTA_SIZE_UNKNOWN)) {
|
||||||
ret = esp_partition_erase_range(partition, 0, partition->size);
|
ret = esp_partition_erase_range(partition, 0, partition->size);
|
||||||
} else {
|
} else {
|
||||||
ret = esp_partition_erase_range(partition, 0, (image_size / SPI_FLASH_SEC_SIZE + 1) * SPI_FLASH_SEC_SIZE);
|
const int aligned_erase_size = (image_size + SPI_FLASH_SEC_SIZE - 1) & ~(SPI_FLASH_SEC_SIZE - 1);
|
||||||
|
ret = esp_partition_erase_range(partition, 0, aligned_erase_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret != ESP_OK) {
|
if (ret != ESP_OK) {
|
||||||
|
|
Loading…
Reference in a new issue