Skip to content

Commit 5ae622e

Browse files
pi-anldpgeorge
authored andcommitted
esp32: Add automatic bootloader handling for S2 and S3.
Enables support for the ESP standard DTR/RTS based reboot to bootloader. Switches from OTG to Serial/Jtag mode to workaround issue discussed in: espressif/arduino-esp32#6762 Signed-off-by: Andrew Leech <[email protected]>
1 parent 641f600 commit 5ae622e

File tree

15 files changed

+54
-12
lines changed

15 files changed

+54
-12
lines changed

ports/esp32/boards/ESP32_GENERIC_S3/sdkconfig.board

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
22
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
3-
CONFIG_ESPTOOLPY_AFTER_NORESET=y
43

54
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=
65
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y

ports/esp32/boards/UM_FEATHERS2/sdkconfig.board

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
22
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
3-
CONFIG_ESPTOOLPY_AFTER_NORESET=y
43

54
CONFIG_SPIRAM_MEMTEST=
65

ports/esp32/boards/UM_FEATHERS2NEO/sdkconfig.board

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
22
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
3-
CONFIG_ESPTOOLPY_AFTER_NORESET=y
43

54
# LWIP
65
CONFIG_LWIP_LOCAL_HOSTNAME="UMFeatherS2Neo"

ports/esp32/boards/UM_FEATHERS3/sdkconfig.board

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
22
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
3-
CONFIG_ESPTOOLPY_AFTER_NORESET=y
43

54
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=
65
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=

ports/esp32/boards/UM_NANOS3/sdkconfig.board

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
22
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
3-
CONFIG_ESPTOOLPY_AFTER_NORESET=y
43

54
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=
65
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y

ports/esp32/boards/UM_PROS3/sdkconfig.board

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
22
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
3-
CONFIG_ESPTOOLPY_AFTER_NORESET=y
43

54
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=
65
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=

ports/esp32/boards/UM_TINYS2/sdkconfig.board

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
22
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
3-
CONFIG_ESPTOOLPY_AFTER_NORESET=y
43

54
# LWIP
65
CONFIG_LWIP_LOCAL_HOSTNAME="UMTinyS2"

ports/esp32/boards/UM_TINYS3/sdkconfig.board

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
22
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
3-
CONFIG_ESPTOOLPY_AFTER_NORESET=y
43

54
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=
65
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y

ports/esp32/boards/UM_TINYWATCHS3/sdkconfig.board

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
22
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
3-
CONFIG_ESPTOOLPY_AFTER_NORESET=y
43

54
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=
65
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y

ports/esp32/modmachine.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,19 @@ static mp_int_t mp_machine_reset_cause(void) {
222222

223223
#if MICROPY_ESP32_USE_BOOTLOADER_RTC
224224
#include "soc/rtc_cntl_reg.h"
225+
#include "usb.h"
226+
#if CONFIG_IDF_TARGET_ESP32S3
227+
#include "esp32s3/rom/usb/usb_dc.h"
228+
#include "esp32s3/rom/usb/usb_persist.h"
229+
#include "esp32s3/rom/usb/chip_usb_dw_wrapper.h"
230+
#endif
231+
225232
NORETURN static void machine_bootloader_rtc(void) {
233+
#if CONFIG_IDF_TARGET_ESP32S3
234+
usb_usj_mode();
235+
usb_dc_prepare_persist();
236+
chip_usb_set_persist_flags(USBDC_BOOT_DFU);
237+
#endif
226238
REG_WRITE(RTC_CNTL_OPTION1_REG, RTC_CNTL_FORCE_DOWNLOAD_BOOT);
227239
esp_restart();
228240
}

0 commit comments

Comments
 (0)