mirror of
https://github.com/espressif/esptool.git
synced 2025-10-20 22:09:59 +08:00
feat(esp32c61): Added stub flasher support
This commit is contained in:

committed by
Radim Karniš

parent
dfd61e2252
commit
e8b391154b
@@ -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.2.0",
|
||||
"VERSION": "v1.3.0",
|
||||
"FILE_LIST": (
|
||||
"esp32",
|
||||
"esp32c2",
|
||||
@@ -20,6 +20,7 @@ STUBS = (
|
||||
"esp32c5",
|
||||
"esp32c5beta3",
|
||||
"esp32c6",
|
||||
"esp32c61",
|
||||
"esp32c6beta",
|
||||
"esp32h2",
|
||||
"esp32h2beta1",
|
||||
@@ -50,7 +51,7 @@ STUBS = (
|
||||
},
|
||||
)
|
||||
|
||||
DESTINATION_DIR = "esptool/targets/stub_flasher"
|
||||
DESTINATION_DIR = os.path.join("esptool", "targets", "stub_flasher")
|
||||
|
||||
README_TEMPLATE = """# Licensing
|
||||
|
||||
|
@@ -13,7 +13,7 @@ class ESP32C61ROM(ESP32C6ROM):
|
||||
IMAGE_CHIP_ID = 20
|
||||
|
||||
# Magic value for ESP32C61
|
||||
CHIP_DETECT_MAGIC_VALUE = [0x33F0206F]
|
||||
CHIP_DETECT_MAGIC_VALUE = [0x33F0206F, 0x2421606F]
|
||||
|
||||
UART_DATE_REG_ADDR = 0x60000000 + 0x7C
|
||||
|
||||
@@ -104,4 +104,23 @@ class ESP32C61ROM(ESP32C6ROM):
|
||||
return macs.get(mac_type, None)
|
||||
|
||||
|
||||
# TODO: IDF-9241, stub flasher support
|
||||
class ESP32C61StubLoader(ESP32C61ROM):
|
||||
"""Access class for ESP32C61 stub loader, runs on top of ROM.
|
||||
|
||||
(Basically the same as ESP32StubLoader, but different base class.
|
||||
Can possibly be made into a mixin.)
|
||||
"""
|
||||
|
||||
FLASH_WRITE_SIZE = 0x4000 # matches MAX_WRITE_BLOCK in stub_loader.c
|
||||
STATUS_BYTES_LENGTH = 2 # same as ESP8266, different to ESP32 ROM
|
||||
IS_STUB = True
|
||||
|
||||
def __init__(self, rom_loader):
|
||||
self.secure_download_mode = rom_loader.secure_download_mode
|
||||
self._port = rom_loader._port
|
||||
self._trace_enabled = rom_loader._trace_enabled
|
||||
self.cache = rom_loader.cache
|
||||
self.flush_input() # resets _slip_reader
|
||||
|
||||
|
||||
ESP32C61ROM.STUB_CLASS = ESP32C61StubLoader
|
||||
|
@@ -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.2.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.3.0 from where the sources can be obtained.
|
||||
|
8
esptool/targets/stub_flasher/1/esp32c61.json
Normal file
8
esptool/targets/stub_flasher/1/esp32c61.json
Normal file
File diff suppressed because one or more lines are too long
BIN
test/images/ram_helloworld/helloworld-esp32c61.bin
Normal file
BIN
test/images/ram_helloworld/helloworld-esp32c61.bin
Normal file
Binary file not shown.
@@ -26,6 +26,7 @@ APP_ELF_32S3 = $(BUILD_DIR)/$(APP)-esp32s3.elf
|
||||
APP_ELF_32C3 = $(BUILD_DIR)/$(APP)-esp32c3.elf
|
||||
APP_ELF_32C2 = $(BUILD_DIR)/$(APP)-esp32c2.elf
|
||||
APP_ELF_32C6 = $(BUILD_DIR)/$(APP)-esp32c6.elf
|
||||
APP_ELF_32C61 = $(BUILD_DIR)/$(APP)-esp32c61.elf
|
||||
APP_ELF_32H2 = $(BUILD_DIR)/$(APP)-esp32h2.elf
|
||||
APP_ELF_32P4 = $(BUILD_DIR)/$(APP)-esp32p4.elf
|
||||
APP_ELF_32C5 = $(BUILD_DIR)/$(APP)-esp32c5.elf
|
||||
@@ -34,7 +35,7 @@ APP_ELF_32C5 = $(BUILD_DIR)/$(APP)-esp32c5.elf
|
||||
|
||||
all: $(APP_ELF_8266) $(APP_ELF_32) $(APP_ELF_32S2) $(APP_ELF_32C3) $(APP_ELF_32S3) $(APP_ELF_32C2) $(APP_ELF_32C6) $(APP_ELF_32H2) $(APP_ELF_32P4) $(APP_ELF_32C5)
|
||||
|
||||
esp32: $(APP_ELF_32) $(APP_ELF_32S2) $(APP_ELF_32C3) $(APP_ELF_32S3) $(APP_ELF_32C2) $(APP_ELF_32C6) $(APP_ELF_32H2) $(APP_ELF_32P4) $(APP_ELF_32C5)
|
||||
esp32: $(APP_ELF_32) $(APP_ELF_32S2) $(APP_ELF_32C3) $(APP_ELF_32S3) $(APP_ELF_32C2) $(APP_ELF_32C6) $(APP_ELF_32C61) $(APP_ELF_32H2) $(APP_ELF_32P4) $(APP_ELF_32C5)
|
||||
|
||||
$(BUILD_DIR):
|
||||
$(Q) mkdir $@
|
||||
@@ -80,6 +81,10 @@ $(APP_ELF_32C6): $(SRCS) $(BUILD_DIR) ld/app_32c6.ld
|
||||
@echo " CC(32C6) $^ -> $@"
|
||||
$(Q) $(CROSS_ESPRISCV32)gcc $(CFLAGS_ESPRISCV32) -DESP32C6=1 -Tapp_32c6.ld -Wl,-Map=$(@:.elf=.map) -o $@ $(filter %.c, $^) $(LDLIBS)
|
||||
|
||||
$(APP_ELF_32C61): $(SRCS) $(BUILD_DIR) ld/app_32c61.ld
|
||||
@echo " CC(32C61) $^ -> $@"
|
||||
$(Q) $(CROSS_ESPRISCV32)gcc $(CFLAGS_ESPRISCV32) -DESP32C61=1 -Tapp_32c61.ld -Wl,-Map=$(@:.elf=.map) -o $@ $(filter %.c, $^) $(LDLIBS)
|
||||
|
||||
$(APP_ELF_32H2): $(SRCS) $(BUILD_DIR) ld/app_32h2.ld
|
||||
@echo " CC(32H2) $^ -> $@"
|
||||
$(Q) $(CROSS_ESPRISCV32)gcc $(CFLAGS_ESPRISCV32) -DESP32H2=1 -Tapp_32h2.ld -Wl,-Map=$(@:.elf=.map) -o $@ $(filter %.c, $^) $(LDLIBS)
|
||||
|
26
test/images/ram_helloworld/source/ld/app_32c61.ld
Normal file
26
test/images/ram_helloworld/source/ld/app_32c61.ld
Normal file
@@ -0,0 +1,26 @@
|
||||
MEMORY {
|
||||
iram : org = 0x40830000, len = 0x100
|
||||
dram : org = 0x40830100, len = 0x100
|
||||
}
|
||||
|
||||
ENTRY(ram_main)
|
||||
|
||||
SECTIONS {
|
||||
.text : ALIGN(4) {
|
||||
*(.literal)
|
||||
*(.text .text.*)
|
||||
} > iram
|
||||
|
||||
.bss : ALIGN(4) {
|
||||
_bss_start = ABSOLUTE(.);
|
||||
*(.bss)
|
||||
_bss_end = ABSOLUTE(.);
|
||||
} > dram
|
||||
|
||||
.data : ALIGN(4) {
|
||||
*(.data)
|
||||
*(.rodata .rodata.*)
|
||||
} > dram
|
||||
}
|
||||
|
||||
INCLUDE "../../../../flasher_stub/ld/rom_32c61.ld"
|
@@ -191,6 +191,7 @@ class EsptoolTestCase:
|
||||
"esp32h2",
|
||||
"esp32p4",
|
||||
"esp32c5",
|
||||
"esp32c61",
|
||||
] # With U-JS
|
||||
):
|
||||
port_index = base_cmd.index("--port") + 1
|
||||
@@ -1277,8 +1278,15 @@ class TestReadWriteMemory(EsptoolTestCase):
|
||||
]: # find a probably-unused memory type
|
||||
region = esp.get_memory_region(test_region)
|
||||
if region:
|
||||
# Write at the end of DRAM on ESP32-C2 to avoid overwriting the stub
|
||||
test_addr = region[1] - 8 if arg_chip == "esp32c2" else region[0]
|
||||
if arg_chip == "esp32c61":
|
||||
# Write into the "BYTE_ACCESSIBLE" space and after the stub
|
||||
region = esp.get_memory_region("DRAM")
|
||||
test_addr = region[1] - 0x2FFFF
|
||||
elif arg_chip == "esp32c2":
|
||||
# Write at the end of DRAM on ESP32-C2 to avoid overwriting the stub
|
||||
test_addr = region[1] - 8
|
||||
else:
|
||||
test_addr = region[0]
|
||||
break
|
||||
|
||||
print(f"Using test address {test_addr:#x}")
|
||||
|
Reference in New Issue
Block a user