In the IDE, for ESP-12E that has 4M flash, I can choose 4M (1M SPIFFS) or 4M (3M SPIFFS). No matter what I select, the IDE tells me the maximum code space is about 1M. Where does my flash go?
The reason we cannot have more than 1MB of code in flash has to do with a hardware limitation. Flash cache hardware on the ESP8266 only allows mapping 1MB of code into the CPU address space at any given time. You can switch mapping offset, so technically you can have more than 1MB total, but switching such “banks” on the fly is not easy and efficient, so we don’t bother doing that. Besides, no one has so far complained about 1MB of code space being insufficient for practical purposes.
The option to choose 3M or 1M SPIFFS is to optimize the upload time. Uploading 3MB takes a long time so sometimes you can just use 1MB. Other 2MB of flash can still be used with
ESP.flashRead
andESP.flashWrite
APIs if necessary.
https://arduino-esp8266.readthedocs.io/en/latest/faq/readme.html
Pete.