Page 1 of 1

Need help for XiP

Posted: Mon Dec 30, 2024 1:47 pm
by lesept
Hi,
I'd like to know more about XiP. Is it available with the Arduino IDE?

Re: Need help for XiP

Posted: Mon Dec 30, 2024 6:00 pm
by lbernstone
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.

Re: Need help for XiP

Posted: Mon Dec 30, 2024 11:08 pm
by lesept
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?

Re: Need help for XiP

Posted: Mon Dec 30, 2024 11:32 pm
by lbernstone
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.

Re: Need help for XiP

Posted: Mon Dec 30, 2024 11:52 pm
by lesept
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.