.eep file empty unless also read

uint8_t EEMEM SomeVariable = 12;

should create a 1 byte .eep file, but actually only does so if also read with:


is this some kind of optimisation done by platformio or a known compiler flag?

Turns out it is indeed a compiler optimisation, so you have to either use the variable or it won’t get written to the .eep file. Alternatively it seems declaring as volatile seems to stop the compiler from optimising it away.