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

Move eboot_command_clear to after firmware copy. (#6823)

The eboot command was cleared from the rtc mem before the firmware copy
making it possible for a power failure during an OTA update to brick the
esp until the firmware was loaded via USB because of a partial firmware
copy that would never be restarted.

Moving the eboot_command_clear to after the copy ensures that any partial
copy is restarted at next power on.
This commit is contained in:
Mike Nix 2019-11-22 09:37:12 +08:00 committed by Develo
parent ebae47c13a
commit 5b500e4e34

View File

@ -128,13 +128,14 @@ int copy_raw(const uint32_t src_addr,
void main()
{
int res = 9;
bool clear_cmd = false;
struct eboot_command cmd;
print_version(0);
if (eboot_command_read(&cmd) == 0) {
// valid command was passed via RTC_MEM
eboot_command_clear();
clear_cmd = true;
ets_putc('@');
} else {
// no valid command found
@ -155,6 +156,10 @@ void main()
}
}
if (clear_cmd) {
eboot_command_clear();
}
if (cmd.action == ACTION_LOAD_APP) {
ets_putc('l'); ets_putc('d'); ets_putc('\n');
res = load_app_from_flash_raw(cmd.args[0]);