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

program.avr: make help text more clear about supported file extensions #623

Closed
Closed
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
20 changes: 14 additions & 6 deletions software/glasgow/applet/program/avr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

import logging
import argparse
import textwrap
from abc import ABCMeta, abstractmethod
from fx2.format import autodetect, input_data, output_data

Expand Down Expand Up @@ -165,7 +166,14 @@ def bits(arg): return int(arg, 2)
"identify", help="identify connected device")

p_read = p_operation.add_parser(
"read", help="read device memories")
"read", help="read device memories",
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog=textwrap.dedent("""
File output format is determined by extension. The following extensions are recognized:
.bin raw binary
.hex raw hex
.ihex, .ihx intel hex
"""))
p_read.add_argument(
"-f", "--fuses", default=False, action="store_true",
help="display fuse bytes")
Expand All @@ -176,11 +184,11 @@ def bits(arg): return int(arg, 2)
"-c", "--calibration", default=False, action="store_true",
help="display calibration bytes")
p_read.add_argument(
"-p", "--program", metavar="FILE", type=argparse.FileType("wb"),
help="write program memory contents to FILE")
"-p", "--program", metavar="FILE.bin", type=argparse.FileType("wb"),
help="write program memory contents to FILE.bin")
p_read.add_argument(
"-e", "--eeprom", metavar="FILE", type=argparse.FileType("wb"),
help="write EEPROM contents to FILE")
"-e", "--eeprom", metavar="FILE.bin", type=argparse.FileType("wb"),
help="write EEPROM contents to FILE.bin")

p_write_fuses = p_operation.add_parser(
"write-fuses", help="write and verify device fuses")
Expand Down Expand Up @@ -220,7 +228,7 @@ def _check_format(file, kind):
try:
autodetect(file)
except ValueError:
raise ProgramAVRError("cannot determine %s file format" % kind)
raise ProgramAVRError("cannot determine %s file format using extension (expected .hex, .ihex, .ihx, or .bin)" % kind)

async def interact(self, device, args, avr_iface):
await avr_iface.programming_enable()
Expand Down
Loading