Using the flash memory memory on the Photon

I have an old light painter project from a while back written for an Arduino Mega. I tried today porting it across to my Particle Photon intending to make use of the 1MB flash onboard.
Right now, the program simply stores the image to be displayed as a (very long) byte array and with Arduino, I stored it in memory with PROGMEM. I have moved the code across now and the information I can find seems to suggest all I have to do is set it as a const to store it in flash, but the Web IDE is only showing 110,592 bytes available for the flash memory?
This limits me to about 102,000 values in the array, or 34,000 pixels.

Am I missing something?

I am aware I should be compressing the image etc, but trying to keep the code simple.

You are right, there is 1MB of flash onboard, but this houses not only your code but also the system firmware, some reserved space for OTA flashing and some other things, so you are actually limited to the rather confined space the Web IDE shows you.

If you would sacrifice OTA for example you could get a bit more, but this would need some system firmware tweaking and building with a local toolchain (never seen the need to sacrifice OTA, but read a discussion about this in the forum :wink: )

An alternative would be the use of an SD card or the Particle P1 which has an external 1MB flash too.

1 Like

@gbaman, just a note that the P1 module, much like the original Core, has an external 1MB flash built-in and is completely available to the use. :smile: