Need help for XiP

lesept
Posts: 41
Joined: Wed Jun 27, 2018 10:30 pm

Need help for XiP

Postby lesept » Mon Dec 30, 2024 1:47 pm

Hi,
I'd like to know more about XiP. Is it available with the Arduino IDE?

lbernstone
Posts: 903
Joined: Mon Jul 22, 2019 3:20 pm

Re: Need help for XiP

Postby lbernstone » Mon Dec 30, 2024 6:00 pm

arduino-esp32 is a HAL on top of the ESP-IDF. ESP-IDF uses XiP in normal operations, as it must since the firmware is typically larger than the RAM. Functions must be specifically tagged as memory resident (IRAM) to not be XiP.

lesept
Posts: 41
Joined: Wed Jun 27, 2018 10:30 pm

Re: Need help for XiP

Postby lesept » Mon Dec 30, 2024 11:08 pm

Thanks for your answer.
If I tag a specific function to be in IRAM, will it be executed faster than if it was not tagged?

lbernstone
Posts: 903
Joined: Mon Jul 22, 2019 3:20 pm

Re: Need help for XiP

Postby lbernstone » Mon Dec 30, 2024 11:32 pm

The execution of the code in the function will not be any faster. The overall execution time is less, since it doesn't need to load the instructions off the flash. This may in many cases be a significant part of the time spent by the cpu.
The IRAM attribute is more typically used when the code is running in a protected/critical context (such as an ISR), where the flash simply won't be available to source the code.

lesept
Posts: 41
Joined: Wed Jun 27, 2018 10:30 pm

Re: Need help for XiP

Postby lesept » Mon Dec 30, 2024 11:52 pm

Thanks, that's what I meant: the overall execution time.
My code is an AI inference code that executes blocks of instructions which are very similar: load arrays, perform operations.
These operations are made of several levels of for loops, with array multiplication - addition inside. I think they are what takes time in my code. So I supposed that putting these functions in IRAM would accelerate them and reduce the overall execution time.

I already use the optimized DSP dotprod functions, which already accelerates the execution.

Who is online

Users browsing this forum: No registered users and 20 guests