XIP: Need help with enabling execute in place in esp-idf

bembite
Posts: 5
Joined: Tue Mar 02, 2021 3:45 pm

XIP: Need help with enabling execute in place in esp-idf

Postby bembite » Sun Jul 04, 2021 8:40 am

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.

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

Re: XIP: Need help with enabling execute in place in esp-idf

Postby ESP_Sprite » 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?

bembite
Posts: 5
Joined: Tue Mar 02, 2021 3:45 pm

Re: XIP: Need help with enabling execute in place in esp-idf

Postby bembite » Mon Jul 05, 2021 8:44 am

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?

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

Re: XIP: Need help with enabling execute in place in esp-idf

Postby ESP_Sprite » 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.)

bembite
Posts: 5
Joined: Tue Mar 02, 2021 3:45 pm

Re: XIP: Need help with enabling execute in place in esp-idf

Postby bembite » Tue Jul 06, 2021 8:38 am

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!

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

Re: XIP: Need help with enabling execute in place in esp-idf

Postby ESP_Sprite » 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.

bembite
Posts: 5
Joined: Tue Mar 02, 2021 3:45 pm

Re: XIP: Need help with enabling execute in place in esp-idf

Postby bembite » Fri Jul 16, 2021 12:39 pm

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... :roll:

Who is online

Users browsing this forum: No registered users and 97 guests