feat(esp32p4): Add support for ESP32-P4.ECO5

* Update memory pointing to Uart
* Add esp32p4rc1.json
* Update esp32p4.json
* Bump up flasher_stubs to 1.8.0
This commit is contained in:
Jaroslav Safka
2025-09-04 14:02:29 +02:00
parent 7e535968f5
commit 6c10050fd3
6 changed files with 49 additions and 18 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.7.2",
"VERSION": "v1.8.0",
"FILE_LIST": (
"esp32",
"esp32c2",
@@ -21,6 +21,7 @@ STUBS = (
"esp32c6",
"esp32c61",
"esp32h2",
"esp32p4rc1",
"esp32p4",
"esp32s2",
"esp32s3",

View File

@@ -159,8 +159,10 @@ class StubFlasher:
# directories will be searched in the order of STUB_SUBDIRS
STUB_SUBDIRS = ["1"]
def __init__(self, chip_name):
with open(self.get_json_path(chip_name)) as json_file:
def __init__(self, target):
json_name = target.STUB_CLASS.stub_json_name(target)
with open(self._get_json_path(json_name, target.CHIP_NAME)) as json_file:
stub = json.load(json_file)
self.text = base64.b64decode(stub["text"])
@@ -176,10 +178,9 @@ class StubFlasher:
self.bss_start = stub.get("bss_start")
def get_json_path(self, chip_name):
chip_name = strip_chip_name(chip_name)
def _get_json_path(self, json_name, chip_name):
for i, subdir in enumerate(self.STUB_SUBDIRS):
json_path = os.path.join(self.STUB_DIR, subdir, f"{chip_name}.json")
json_path = os.path.join(self.STUB_DIR, subdir, json_name)
if os.path.exists(json_path):
if i:
log.warning(
@@ -933,7 +934,7 @@ class ESPLoader:
"""Start downloading an application image to RAM"""
# check we're not going to overwrite a running stub with this data
if self.IS_STUB:
stub = StubFlasher(self.CHIP_NAME)
stub = StubFlasher(self)
load_start = offset
load_end = offset + size
for stub_start, stub_end in [
@@ -1281,7 +1282,7 @@ class ESPLoader:
def run_stub(self, stub: StubFlasher | None = None) -> "ESPLoader":
log.stage()
if stub is None:
stub = StubFlasher(self.CHIP_NAME)
stub = StubFlasher(self)
if self.sync_stub_detected:
log.stage(finish=True)
@@ -1843,6 +1844,10 @@ class StubMixin:
self.cache = rom_loader.cache
self.flush_input() # resets _slip_reader
def stub_json_name(self):
chip_name = strip_chip_name(self.CHIP_NAME)
return f"{chip_name}.json"
def slip_reader(port, trace_function):
"""Generator to read SLIP packets from a serial port.

View File

@@ -80,9 +80,21 @@ class ESP32P4ROM(ESP32ROM):
FLASH_ENCRYPTED_WRITE_ALIGN = 16
UARTDEV_BUF_NO = 0x4FF3FEC8 # Variable in ROM .bss which indicates the port in use
UARTDEV_BUF_NO_USB_OTG = 5 # The above var when USB-OTG is used
UARTDEV_BUF_NO_USB_JTAG_SERIAL = 6 # The above var when USB-JTAG/Serial is used
@property
def UARTDEV_BUF_NO(self):
"""Variable .bss.UartDev.buff_uart_no in ROM .bss
which indicates the port in use.
"""
BUF_UART_NO_OFFSET = 24
BSS_UART_DEV_ADDR = 0x4FF3FEB0 if self.get_chip_revision() < 300 else 0x4FFBFEB0
return BSS_UART_DEV_ADDR + BUF_UART_NO_OFFSET
# The value from UARTDEV_BUF_NO when USB-OTG is used
UARTDEV_BUF_NO_USB_OTG = 5
# The value from UARTDEV_BUF_NO when USB-JTAG/Serial is used
UARTDEV_BUF_NO_USB_JTAG_SERIAL = 6
MEMORY_MAP = [
[0x00000000, 0x00010000, "PADDING"],
@@ -286,5 +298,10 @@ class ESP32P4StubLoader(StubMixin, ESP32P4ROM):
self.ESP_RAM_BLOCK = self.USB_RAM_BLOCK
self.FLASH_WRITE_SIZE = self.USB_RAM_BLOCK
def stub_json_name(self):
if self.get_chip_revision() < 300:
return "esp32p4rc1.json"
return "esp32p4.json"
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.7.2 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.8.0 from where the sources can be obtained.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long