Use of IRAM_ATTR and library functions

kammutierspule
Posts: 6
Joined: Sat Apr 11, 2020 9:25 am

Use of IRAM_ATTR and library functions

Postby kammutierspule » Sat Apr 11, 2020 9:33 am

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 ?

ESP_Sprite
Posts: 9618
Joined: Thu Nov 26, 2015 4:08 am

Re: Use of IRAM_ATTR and library functions

Postby ESP_Sprite » Sun Apr 12, 2020 8:41 am

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.

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: Use of IRAM_ATTR and library functions

Postby ESP_igrr » Mon Apr 13, 2020 8:38 am

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

Who is online

Users browsing this forum: No registered users and 103 guests