force IRAM_ATTR ? / default to IRAM_ATTR
Posted: Sun Apr 04, 2021 12:35 pm
I was wondering if there's an option to default to IRAM_ATTR, to make everything load into IRAM. ( or a global linker option ?)
The reason why I'm asking and forgive me my ignorance, is that by far the majority of projects will fit into ram, and will quite a bit faster for those that don't fit into the cache.
Cache misses are a problem when a tight timing is necessary. I mean much faster then the 1kHz RTOS tick.
It took me a few days to figure out the issue with cache misses the first time I wrote running code that exceeded the cache size, resulting in jittery behavior, which I regularly fix by adding IRAM_ATTR to any function except setup code.
Currently I'm porting a large project to esp32 and adding IRAM_ATTR everywhere is quite tedious.
My question is probably a feature request, I propose making IRAM_ATTR the default and to add either a NOIRAM_ATTR / FLASH_ATTR attribute.
By far the majority of projects will fit into IRAM, and for those that don't, the new attribute will run code that doesn't need to be called often or once, like setup code or static webpages for example onto flash.
As a matter of fact I find it quite strange that it's not the default behavior, it's like writing an app for PC and telling it > don't use ram for code, run it from HD, which everybody knows is a terrible idea.
The reason why I'm asking and forgive me my ignorance, is that by far the majority of projects will fit into ram, and will quite a bit faster for those that don't fit into the cache.
Cache misses are a problem when a tight timing is necessary. I mean much faster then the 1kHz RTOS tick.
It took me a few days to figure out the issue with cache misses the first time I wrote running code that exceeded the cache size, resulting in jittery behavior, which I regularly fix by adding IRAM_ATTR to any function except setup code.
Currently I'm porting a large project to esp32 and adding IRAM_ATTR everywhere is quite tedious.
My question is probably a feature request, I propose making IRAM_ATTR the default and to add either a NOIRAM_ATTR / FLASH_ATTR attribute.
By far the majority of projects will fit into IRAM, and for those that don't, the new attribute will run code that doesn't need to be called often or once, like setup code or static webpages for example onto flash.
As a matter of fact I find it quite strange that it's not the default behavior, it's like writing an app for PC and telling it > don't use ram for code, run it from HD, which everybody knows is a terrible idea.