- Thu Jul 09, 2015 7:15 am
#22842
The root of this problem is dat every function you write leads to dependencies on libraries. For instance powf() (which I had the exact problem with) must be "drawn in" from libc. No single function in libc or libgcc are compiled to go to the .text_irom0 section (pure flash). So you can make any function in your program go to pure flash (with the ICACHE_FLASH_... #define) and still your iram memory will fill up, with all sorts of library functions you didn't write, but are drawn in. Powf is a particularly nasty one, it draws in lots of other functions in it's turn, which also end up in iram. I decided to just no use powf in the end, it's simply using too much iram space. The only solution would be to re-write the powf function and mark it .text_irom0 section or to take the existing code from glibc and compile it yourself, with the appropriate sections and do that for every dependency as well.
I would very much appreciate it if someone with the proper knowledge would create a patch against libc where floating point functions are placed into irom_text section. I don't think anyone should use floating point code in interrupt or flash-writing context.