Description
Basic Infos
- This issue complies with the issue POLICY doc.
- I have read the documentation at readthedocs and the issue is not addressed there.
- I have tested that the issue is present in current master branch (aka latest git).
- I have searched the issue tracker for a similar issue.
- If there is a stack dump, I have decoded it.
- I have filled out all fields below.
Platform
- Hardware: [ESP8266-WROOM-02D]
- Core Version: [SDK:2.2.2-dev(38a443e)/Core:3.0.0=30000000/lwIP:STABLE-2_1_2_RELEASE/glue:1.2-48-g7421258/BearSSL:c0b69df]
- Development Env: [Arduino IDE 1.8.13]
- Operating System: [Windows]
Settings in IDE
- Module: [Generic ESP8266 Module]
- Flash Mode: [DOUT]
- Flash Size: [2MB]
- lwip Variant: [v2 Lower Memory]
- Reset Method: [dtr]
- Flash Frequency: [40Mhz]
- CPU Frequency: [80Mhz]
- Upload Using: [OTA]
- Upload Speed: [115200|other] (serial upload only)
Problem Description
Power off at the ending of ESPhttpUpdate.update, exception occurs for later power on.
Note that works fine if no power off during ESPhttpUpdate.update.
MCVE Sketch
/**
httpUpdate.ino
Created on: 27.11.2015
*/
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <ESP8266HTTPClient.h>
#include <ESP8266httpUpdate.h>
#ifndef APSSID
#define APSSID "GL-H6-2"
#define APPSK "GlH62401"
#endif
#define ATOMIC_FS_UPDATE
ESP8266WiFiMulti WiFiMulti;
void setup() {
Serial.begin(74880);
Serial.setDebugOutput(true);
Serial.println();
Serial.println();
Serial.println();
for (uint8_t t = 4; t > 0; t--) {
Serial.printf("[SETUP] WAIT %d...\n", t);
Serial.flush();
delay(1000);
}
WiFi.mode(WIFI_STA);
WiFiMulti.addAP(APSSID, APPSK);
}
void update_started() {
Serial.println("CALLBACK: HTTP update process started");
}
void update_finished() {
Serial.println("CALLBACK: HTTP update process finished");
}
void update_progress(int cur, int total) {
Serial.printf("CALLBACK: HTTP update process at %d of %d bytes...\n", cur, total);
}
void update_error(int err) {
Serial.printf("CALLBACK: HTTP update fatal error code %d\n", err);
}
void loop() {
// wait for WiFi connection
if ((WiFiMulti.run() == WL_CONNECTED)) {
WiFiClient client;
// The line below is optional. It can be used to blink the LED on the board during flashing
// The LED will be on during download of one buffer of data from the network. The LED will
// be off during writing that buffer to flash
// On a good connection the LED should flash regularly. On a bad connection the LED will be
// on much longer than it will be off. Other pins than LED_BUILTIN may be used. The second
// value is used to put the LED on. If the LED is on with HIGH, that value should be passed
ESPhttpUpdate.setLedPin(LED_BUILTIN, LOW);
// Add optional callback notifiers
ESPhttpUpdate.onStart(update_started);
ESPhttpUpdate.onEnd(update_finished);
ESPhttpUpdate.onProgress(update_progress);
ESPhttpUpdate.onError(update_error);
t_httpUpdate_return ret = ESPhttpUpdate.update(client, "http://apps.95wd.com.cn/httpUpdate0.ino.generic.bin");
// Or:
//t_httpUpdate_return ret = ESPhttpUpdate.update(client, "server", 80, "file.bin");
switch (ret) {
case HTTP_UPDATE_FAILED:
Serial.printf("HTTP_UPDATE_FAILD Error (%d): %s\n", ESPhttpUpdate.getLastError(), ESPhttpUpdate.getLastErrorString().c_str());
break;
case HTTP_UPDATE_NO_UPDATES:
Serial.println("HTTP_UPDATE_NO_UPDATES");
break;
case HTTP_UPDATE_OK:
Serial.println("HTTP_UPDATE_OK");
break;
}
}
}
Debug Messages
[httpUpdate] Header read fin.
[httpUpdate] Server header:
[httpUpdate] - code: 200
[httpUpdate] - len: 463312
[httpUpdate] ESP8266 info:
[httpUpdate] - free Space: 581632
[httpUpdate] - current Sketch Size: 463312
[httpUpdate] runUpdate flash...
[httpUpdate] peekBytes x:4
sleep disable
pm open,type:0 0
[httpUpdate] **Update ok**
state: 5 -> 0 (0)
rm 0
pm close 7
del if0
usl
⸮⸮*⸮P*V⸮⸮ET⸮⸮⸮⸮T⸮⸮+⸮⸮u⸮U+UZ⸮Z⸮T⸮⸮⸮TQT⸮UQ⸮⸮jP⸮�⸮⸮u⸮⸮⸮⸮⸮ZT⸮(UE⸮⸮⸮⸮QR⸮Eu⸮⸮�⸮⸮*⸮⸮⸮jPE*⸮u⸮⸮�E+⸮⸮⸮T)UZV⸮�R⸮E⸮j*QR⸮E⸮_�⸮*⸮�ER⸮⸮_
ets Jan 8 2013,rst cause:1, boot mode:(3,7)
load 0x4010f000, len 3460, room 16
tail 4
chksum 0xcc
load 0x3fff20b8, len 40, room 4
tail 4
chksum 0xc9
csum 0xc9
v000711d0
~ld
Fatal exception 0(IllegalInstructionCause):
epc1=0x4024dd50, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, depc=0x00000000
--------------- CUT HERE FOR EXCEPTION DECODER ---------------
Exception (0):
epc1=0x4024dd50 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000
>>>stack>>>
ctx: sys
sp: 3fffe8c0 end: 3fffffb0 offset: 0190
3fffea50: 00000000 00000000 00000000 00000000
3fffea60: 4024e721 00000000 00000000 00000000
3fffea70: 4025c8c7 40105bb8 00000000 00000000
3fffea80: 00000000 400042db 40105e6d 000001fd
3fffea90: 00000082 00000020 00000000 00000001
3fffeaa0: 40105e67 40105cd7 00000003 00000000
3fffeab0: ffffe7f4 ffffffff ffff0001 00000007
3fffeac0: 482d4c47 00322d36 3ffffeec 40211c90
3fffead0: 40211c84 3ffef260 3ffffeec 40212019
3fffeae0: 00030503 47000001 3236486c 00313034
3fffeaf0: 6d3ffffe da402122 003ffe8d 0d000000
3fffeb00: fd6f000a da402156 f03ffe8d ef4bc6a7
3fffeb10: 380bc6a7 00353634 00000000 f0000000
3fffeb20: 7c4bc6a7 003fffff e28ad284 d296942e
3fffeb30: 1dba09f8 1c1c0229 911b3f99 a815e2ca
3fffeb40: c74311de 1d7214fb ffffffff ffffffff
3fffeb50: ffffffff ffffffff 1f0000ff a1f6347a
3fffeb60: 00000005 38383838 00000038 40250442
=========== DECODED ===============
Exception 0: Illegal instruction
PC: 0x4024dd50
EXCVADDR: 0x00000000
Decoding stack results
0x40211c90: UpdaterClass::printError(Print&) at C:\Users\Administrator\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.0\cores\esp8266\Updater.cpp line 561
0x40211c84: UpdaterClass::printError(Print&) at C:\Users\Administrator\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.0\cores\esp8266\Updater.cpp line 559
0x40212019: String::changeBuffer(unsigned int) at C:\Users\Administrator\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.0\cores\esp8266\WString.cpp line 207
0x40100d08: umm_free_core(umm_heap_context_t*, void*) at C:\Users\Administrator\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.0\cores\esp8266\umm_malloc\umm_malloc.cpp line 565
0x40100cd3: umm_free_core(umm_heap_context_t*, void*) at C:\Users\Administrator\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.0\cores\esp8266\umm_malloc\umm_malloc.cpp line 553
0x40100f6e: umm_init_common(size_t, void*, size_t, bool) at C:\Users\Administrator\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.0\cores\esp8266\umm_malloc\umm_malloc.cpp line 438
0x40100f60: umm_init_common(size_t, void*, size_t, bool) at C:\Users\Administrator\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.0\cores\esp8266\umm_malloc\umm_malloc.cpp line 428
0x40211c90: UpdaterClass::printError(Print&) at C:\Users\Administrator\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.0\cores\esp8266\Updater.cpp line 561
0x40211c84: UpdaterClass::printError(Print&) at C:\Users\Administrator\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.0\cores\esp8266\Updater.cpp line 559
0x40212019: String::changeBuffer(unsigned int) at C:\Users\Administrator\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.0\cores\esp8266\WString.cpp line 207
0x4021226d: String::String(unsigned int, unsigned char) at C:\Users\Administrator\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.0\cores\esp8266\WString.cpp line 78
0x402156fd: DhcpServer::parse_options(unsigned char*, short) at C:\Users\Administrator\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.0\cores\esp8266\LwipDhcpServer.cpp line 790
ESPhttpUpdate.update升级快完成时掉电,系统异常.pdf