Page 1 of 1

Confuse about flash XIP and encryption

Posted: Tue Dec 28, 2021 8:23 pm
by vputin
Hi all, I have few question about ESP32-C3 and ESP32-S2.

- The embedded flash 4MB (or higher) can execute code (XIP) ? As I know internal RAM and Flash are small. If we have 1.5MB of firmware, can it be located in extern flash and execute?
- There is QSPI or SPI flash connected to SPI0/SPI1, are they considered an embedded flash, beside internal flash?
- PSRAM can execute XIP?
- About flash encryption, if enabled, C3 decrypted and load into IRAM and execute, while S2 can decrypted in-place?
- Once enable flash encryption, flash still can XIP or only for read data?

Re: Confuse about flash XIP and encryption

Posted: Wed Dec 29, 2021 2:36 am
by ESP_Sprite
Embedded flash is able to do XIP. If the embedded flash is too small, we'd suggest getting a part without embedded flash and connecting a larger flash externally, as only the primary flash can be mapped into memory. PSRAM on the S2 can do XIP; the C3 does not support adding PSRAM. Flash can do XIP even if encrypted; the encrypted data will be decrypted on the fly.

Re: Confuse about flash XIP and encryption

Posted: Wed Dec 29, 2021 4:54 pm
by vputin
Hi,

Thank you so much, it is very helpful to us.

We have to use large external flash and ram.

We have a look at ESP32-S2-DevKitM-1, which has 4MB of flash, 2MB of RAM.

With that kit, does flash can do XIP? because I see 128KB ROM so I am worry flash can not do XIP?

if that kit can't do XIP on flash, what other devices do you recommend?

Thank again!

Re: Confuse about flash XIP and encryption

Posted: Thu Dec 30, 2021 1:34 am
by ESP_Sprite
Yes, it can. Note that the ROM is actual, proper Read Only Memory, as in, what's stored in there is part of the chip design and is not changable after manufacturing of the chip. (It mostly contains the startup routines and some generally-used library functions.) Generally, all ESP modules you can buy contain a flash chip (either in the module or even inside the chip package) that is XIP capable that you would program your application into.