Skip to content

Commit

Permalink
fix(bin_image): add check for ELF file segment when saving RAM segments
Browse files Browse the repository at this point in the history
Closes #994
  • Loading branch information
peterdragun authored and radimkarnis committed Jul 23, 2024
1 parent 4d0c7d9 commit 6e8632d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions esptool/bin_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,10 @@ def save(self, filename):
# So bootdesc will be at the very top of the binary at 0x20 offset
# (in the first segment).
for segment in ram_segments:
if segment.name == ".dram0.bootdesc":
if (
isinstance(segment, ELFSection)
and segment.name == ".dram0.bootdesc"
):
ram_segments.remove(segment)
ram_segments.insert(0, segment)
break
Expand Down Expand Up @@ -985,7 +988,7 @@ def save(self, filename):
while len(flash_segments) > 0:
segment = flash_segments[0]
# remove 8 bytes empty data for insert segment header
if segment.name == ".flash.rodata":
if isinstance(segment, ELFSection) and segment.name == ".flash.rodata":
segment.data = segment.data[8:]
# write the flash segment
checksum = self.save_segment(f, segment, checksum)
Expand Down

0 comments on commit 6e8632d

Please sign in to comment.