1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

Resolve updater size check bug (#4550)

This commit is contained in:
Zhenyu Wu 2018-03-23 14:01:17 -04:00 committed by Develo
parent 559cb35025
commit 2d39bcba7d

View File

@ -86,7 +86,7 @@ bool UpdaterClass::begin(size_t size, int command) {
//size of the update rounded to a sector
uint32_t roundedSize = (size + FLASH_SECTOR_SIZE - 1) & (~(FLASH_SECTOR_SIZE - 1));
//address where we will start writing the update
updateStartAddress = updateEndAddress - roundedSize;
updateStartAddress = (updateEndAddress > roundedSize)? (updateEndAddress - roundedSize) : 0;
#ifdef DEBUG_UPDATER
DEBUG_UPDATER.printf("[begin] roundedSize: 0x%08X (%d)\n", roundedSize, roundedSize);
@ -390,4 +390,4 @@ void UpdaterClass::printError(Print &out){
}
}
UpdaterClass Update;
UpdaterClass Update;