diff --git a/docs/en/esptool/basic-commands.rst b/docs/en/esptool/basic-commands.rst index 099d1cc4b7..5893cbac33 100644 --- a/docs/en/esptool/basic-commands.rst +++ b/docs/en/esptool/basic-commands.rst @@ -199,6 +199,10 @@ This information corresponds to the headers described in :ref:`image-format`. esptool.py image_info --version 2 my_esp_app.bin +.. only:: not esp8266 + + If a valid `ESP-IDF application header `__ is detected in the image, specific fields describing the application are also displayed. + .. _merge-bin: Merge Binaries for Flashing: merge_bin diff --git a/esptool/cmds.py b/esptool/cmds.py index 569dc236d8..d1d92fa7f6 100644 --- a/esptool/cmds.py +++ b/esptool/cmds.py @@ -654,6 +654,7 @@ def get_key_from_value(dict, val): return key return None + print() title = "{} image header".format(args.chip.upper()) print(title) print("=" * len(title)) @@ -737,16 +738,19 @@ def get_key_from_value(dict, val): "{} {} {} {} {}".format("-" * 7, "-" * 7, "-" * 10, "-" * 10, "-" * 12) ) format_str = "{:7} {:#07x} {:#010x} {:#010x} {}" + app_desc = None for idx, seg in enumerate(image.segments, start=1): segs = seg.get_memory_type(image) seg_name = ", ".join(segs) + if "DROM" in segs: # The DROM segment starts with the esp_app_desc_t struct + app_desc = seg.data[:256] print( format_str.format(idx, len(seg.data), seg.addr, seg.file_offs, seg_name) ) print() # Footer - title = "Image footer" + title = f"{args.chip.upper()} image footer" print(title) print("=" * len(title)) calc_checksum = image.calculate_checksum() @@ -763,13 +767,40 @@ def get_key_from_value(dict, val): if image.append_digest: is_valid = image.stored_digest == image.calc_digest digest_msg = "{} ({})".format( - hexify(image.calc_digest).lower(), + hexify(image.calc_digest, uppercase=False), "valid" if is_valid else "invalid", ) print("Validation hash: {}".format(digest_msg)) except AttributeError: pass # ESP8266 image has no append_digest field + if app_desc: + APP_DESC_STRUCT_FMT = "