Skip to content

Commit 977ff44

Browse files
committed
refactor(elf2image): Use common MMU page size configuration function for ESP32-H4
ESP32-H4 and ESP32-C6 share the same MMU page size configuration (8KB, 16KB, 32KB, 64KB). Previously, ESP32H4FirmwareImage inherited from ESP32FirmwareImage and had its own duplicate set_mmu_page_size() method with hardcoded page sizes. This follows the same pattern as other classes.
1 parent b683ec7 commit 977ff44

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

esptool/bin_image.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ class ESP32FirmwareImage(BaseFirmwareImage):
710710
can be placed in the normal image (just @ MMU page size padded offsets).
711711
"""
712712

713-
ROM_LOADER = ESP32ROM
713+
ROM_LOADER: type[ESPLoader] = ESP32ROM
714714

715715
# ROM bootloader will read the wp_pin field if SPI flash
716716
# pins are remapped via flash. IDF actually enables QIO only
@@ -1211,7 +1211,7 @@ class ESP32C2FirmwareImage(ESP32FirmwareImage):
12111211
class ESP32C6FirmwareImage(ESP32FirmwareImage):
12121212
"""ESP32C6 Firmware Image almost exactly the same as ESP32FirmwareImage"""
12131213

1214-
ROM_LOADER = ESP32C6ROM
1214+
ROM_LOADER: type[ESPLoader] = ESP32C6ROM
12151215
MMU_PAGE_SIZE_CONF = (8192, 16384, 32768, 65536)
12161216

12171217

@@ -1236,19 +1236,11 @@ class ESP32C5FirmwareImage(ESP32FirmwareImage):
12361236
ESP32C5ROM.BOOTLOADER_IMAGE = ESP32C5FirmwareImage
12371237

12381238

1239-
class ESP32H4FirmwareImage(ESP32FirmwareImage):
1240-
"""ESP32H4 Firmware Image almost exactly the same as ESP32FirmwareImage"""
1239+
class ESP32H4FirmwareImage(ESP32C6FirmwareImage):
1240+
"""ESP32H4 Firmware Image almost exactly the same as ESP32C6FirmwareImage"""
12411241

12421242
ROM_LOADER = ESP32H4ROM
12431243

1244-
def set_mmu_page_size(self, size):
1245-
if size not in [8192, 16384, 32768, 65536]:
1246-
raise FatalError(
1247-
"{} bytes is not a valid ESP32-H4 page size, "
1248-
"select from 64KB, 32KB, 16KB, 8KB.".format(size)
1249-
)
1250-
self.IROM_ALIGN = size
1251-
12521244

12531245
ESP32H4ROM.BOOTLOADER_IMAGE = ESP32H4FirmwareImage
12541246

0 commit comments

Comments
 (0)