Skip to content

Commit 5b500e4

Browse files
ChocolateFrogsNutsdevyte
authored andcommitted
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.
1 parent ebae47c commit 5b500e4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

bootloaders/eboot/eboot.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,14 @@ int copy_raw(const uint32_t src_addr,
128128
void main()
129129
{
130130
int res = 9;
131+
bool clear_cmd = false;
131132
struct eboot_command cmd;
132133

133134
print_version(0);
134135

135136
if (eboot_command_read(&cmd) == 0) {
136137
// valid command was passed via RTC_MEM
137-
eboot_command_clear();
138+
clear_cmd = true;
138139
ets_putc('@');
139140
} else {
140141
// no valid command found
@@ -155,6 +156,10 @@ void main()
155156
}
156157
}
157158

159+
if (clear_cmd) {
160+
eboot_command_clear();
161+
}
162+
158163
if (cmd.action == ACTION_LOAD_APP) {
159164
ets_putc('l'); ets_putc('d'); ets_putc('\n');
160165
res = load_app_from_flash_raw(cmd.args[0]);

0 commit comments

Comments
 (0)