Tag Archives: ESP8266 Arrays in FLASH

Accessing ESP8266 Arrays in FLASH

A new challenge – the answer to which I will post in here.

Accessing an ESP8266 C array in FLASH – i.e. never touching RAM until you actually access something.  One suggestion was to ensure you use 4-byte variables.. so I tried this - it compiled - the array is in FLASH - but the access IMMEDIATELY reboots the ESP8266. iprintf is just a macro for printf - no issues there..

static const uint32_t petes[] ICACHE_RODATA_ATTR = {

iprintf is just a macro for a normal printf function...

iprintf("Data= %ld",petes[37]);

Result: Immediate reboot....

Thoughts anyone? Why do we need this? Because FLASH is in plentiful supply on these boards, RAM is not.  Ok, you could use tricks from the web page lookup and make functions – but that involves knowing exact addresses etc.. If possible I’d rather let the compiler worry about that.

I’ve posted this on the Espressif forum – I’ll post a working solution in here – but I’m out of ideas….