mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-06 05:21:22 +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:
parent
ebae47c13a
commit
5b500e4e34
@ -128,13 +128,14 @@ int copy_raw(const uint32_t src_addr,
|
|||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
int res = 9;
|
int res = 9;
|
||||||
|
bool clear_cmd = false;
|
||||||
struct eboot_command cmd;
|
struct eboot_command cmd;
|
||||||
|
|
||||||
print_version(0);
|
print_version(0);
|
||||||
|
|
||||||
if (eboot_command_read(&cmd) == 0) {
|
if (eboot_command_read(&cmd) == 0) {
|
||||||
// valid command was passed via RTC_MEM
|
// valid command was passed via RTC_MEM
|
||||||
eboot_command_clear();
|
clear_cmd = true;
|
||||||
ets_putc('@');
|
ets_putc('@');
|
||||||
} else {
|
} else {
|
||||||
// no valid command found
|
// no valid command found
|
||||||
@ -155,6 +156,10 @@ void main()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (clear_cmd) {
|
||||||
|
eboot_command_clear();
|
||||||
|
}
|
||||||
|
|
||||||
if (cmd.action == ACTION_LOAD_APP) {
|
if (cmd.action == ACTION_LOAD_APP) {
|
||||||
ets_putc('l'); ets_putc('d'); ets_putc('\n');
|
ets_putc('l'); ets_putc('d'); ets_putc('\n');
|
||||||
res = load_app_from_flash_raw(cmd.args[0]);
|
res = load_app_from_flash_raw(cmd.args[0]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user