Using the new Arduino IDE for ESP8266 and found bugs, report them here

Moderator: igrr

User avatar
By brutzler
#29263 Hi,
talking about String-objects:
crashing without serial output.
Try this:
Code: Select allconst String html_page2 PROGMEM = "Teststring";

void setup() {
}

void loop() {
}


Crashing on my ESP-12E
User avatar
By igrr
#29315
Code: Select allconst String html_page2 PROGMEM = "Teststring";

Actually this won't work for a more basic reason — you try to place a non-POD type into read-only memory. String class is initialized by its constructor, so when constructor tries to copy "Teststring" into the string, it causes an exception, because this String instance is in read-only memory segment.
You should use PROGMEM only for POD types or arrays of POD types.
User avatar
By brutzler
#29485 OK,
nerver heard about POD. But I am no C/C++ expert. Far away from this :(
But I think you wanted me to say, that I only can put Char-arrays in PROGMEM and not String-objects.
Is this only on ESP or is this causing problems on a "normal UNO" too?

For me, I will then go the way to use String-objects without PROGMEM for my HTML-Page. Two reasons:
- enough SRAM on the ESP :D
- can use replace() to insert e.g. actual-values into my HTML-code before sending over WiFi.