Start one ESP application from another ESP application

mpatarinski
Posts: 3
Joined: Mon Apr 18, 2022 1:46 pm

Start one ESP application from another ESP application

Postby mpatarinski » Wed Feb 01, 2023 8:16 am

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?

User avatar
mbratch
Posts: 303
Joined: Fri Jun 11, 2021 1:51 pm

Re: Start one ESP application from another ESP application

Postby mbratch » Wed Feb 01, 2023 1:35 pm

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).

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: Start one ESP application from another ESP application

Postby ESP_igrr » Thu Feb 02, 2023 3:46 pm

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.

mpatarinski
Posts: 3
Joined: Mon Apr 18, 2022 1:46 pm

Re: Start one ESP application from another ESP application

Postby mpatarinski » Thu Feb 02, 2023 3:50 pm

Thank you for the reply. It is exactly what I needed.

Who is online

Users browsing this forum: Baidu [Spider] and 99 guests