I have been working with PlatformIO for ESP8266 coding over a year. Last month, I tried to enable IPv6 supported with the latest espressif8266 platform, the latest version is V2.0.4.
It works fine, but one problem is the flash available space for sketch uploading.
the previous version which does to support IPv6, the available space is about 9xxKB.
now, it is 7XXKB.
And my sketch compiling size is about 385KB. It is over 50% than available space which cause my http OTA function failed.
below is the content of ini file, and terminal info of compiling
terminal- compiling info
DATA: [==== ] 41.6% (used 34068 bytes from 81920 bytes)
PROGRAM: [===== ] 50.9% (used 388100 bytes from 761840 bytes)
I tried many ways to reduce the sketch size, but performance is not good enough.
last week, I tried to move the exactly same code to Arduino IDE, and compile it.
the system show me available space of storage space is about 1MB, and with the similar compiling sketch size, the percentage is dropped to 37%.
and I tested it, all functions work fine. please see below Arduino setting and info.
the version shows in board manager is V2.5.0
Arduino-terminal compiling info
Sketch uses 387776 bytes (37%) of program storage space. Maximum is 1023984 bytes.
Global variables use 33860 bytes (41%) of dynamic memory, leaving 48060 bytes for local variables. Maximum is 81920 bytes.
it looks like the setting in platformio.ini (build_flags = -Wl,-Teagle.flash.1m.ld), can not overwrite it
I modified “ldscript”: “eagle.flash.1m256.ld” to “ldscript”: “eagle.flash.1m.ld”
Simply merging to TWO build_flags statements in platformio.ini so that the second did not cancel out the first fixed it for me using the platformio.ini you provided. No editing of the board configuration file (making it susceptible to not working in the future with an update) is not necessary.
Please note that we do real computation of available flash based on the regions in LD script. Arduino IDE does not do that and show the same available flash size even if you switch to another LD script. See source code
This feature is great, but updating boards “upload.maximum_size” causes problems if we want use the board size later for a custom download script.
I had to save the value in a pre: script to an environment variable.
Is there a way to get the total flash size once the target is generated? (I did not see a field named “flash_size”).