Hi jumjum,
Sorry, that was me that you sent the information to. I'm glad you sorted the other V3.1 issues mentioned.
I followed up binary code size issues internally and have some information for you, that I forgot to post back to the forum (sorry):
- For overall code size, there are some unnecessary increases in total binary size of V3.1 for WiFi due to changes made to support ESP-Mesh (even if it's not used in the firmware). This will be fixed in V3.2.
- For Bluetooth code size, there are some inevitable increases in code size due to some parts of the BT controller being moved out of ROM to fix some bugs.
- We're looking into ways to automate tracking/monitoring of overall binary size in our development process, so we can attempt to avoid too much growth when we add extra functionality.
- If you're not already, compiling with Release optimisations and setting Assertions to Silent will reduce binary size.
Following that, ESP32 needs 110kb to support https_server. Thats a lot, more than ESP8266 even has.
Adding core BLE-Server functionality reduces around the same amount.
200kb are already gone for an empty hello_world application.
This point seems to be about DRAM and heap size, not total binary size - is that right? We are mindful that ESP-IDF can be a memory hog in some configurations, and we're working on ways to reduce this.
200kb are already gone for an empty hello_world application.
With v3.1.1, the hello_world application uses 13020 bytes of static DRAM plus 21052 bytes from the heap at runtime in Debug configuration. This is 33 kilobytes of RAM. Master branch uses 1KB less static DRAM due to some fixes. 3.5KB of this is the default app_main() task stack size, and will be freed if app_main() function returns.
30KB of RAM just to get basic OS functions is still a lot, we'll keep looking at what we can do to reduce this.
The linked post mentions 298572 bytes free heap in hello_world on master, this is 36KB less than the 328KB of total DRAM in the chip (the difference is mostly due to some DRAM reserved by ROM functions.)
(Note: When the datasheet mentions 520KB of total RAM this is 328KB DRAM+192KB IRAM, only DRAM is commonly used for heap although it's also
possible to allocate from IRAM under some restrictions.)
Following that, ESP32 needs 110kb to support https_server. Thats a lot, more than ESP8266 even has.
Are you talking about the ESP-IDF HTTPS server (the new esp_http_server component has HTTPS support if you use the master branch version), or a different HTTPS server?
For TLS sessions in particular, reducing the
mbedTLS maximum content length will reduce total memory usage if you know that the client won't send long TLS messages (or will enable maximum segment length negotiation). For example, changing this to 8KB will save 16KB of heap per TLS session.
In IDF v3.2 you'll be able to enable
"asymmetric" TLS buffer sizes so the outgoing buffer can be even smaller, possible to save 12KB and still support receiving full length TLS messages.