Discuss here different C compiler set ups, and compiling executables for the ESP8266

User avatar
By cal
#18726
jcmvbkbc wrote:
cal wrote:Seems pointless to me having cache size of same size as flash.
Newer boards have more flash.
Is that usable for a bigger "rom" segment >32k getting cached by 32k iram segmant?

FLASH is mapped at the 0x40200000...0x4027ffff (standard 512KB). AFAIK the whole 512KB are cached by the FLASH cache, but tests show that there's only 32KB of that cache. Looks like it's that memory that can be mapped at 0x40108000...0x4010ffff is used as the FLASH cache when it's enabled.


Sounds reasonable.
User avatar
By coldpenguin
#19629 Thanks for the responses. I haven't managed to look into anything yet unfortunately.
I have marked all of the functions already with the ICACHE_FLASH_ATTR macro, I suspect though that as it is all interrupt driven at the moment that it is being ignored. I'll have to investigate the map and see whether I note something that needn't be there
User avatar
By eriksl
#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.