Skip to content

Commit 6e8632d

Browse files
peterdragunradimkarnis
authored andcommitted
fix(bin_image): add check for ELF file segment when saving RAM segments
Closes espressif#994
1 parent 4d0c7d9 commit 6e8632d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

esptool/bin_image.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,10 @@ def save(self, filename):
706706
# So bootdesc will be at the very top of the binary at 0x20 offset
707707
# (in the first segment).
708708
for segment in ram_segments:
709-
if segment.name == ".dram0.bootdesc":
709+
if (
710+
isinstance(segment, ELFSection)
711+
and segment.name == ".dram0.bootdesc"
712+
):
710713
ram_segments.remove(segment)
711714
ram_segments.insert(0, segment)
712715
break
@@ -985,7 +988,7 @@ def save(self, filename):
985988
while len(flash_segments) > 0:
986989
segment = flash_segments[0]
987990
# remove 8 bytes empty data for insert segment header
988-
if segment.name == ".flash.rodata":
991+
if isinstance(segment, ELFSection) and segment.name == ".flash.rodata":
989992
segment.data = segment.data[8:]
990993
# write the flash segment
991994
checksum = self.save_segment(f, segment, checksum)

0 commit comments

Comments
 (0)