Update Arduino lib v2.5.2 -> v2.6.2 crashes in R() strings
Posted: Wed Dec 11, 2019 7:03 pm
I am using an Adafruit Feather HUZZAH ESP8266 board to act as a webserver. I had a bunch of code working using Arduino interface using the board library v2.5.2. I recently reopened the project to make some changes, and in the process updated the board library to v2.6.2. What I found is that my unchanged project that was working fine previously now started crashing / resetting when using the upgraded library / tools.
Using some Serial output, ESP Stack Debugger, I was able to track this down to the use of PROGMEM R() strings that contained the HTML to be served.
This can be repro'd by using the EXAMPLE -> ESP8266WebServer -> HelloServer sample. Just make the following change to handling the root request:
Not sure if this is an intentional change in the toolset, or if I am doing something wrong here, but would love to hear any ideas on what I may be able to do to get this working again so I don't have to stay at a downgraded version.
Thanks in advance!
Using some Serial output, ESP Stack Debugger, I was able to track this down to the use of PROGMEM R() strings that contained the HTML to be served.
This can be repro'd by using the EXAMPLE -> ESP8266WebServer -> HelloServer sample. Just make the following change to handling the root request:
Code: Select all
const char g_HTML[] PROGMEM = R"test(
<!DOCTYPE HTML>
<html>
<body>
Sample Text
</body>
</html>
)test";
void handleRoot() {
digitalWrite(led, 1);
String resp = g_HTML;
server.send(200, "text/html", resp);
digitalWrite(led, 0);
}
Not sure if this is an intentional change in the toolset, or if I am doing something wrong here, but would love to hear any ideas on what I may be able to do to get this working again so I don't have to stay at a downgraded version.
Thanks in advance!