Page 1 of 1

Memory math

Posted: Wed Dec 19, 2018 10:50 am
by Zeni241
Hi

I am using esp32doit-devkit-v1. When I build the sketch, I get following lines at the end:

DATA: [= ] 12.9% (used 42424 bytes from 327680 bytes)
PROGRAM: [====== ] 62.5% (used 819078 bytes from 1310720 bytes)


I am of the impression that this board has 4MB flash memory. But these line indicating that it has 1.3 MB and 0.32 MB Ram.
Is it usual and rest of the memory is used for some default configurations etc. ????
Also does it means I cannot update OTA as more than 50% memory is used????

Re: Memory math

Posted: Wed Dec 19, 2018 11:19 am
by ESP_krzychb
Hi Zeni241,
Allocation of flash memory is defined in partition table.
For default configuration of Arduino it covers space for OTA as well.
Check, e.g. viewtopic.php?f=19&t=4349&p=19383

Re: Memory math

Posted: Wed Dec 19, 2018 11:21 am
by PeterR
PROGRAM: [====== ] 62.5% (used 819078 bytes from 1310720 bytes)
This is your IRAM memory. Programs run within IRAM and Cache.
The Cache allows your program to (effectively) use the slower 4MB FLASH as program memory.
DATA: [= ] 12.9% (used 42424 bytes from 327680 bytes)
This is your DRAM memory, your variables & constants.
There are also ESP modules with slower PSRAM which you may use if you run out of avriable memory.

So, you can OTA. On startup the selected partition will be loaded to IRAM. Your OTA partition may also keep code > IRAM size in FLASH and run that code via the Cache.
Alternatively you can disable Cache and so gain more IRAM.

Re: Memory math

Posted: Wed Dec 19, 2018 12:53 pm
by Zeni241
Thanks a lot guys for such quick response :P . Its a relief that I can update through OTA. :lol: I should learn more about partition tables etc.