esp32c3 entering first stage bootloader programmatically

152 views Asked by At

I would like to put esp32c3 into first stage bootloader through software or to be more precise from application that is running on device.

I have already read/try this link, but from what I can see in esp idf sdk v5.1, functions (rtc_wdt_protect_off, rtc_wdt_set_length_of_reset_signal, ...) are not supported for esp32c3, only for esp32 and esp32s3.

I know that I could create a "own" bootloader application that executes after second stage bootloader, which could behave as first stage bootloader, but I would like to do it through esp first stage bootloader.

Please keep in mind that putting device into first stage bootloader must be done through SW, hardware pin setting is not an option.

1

There are 1 answers

0
mejha On BEST ANSWER

It can be done like so, include:

#include "soc/soc.h"
#include "soc/rtc_cntl_reg.h"

and add below lines:

REG_WRITE(RTC_CNTL_OPTION1_REG, RTC_CNTL_FORCE_DOWNLOAD_BOOT);
esp_restart();

It will boot directly to the ROM update mode. Answer was found here: https://www.esp32.com/viewtopic.php?t=33180