Skip to content

Where does my flash go? #2190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
MCUdude opened this issue Jun 24, 2016 · 2 comments
Closed

Where does my flash go? #2190

MCUdude opened this issue Jun 24, 2016 · 2 comments

Comments

@MCUdude
Copy link

MCUdude commented Jun 24, 2016

Hi! I'm currently using an ESP-12E module with 4M flash memory. In the IDE 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.

Sketch uses 222,141 bytes (21%) of program storage space. Maximum is 1,044,464 bytes.

If 1M is dedicated to SPIFFS, and 1M is dedicated to the program storage, where did the 2M go? 😕

@hallard
Copy link
Contributor

hallard commented Jun 25, 2016

@MCUdude
Conception of ESP8266 chip can't have program over 1MB (pointer size if I remember correctly) so you will never see more than 1Mb for code.
So Why chosing 4M/1M instead of 4M/3M ? try to upload SPIFFS using serial, 1M is so much faster (yeah, at 115200 even 1M is so slow).

@igrr
Copy link
Member

igrr commented Jun 25, 2016

The reason we can not have more than 1Mb of code in flash has to do with a hardware limitation. Flash cache hardware on the ESP8266 only allows to map 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 reason to have 4M/1M SPIFFS split which @hallard has given is correct — uploading 3M takes a long time so sometimes you can just use 1M. Other 2M of flash can still be used with ESP.flashRead andd ESP.flashWrite APIs if necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants