Page 1 of 1
XIP: Need help with enabling execute in place in esp-idf
Posted: Sun Jul 04, 2021 8:40 am
by bembite
Hello. I have seen that esp32 support XIP (
https://open4tech.com/execute-place-xip-memory-model/). And I also found that some changes to the linker script can enable it (
https://github.com/zephyrproject-rtos/zephyr/pull/30424 as it was done here).
I am interested how to do this with esp-idf. Maybe there is flag in menuconfig to enable it. I would be grateful if you could provide me any additional info. Thank you.
Re: XIP: Need help with enabling execute in place in esp-idf
Posted: Sun Jul 04, 2021 2:04 pm
by ESP_Sprite
ESP-IDF already uses XIP for the large majority of the code generated. Is there anything specific that you want to achieve with this?
Re: XIP: Need help with enabling execute in place in esp-idf
Posted: Mon Jul 05, 2021 8:44 am
by bembite
ESP_Sprite wrote: ↑Sun Jul 04, 2021 2:04 pm
ESP-IDF already uses XIP for the large majority of the code generated. Is there anything specific that you want to achieve with this?
Thank you for replying. How to detect that XIP is enabled?
Re: XIP: Need help with enabling execute in place in esp-idf
Posted: Mon Jul 05, 2021 1:38 pm
by ESP_Sprite
Well, if you build your program using esp-idf, it always uses XIP for most of the code because otherwise most programs wouldn't fit in memory. But if you want specifics, run 'idf.py size', the part where it says 'flash code' will be executed as XIP. (Something similar goes for 'flash data' but it's not executed... it's directly loaded from flash, though.)
Re: XIP: Need help with enabling execute in place in esp-idf
Posted: Tue Jul 06, 2021 8:38 am
by bembite
ESP_Sprite wrote: ↑Mon Jul 05, 2021 1:38 pm
Well, if you build your program using esp-idf, it always uses XIP for most of the code because otherwise most programs wouldn't fit in memory. But if you want specifics, run 'idf.py size', the part where it says 'flash code' will be executed as XIP. (Something similar goes for 'flash data' but it's not executed... it's directly loaded from flash, though.)
So most of the time we cannot use external SPI-connected RAM, as it it is using same SPI.
Thank you!
Re: XIP: Need help with enabling execute in place in esp-idf
Posted: Wed Jul 07, 2021 12:59 am
by ESP_Sprite
Define "cannot use"? If you mean the PSRAM that sits on the same bus in e.g. the Wrover modules; it's accessed via the same mechanism XIP uses so outside of the times you need to do something bypassing that mechanism (specifically flash erases and writes, in which case most code is suspended anyway), RAM is perfectly usable. Same goes for user-defined stuff you talk to via the SPI driver: while you're accessing any other SPI device on that bus, code execution is mostly suspended, but it will happily resume after you're done.
Re: XIP: Need help with enabling execute in place in esp-idf
Posted: Fri Jul 16, 2021 12:39 pm
by bembite
bembite wrote:"cannot use"
ESP_Sprite wrote: ↑Wed Jul 07, 2021 12:59 am
Define "cannot use"? If you mean the PSRAM that sits on the same bus in e.g. the Wrover modules; it's accessed via the same mechanism XIP uses so outside of the times you need to do something bypassing that mechanism (specifically flash erases and writes, in which case most code is suspended anyway), RAM is perfectly usable. Same goes for user-defined stuff you talk to via the SPI driver: while you're accessing any other SPI device on that bus, code execution is mostly suspended, but it will happily resume after you're done.
Thank you!
"cannot use" - I thought that in XIP mode this SPI buss is used for reading instructions from extflash and cannot suspend.
My fault, need more doc reading...