espressif / esptool

Espressif SoC serial bootloader utility
https://docs.espressif.com/projects/esptool
GNU General Public License v2.0
5.6k stars 1.39k forks source link

Regression in bin_image.py: 'ImageSegment' object has no attribute 'name' (ESPTOOL-736) #917

Closed mabau closed 1 year ago

mabau commented 1 year ago

Operating System

Ubuntu 22.04

Esptool Version

4.6.2

Python Version

3.10.12

Full Esptool Command Line that Was Run

No response

Esptool Output

I use esptool as a library. When loading and storing a ESP32 binary image using

img = LoadFirmwareImage("esp32", input_file) img.save(output_file)

after updating esptool I get the error:

File "/home/martin/code/swimtracker-firmware/venv/lib/python3.10/site-packages/esptool/bin_image.py", line 639, in save
    if segment.name == ".flash.appdesc":
AttributeError: 'ImageSegment' object has no attribute 'name'

Here a property .name is expected, but segment is an instance of ImageSegment which doesn't have that property. Perhaps this assumes that segment is an ElfSection?

https://github.com/espressif/esptool/blob/8c5f47f8d0be6bbfc2668791653fc8af75f3cd2b/esptool/bin_image.py#L638

I see two options to fix this:

What is the Expected Behaviour?

No response

More Information

No response

Other Steps to Reproduce

No response

radimkarnis commented 1 year ago

Hi @mabau, thanks for the detailed report and suggestions! This will be fixed soon šŸ¤.