Page 1 of 1

Use of IRAM_ATTR and library functions

Posted: Sat Apr 11, 2020 9:33 am
by kammutierspule
If I create a IRAM_ATTR function,

Code: Select all

static void IRAM_ATTR InputScan_ISR( void *aPtr )
{
/// ...
int b = gpio_get_level( 0 );
/// ...
}
will the inside functions be placed also in IRAM_ATTR ?

I notice that the library function has its prototype:

Code: Select all

int gpio_get_level(gpio_num_t gpio_num);
So are the library functions not placed in IRAM?

Do you know any place that explains how to better use the IRAM_ATTR ?

Re: Use of IRAM_ATTR and library functions

Posted: Sun Apr 12, 2020 8:41 am
by ESP_Sprite
Yes, InputScan_ISR would be in IRAM while gpio_get_level would not be. Only functions with IRAM_ATTR prepended to it, or functions that are explicitly put in IRAM using the linker script, will reside in IRAM.

Re: Use of IRAM_ATTR and library functions

Posted: Mon Apr 13, 2020 8:38 am
by ESP_igrr
You can use linker fragment files to place certain library functions into IRAM. See for example https://github.com/espressif/esp-idf/bl ... ker.lf#L14 and docs https://docs.espressif.com/projects/esp ... ation.html