You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In components/app_update/esp_ota_ops.c:
In function esp_ota_begin:
An incorrect erase size is calculated when the caller passes image_size=partition->size.
This is because of an error in the rounding calculation at line 160, which adds an extra sector size:
ret = esp_partition_erase_range(partition, 0, (image_size / SPI_FLASH_SEC_SIZE + 1) * SPI_FLASH_SEC_SIZE);
The correct calculation would be something like:
ret = esp_partition_erase_range(partition, 0, ((image_size + SPI_FLASH_SEC_SIZE - 1) / SPI_FLASH_SEC_SIZE) * SPI_FLASH_SEC_SIZE);
The text was updated successfully, but these errors were encountered:
github-actionsbot
changed the title
Incorrect Erase Size Calculation In esp_ota_begin
Incorrect Erase Size Calculation In esp_ota_begin (IDFGH-2909)
Mar 18, 2020
In components/app_update/esp_ota_ops.c:
In function esp_ota_begin:
An incorrect erase size is calculated when the caller passes image_size=partition->size.
This is because of an error in the rounding calculation at line 160, which adds an extra sector size:
ret = esp_partition_erase_range(partition, 0, (image_size / SPI_FLASH_SEC_SIZE + 1) * SPI_FLASH_SEC_SIZE);
The correct calculation would be something like:
ret = esp_partition_erase_range(partition, 0, ((image_size + SPI_FLASH_SEC_SIZE - 1) / SPI_FLASH_SEC_SIZE) * SPI_FLASH_SEC_SIZE);
The text was updated successfully, but these errors were encountered: