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.
force IRAM_ATTR ? / default to IRAM_ATTR
-
- Posts: 9730
- Joined: Thu Nov 26, 2015 4:08 am
Re: force IRAM_ATTR ? / default to IRAM_ATTR
That is a very strange assertion. A very simple example (esp-idf/examples/wifi/getting_started/station/) when you run 'esp.py size' 'idf.py size' on it will give you the following:By far the majority of projects will fit into IRAM
Code: Select all
DRAM .data size: 16632 bytes
DRAM .bss size: 15504 bytes
Used static DRAM: 32136 bytes ( 148600 available, 17.8% used)
Used static IRAM: 88469 bytes ( 42603 available, 67.5% used)
Flash code: 474391 bytes
Flash rodata: 92368 bytes
Total image size:~ 671860 bytes (.bin may be padded larger)
Re: force IRAM_ATTR ? / default to IRAM_ATTR
I think you mean 'idf.py size'.ESP_Sprite wrote: ↑Mon Apr 05, 2021 2:47 amThat is a very strange assertion. A very simple example (esp-idf/examples/wifi/getting_started/station/) when you run 'esp.py size' on it will give you the following:By far the majority of projects will fit into IRAM
-
- Posts: 9730
- Joined: Thu Nov 26, 2015 4:08 am
Who is online
Users browsing this forum: No registered users and 78 guests