Page 1 of 1

Soft reset to second stage bootloader

Posted: Mon Aug 07, 2023 2:58 am
by felixcollins
Hi, I have a situation where I want to jump to the second stage bootloader after completing an OTA fw update. I do not want to reset the gpio state as I rely on a gpio to keep power latched on. If I do an esp_restart() then the power goes off and the user has to turn it on again.

Can I just use an asm jump to the correct address? Is there a header with the correct symbol to jump to?

Cheers,
Felix

Re: Soft reset to second stage bootloader

Posted: Tue Aug 08, 2023 1:37 pm
by ESP_igrr
You probably can't jump directly into the 2nd stage bootloader because it is not present in RAM when the application runs. (Keeping it present there would waste RAM.)
Therefore the boot process has to go through the boot ROM, which would copy the 2nd stage bootloader code into RAM (overwriting part of app's RAM) and execute it.
However it should be possible to do what you are trying to do with esp_restart. I've looked at esp_restart code and I don't see GPIO state being reset explicitly, though. Can you please add which ESP chip and which IDF version you are using?

Re: Soft reset to second stage bootloader

Posted: Wed Aug 09, 2023 9:11 pm
by felixcollins
Sorry, I'm using the ESP32 WROOM 32E. It is in a custom circuit. GPIO19 is held high to latch power on.

Thanks for your help. I realised once I started looking into things that I would have to load the 2nd bootloader, so I gave up!

We want to restart to boot new FW after an OTA update and load the new code. This seems like a common enough use case. If esp_restart() does not clear the gpio I wonder if it is something in the boot process that is clearing it.

Cheers,
Felix