Page 1 of 1

Start one ESP application from another ESP application

Posted: Wed Feb 01, 2023 8:16 am
by mpatarinski
Hello,

We are designing a SW that has a configuration with one Factory and two OTA sections.
The Factory Application we want to use as a typical Flashbootloader.
Therefore we are wondering if there is an Espressif mechanism to load&boot the main application from the Factory application.
So far we have only managed to do it via Reset and going through the SSBL.
The question is: Is there another way to directly "jump" from one app to another?

Re: Start one ESP application from another ESP application

Posted: Wed Feb 01, 2023 1:35 pm
by mbratch
What is the use case or scenario for the "cross-coupling" of ESP32 application partitions? If they have a functional dependency, then shouldn't they be all part of the same application? The purpose of the separate OTA applications is to allow upgrading to newer versions, e.g., over the air, so they are generally independent applications (other than sharing the same NVS, etc).

Re: Start one ESP application from another ESP application

Posted: Thu Feb 02, 2023 3:46 pm
by ESP_igrr
This is only possible via a reset and going via the 2nd stage bootloader.

On the original ESP32, technically booting one app from another could be done, but it's pretty tricky. We need to find an area of IRAM and DRAM unused by the both apps, copy the loading code there, then run the loading code. Failure to do so would cause the loaded app to overwrite the loader.

On ESP32-S2, C3 and more recent chips this is not possible, because we enable memory protection (W^X) when the app starts up. By design, once enabled, memory protection can only be disabled by a CPU reset. This acts as an additional defence against exploits.

Re: Start one ESP application from another ESP application

Posted: Thu Feb 02, 2023 3:50 pm
by mpatarinski
Thank you for the reply. It is exactly what I needed.