-->
Page 1 of 1

What are the guidelines in using ICACHE_FLASH_ATTR?

PostPosted: Thu Jul 02, 2015 5:26 am
by helpme
While browsing the code, I see several functions with the prefix ICACHE_FLASH_ATTR. What are the guidelines and rules of thumb in using ICACHE_FLASH_ATTR?

Re: What are the guidelines in using ICACHE_FLASH_ATTR?

PostPosted: Thu Jul 02, 2015 6:50 am
by cal
Moin,

my guideline:

don't use it for code that
- is called from interrupts
- does control reading/writing flash
- has to run fastest

Cal

Re: What are the guidelines in using ICACHE_FLASH_ATTR?

PostPosted: Sat Jul 04, 2015 7:30 pm
by kolban
Cal,
I'm novice level on the ESP8266 ... would you be able to elaborate on the usage and purpose of this attribute? Maybe some illustrative examples?

Neil

Re: What are the guidelines in using ICACHE_FLASH_ATTR?

PostPosted: Sun Jul 05, 2015 11:05 am
by cal
kolban wrote:Cal,
I'm novice level on the ESP8266 ... would you be able to elaborate on the usage and purpose of this attribute? Maybe some illustrative examples?

Neil


Moin Neal,

your code can be executed when loaded from flash and being cached or loaded from instruction ram.
Flash is big but slower. iram ist fast but small.
Adding the attribute you tell the compiler/linker that its save to put the code in flash.
They trust the instructor: you.

Cal