- Wed Jul 15, 2015 8:10 am
#23324
That's interesting. But I just read here:
https://gcc.gnu.org/onlinedocs/gnat_ugn ... tions.html that for that to effective, you need to have compiled with -ffunction-sections and -fdata-sections, which I bet are not used compiling the SDK nor the libraries. So it can only be used to reduce your own code, which should not be necessary as of course you removed all code that's not used anyway
I have tried several other workarounds and none of them really work. There are two options that need to be done by espressif or the guys that compose the gcc environment and that is to put ALL functions that are not operating on flash in the irom0_text segment. Espressif apparently is already doing that, with the latest sdk, I get ~1000 bytes extra in the text segment (iram0). Now only the gcc environment. This is the cause that adding one single line can completely use up all iram0 space, because of functions in libgcc/libc dragging in each other, all in iram0.
Even better: an option in the SDK to select the iram0 v.s. cache size. My code is hardly timing critical, only large, so I'd prefer a small cache and a large iram0 segment.
Workarounds:
- make the linker place some sdk libs completely in irom0, very dangerous and mostly won't work anyway (is my experience); Espressif already took a whole bunch of code to irom0
- don't use functions that are notorious for dragging other library functions (like powf())
- if you must, write your own implementation or copy one from an available source, it doesn't even have to be a simple or small version, as long as you can add ICACHE_FLASH_ATTR to each function.