Skip to content

Commit

Permalink
Add warning for hex files
Browse files Browse the repository at this point in the history
Most flashing tools want hex files so this is an easy mistake to make. Conversion with objcopy is trivial so we don't have to add support for hex. However, we should at least warn the user. The README is quite clear about that but I had only looked at `--help`.

It seems that I'm not the only who made this mistake: MarsTechHAN#2
  • Loading branch information
BBBSnowball authored May 14, 2021
1 parent 8bf717d commit 8c824bb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ch55xtool/ch55xtool.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ def main():
'--file',
type=str,
default='',
help="The target file to be flashed.")
help="The target file to be flashed. This must be a binary file (hex files are not supported).")
parser.add_argument(
'-r',
'--reset_after_flash',
Expand Down Expand Up @@ -380,6 +380,8 @@ def main():

if args.file != '':
payload = list(open(args.file, 'rb').read())
if args.file.endswith('.hex') or args.file.endswith('.ihx') or payload[0]==58:
print("WARNING: This looks like a hex file. This tool only supports binary files.")
if ret[0] in ['V2.30']:
ret = __write_key_ch55x_v20(dev, chk_sum)
if ret is None:
Expand Down

0 comments on commit 8c824bb

Please sign in to comment.