feat(esp32-p4): add support for flasher stub in USB OTG mode

This commit is contained in:
Peter Dragun
2024-06-10 13:45:34 +02:00
committed by Radim Karniš
parent 1d71ca6f18
commit 804f2db887
4 changed files with 20 additions and 7 deletions

View File

@@ -12,7 +12,7 @@ STUBS = (
"STUB_SET_VERSION": "1",
"DOWNLOAD_URL": "https://github.com/espressif/esptool-legacy-flasher-stub/releases/download",
"TAG_URL": "https://github.com/espressif/esptool-legacy-flasher-stub/releases/tag",
"VERSION": "v1.3.0",
"VERSION": "v1.4.0",
"FILE_LIST": (
"esp32",
"esp32c2",

View File

@@ -68,6 +68,13 @@ class ESP32P4ROM(ESP32ROM):
PURPOSE_VAL_XTS_AES256_KEY_2 = 3
PURPOSE_VAL_XTS_AES128_KEY = 4
USB_RAM_BLOCK = 0x800 # Max block size USB-OTG is used
GPIO_STRAP_REG = 0x500E0038
GPIO_STRAP_SPI_BOOT_MASK = 0x8 # Not download mode
RTC_CNTL_OPTION1_REG = 0x50110008
RTC_CNTL_FORCE_DOWNLOAD_BOOT_MASK = 0x4 # Is download mode forced over USB?
SUPPORTS_ENCRYPTED_FLASH = True
FLASH_ENCRYPTED_WRITE_ALIGN = 16
@@ -206,6 +213,8 @@ class ESP32P4ROM(ESP32ROM):
ESPLoader.change_baud(self, baud)
def _post_connect(self):
if self.uses_usb_otg():
self.ESP_RAM_BLOCK = self.USB_RAM_BLOCK
if not self.sync_stub_detected: # Don't run if stub is reused
self.disable_watchdogs()
@@ -262,7 +271,7 @@ class ESP32P4ROM(ESP32ROM):
self.write_reg(self.RTC_CNTL_WDTWPROTECT_REG, 0) # lock
def hard_reset(self):
if self.uses_usb_jtag_serial():
if self.uses_usb_jtag_serial() or self.uses_usb_otg():
self.rtc_wdt_reset()
else:
ESPLoader.hard_reset(self)
@@ -286,5 +295,9 @@ class ESP32P4StubLoader(ESP32P4ROM):
self.cache = rom_loader.cache
self.flush_input() # resets _slip_reader
if rom_loader.uses_usb_otg():
self.ESP_RAM_BLOCK = self.USB_RAM_BLOCK
self.FLASH_WRITE_SIZE = self.USB_RAM_BLOCK
ESP32P4ROM.STUB_CLASS = ESP32P4StubLoader

View File

@@ -1,3 +1,3 @@
# Licensing
The binaries in JSON format distributed in this directory are released as Free Software under GNU General Public License Version 2 or later. They were released at https://github.com/espressif/esptool-legacy-flasher-stub/releases/tag/v1.3.0 from where the sources can be obtained.
The binaries in JSON format distributed in this directory are released as Free Software under GNU General Public License Version 2 or later. They were released at https://github.com/espressif/esptool-legacy-flasher-stub/releases/tag/v1.4.0 from where the sources can be obtained.

File diff suppressed because one or more lines are too long