Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image info stuff (ESPTOOL-675) #874

Merged
merged 2 commits into from
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions esptool/cmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,10 @@ def get_key_from_value(dict, val):
title = "{} extended image header".format(args.chip.upper())
print(title)
print("=" * len(title))
print("WP pin: {:#02x}".format(image.wp_pin))
print(
f"WP pin: {image.wp_pin:#02x}",
*["(disabled)"] if image.wp_pin == image.WP_PIN_DISABLED else [],
)
print(
"Flash pins drive settings: "
"clk_drv: {:#02x}, q_drv: {:#02x}, d_drv: {:#02x}, "
Expand All @@ -750,7 +753,15 @@ def get_key_from_value(dict, val):
image.wp_drv,
)
)
print("Chip ID: {}".format(image.chip_id))
try:
chip = next(
chip
for chip in CHIP_DEFS.values()
if getattr(chip, "IMAGE_CHIP_ID", None) == image.chip_id
)
print(f"Chip ID: {image.chip_id} ({chip.CHIP_NAME})")
except StopIteration:
print(f"Chip ID: {image.chip_id} (Unknown ID)")
print(
"Minimal chip revision: "
f"v{image.min_rev_full // 100}.{image.min_rev_full % 100}, "
Expand Down
4 changes: 2 additions & 2 deletions test/test_image_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ def test_v2_esp32c3(self):
assert "Flash mode: DIO" in out, "Wrong flash mode"

# Extended header
assert "WP pin: 0xee" in out, "Wrong WP pin"
assert "Chip ID: 5" in out, "Wrong chip ID"
assert "WP pin: 0xee (disabled)" in out, "Wrong WP pin"
assert "Chip ID: 5 (ESP32-C3)" in out, "Wrong chip ID"
assert (
"clk_drv: 0x0, q_drv: 0x0, d_drv: 0x0, "
"cs0_drv: 0x0, hd_drv: 0x0, wp_drv: 0x0" in out
Expand Down