Migrating Atmega2560 to ESP32

Hello, I need to migrate my project to ESP32 due to memory limitations in the Mega 2560 only to be greeted by new error messages.
The project is too large to share and unlike a similar thread [Atmega328p -- > esp32 program migration], I'm having "warning: iteration 69 invokes undefined behavior [-Waggressive-loop-optimizations]" and before addressing such warnings, my question is, are there any considerations I need to note before modifying the code or is it a lost cause? You see, I do understand hardware differences including interrupts, but if I get a warning for a simple loop like this, it gets me worried.

                      for(int bisse=1; bisse<71; bisse++) 
                          {
                                weynstring[bisse]=EEPROM.read(bisse);
                          } `Preformatted text`

The ESP32 has no EEPROM.

It emulates it by storing data in Flash memory.
The EEPROM library for the ESP32 is deprecated; new code should use the Preferences library.

side note

this is likely because the weynstring array was defined as

someType weynstring[70];

and thus does not have a weynstring[70] entry

probably the code should do

for(int bisse=0; bisse < 70; bisse++)  weynstring[bisse]=EEPROM.read(bisse);

and if it's a cString, then ensure there is a trailing null char

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.