fix: Index image segments from 0 instead of 1

idf.py (for example in idf.py monitor command) numbers the segments starting
from 0, but current esptool.py image_view numbers them starting from 1.

This MR unifies the behaviors between idf.py and esptool.py image_view
--version 2 (which will be the default version of image_view in new v
5.0).
This commit is contained in:
Jan Beran
2024-01-15 17:31:25 +01:00
committed by Radim Karniš
parent 8ad6d57ea9
commit b5939da8bc

View File

@@ -793,7 +793,7 @@ def image_info(args):
format_str = "{:7} {:#07x} {:#010x} {:#010x} {}" format_str = "{:7} {:#07x} {:#010x} {:#010x} {}"
app_desc = None app_desc = None
bootloader_desc = None bootloader_desc = None
for idx, seg in enumerate(image.segments, start=1): for idx, seg in enumerate(image.segments):
segs = seg.get_memory_type(image) segs = seg.get_memory_type(image)
seg_name = ", ".join(segs) seg_name = ", ".join(segs)
if "DROM" in segs: # The DROM segment starts with the esp_app_desc_t struct if "DROM" in segs: # The DROM segment starts with the esp_app_desc_t struct