mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
Make sure WDT is re-enabled in eboot even in case of error (#517)
This commit is contained in:
parent
481cee6460
commit
91ca9ba75b
@ -90,25 +90,21 @@ int copy_raw(const uint32_t src_addr,
|
||||
uint32_t saddr = src_addr;
|
||||
uint32_t daddr = dst_addr;
|
||||
|
||||
ets_wdt_disable();
|
||||
|
||||
while (left) {
|
||||
if (SPIEraseSector(daddr/buffer_size)) {
|
||||
return 2;
|
||||
}
|
||||
if (SPIRead(saddr, buffer, buffer_size)) {
|
||||
return 3;
|
||||
}
|
||||
if (SPIWrite(daddr, buffer, buffer_size)) {
|
||||
return 4;
|
||||
}
|
||||
saddr += buffer_size;
|
||||
daddr += buffer_size;
|
||||
left -= buffer_size;
|
||||
if (SPIEraseSector(daddr/buffer_size)) {
|
||||
return 2;
|
||||
}
|
||||
if (SPIRead(saddr, buffer, buffer_size)) {
|
||||
return 3;
|
||||
}
|
||||
if (SPIWrite(daddr, buffer, buffer_size)) {
|
||||
return 4;
|
||||
}
|
||||
saddr += buffer_size;
|
||||
daddr += buffer_size;
|
||||
left -= buffer_size;
|
||||
}
|
||||
|
||||
ets_wdt_enable();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -130,7 +126,9 @@ void main()
|
||||
|
||||
if (cmd.action == ACTION_COPY_RAW) {
|
||||
ets_putc('c'); ets_putc('p'); ets_putc(':');
|
||||
ets_wdt_disable();
|
||||
res = copy_raw(cmd.args[0], cmd.args[1], cmd.args[2]);
|
||||
ets_wdt_enable();
|
||||
ets_putc('0'+res); ets_putc('\n');
|
||||
if (res == 0) {
|
||||
cmd.action = ACTION_LOAD_APP;
|
||||
@ -139,14 +137,14 @@ void main()
|
||||
}
|
||||
|
||||
if (cmd.action == ACTION_LOAD_APP) {
|
||||
ets_putc('l'); ets_putc('d'); ets_putc('\n');
|
||||
res = load_app_from_flash_raw(cmd.args[0]);
|
||||
//we will get to this only on load fail
|
||||
ets_putc('e'); ets_putc(':'); ets_putc('0'+res); ets_putc('\n');
|
||||
ets_putc('l'); ets_putc('d'); ets_putc('\n');
|
||||
res = load_app_from_flash_raw(cmd.args[0]);
|
||||
//we will get to this only on load fail
|
||||
ets_putc('e'); ets_putc(':'); ets_putc('0'+res); ets_putc('\n');
|
||||
}
|
||||
|
||||
if (res) {
|
||||
SWRST;
|
||||
SWRST;
|
||||
}
|
||||
|
||||
while(true){}
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user