Chat freely about anything...

User avatar
By trullock
#89126 Hi

I need to serve a large (~250KB) HTML file from an ESP8266.

I also want to support OTA updates (where the ESP checks the internet for a new version and downloads it itself)

Is 250KB too large/a bad idea to store in PROGMEM?

If so and I should store it in the filesystem, what options do I have to support OTA updating of both the firmware and the HTML? My best guess is to have the firmware download the HTML on first boot (for example), but this 2-step process leaves a lot of room for errors :/


User avatar
By eriksl
#89189 PROGMEM is not an ESP8266 concept, you're probably talking of arduino or similar?

On the ESP8266 you can use any flash memory that's not occupied by program code for whatever you want. If you have a 4 Mbyte flash chip and you're using only 1 Mbyte or less of it, you can use 3 Mbyte for data. If you're a bit cautious, even more.

Just remember that flash sectors wear out. so don't keep writing them continuously. Although nowadays 10.000-100.000 writing cycles before wearing out is quite common.

If your data is within the same 1 Mbyte "segment" as your code, you can access it directly (although you need to do aligned accesses). If it's outside it, you can use the flash_read() function and read the data on a sector-by-sector basis.