mirror of
https://github.com/espressif/esptool.git
synced 2025-10-16 14:28:54 +08:00
fix(elf2image): Print correct MMU page size in error message
This commit is contained in:

committed by
Radim Karniš

parent
fcb15d2b3a
commit
9da4948a03
@@ -593,7 +593,7 @@ class ESP32FirmwareImage(BaseFirmwareImage):
|
||||
"""ESP32 firmware image is very similar to V1 ESP8266 image,
|
||||
except with an additional 16 byte reserved header at top of image,
|
||||
and because of new flash mapping capabilities the flash-mapped regions
|
||||
can be placed in the normal image (just @ 64kB padded offsets).
|
||||
can be placed in the normal image (just @ MMU page size padded offsets).
|
||||
"""
|
||||
|
||||
ROM_LOADER = ESP32ROM
|
||||
@@ -717,10 +717,9 @@ class ESP32FirmwareImage(BaseFirmwareImage):
|
||||
for segment in flash_segments[1:]:
|
||||
if segment.addr // self.IROM_ALIGN == last_addr // self.IROM_ALIGN:
|
||||
raise FatalError(
|
||||
"Segment loaded at 0x%08x lands in same 64KB flash mapping "
|
||||
"as segment loaded at 0x%08x. Can't generate binary. "
|
||||
f"Segment loaded at {segment.addr:#010x} lands in same {self.IROM_ALIGN // 1024} KB flash mapping "
|
||||
f"as segment loaded at {last_addr:#010x}. Can't generate binary. "
|
||||
"Suggest changing linker script or ELF to merge sections."
|
||||
% (segment.addr, last_addr)
|
||||
)
|
||||
last_addr = segment.addr
|
||||
|
||||
@@ -782,7 +781,7 @@ class ESP32FirmwareImage(BaseFirmwareImage):
|
||||
self.save_flash_segment(f, segment)
|
||||
total_segments += 1
|
||||
else: # not self.ram_only_header
|
||||
# try to fit each flash segment on a 64kB aligned boundary
|
||||
# try to fit each flash segment on a MMU page size aligned boundary
|
||||
# by padding with parts of the non-flash segments...
|
||||
while len(flash_segments) > 0:
|
||||
segment = flash_segments[0]
|
||||
@@ -813,7 +812,7 @@ class ESP32FirmwareImage(BaseFirmwareImage):
|
||||
total_segments += 1
|
||||
|
||||
if self.secure_pad:
|
||||
# pad the image so that after signing it will end on a a 64KB boundary.
|
||||
# pad the image so that after signing it will end on a a MMU page size boundary.
|
||||
# This ensures all mapped flash content will be verified.
|
||||
if not self.append_digest:
|
||||
raise FatalError(
|
||||
@@ -832,7 +831,7 @@ class ESP32FirmwareImage(BaseFirmwareImage):
|
||||
elif self.secure_pad == "2": # Secure Boot V2
|
||||
# after checksum: SHA-256 digest +
|
||||
# signature sector,
|
||||
# but we place signature sector after the 64KB boundary
|
||||
# but we place signature sector after the MMU page size boundary
|
||||
space_after_checksum = 32
|
||||
pad_len = (
|
||||
self.IROM_ALIGN - align_past - checksum_space - space_after_checksum
|
||||
@@ -970,14 +969,13 @@ class ESP8266V3FirmwareImage(ESP32FirmwareImage):
|
||||
for segment in flash_segments[1:]:
|
||||
if segment.addr // self.IROM_ALIGN == last_addr // self.IROM_ALIGN:
|
||||
raise FatalError(
|
||||
"Segment loaded at 0x%08x lands in same 64KB flash mapping "
|
||||
"as segment loaded at 0x%08x. Can't generate binary. "
|
||||
f"Segment loaded at {segment.addr:#010x} lands in same {self.IROM_ALIGN // 1024} KB flash mapping "
|
||||
f"as segment loaded at {last_addr:#010x}. Can't generate binary. "
|
||||
"Suggest changing linker script or ELF to merge sections."
|
||||
% (segment.addr, last_addr)
|
||||
)
|
||||
last_addr = segment.addr
|
||||
|
||||
# try to fit each flash segment on a 64kB aligned boundary
|
||||
# try to fit each flash segment on a MMU page size aligned boundary
|
||||
# by padding with parts of the non-flash segments...
|
||||
while len(flash_segments) > 0:
|
||||
segment = flash_segments[0]
|
||||
|
Reference in New Issue
Block a user