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

Intelhex check can prevent flashing of binary file. (ESPTOOL-855) #978

Closed
tacozMacleo opened this issue May 7, 2024 · 1 comment
Closed

Comments

@tacozMacleo
Copy link

Operating System

Fedora linux 40

Esptool Version

esptool.py v4.7.0 4.7.0

Python Version

Python 3.12.2

Full Esptool Command Line that Was Run

No response

Esptool Output

Traceback (most recent call last):
  File "/opt/esp/python_env/idf5.0_py3.8_env/bin/esptool.py", line 37, in <module>
    esptool._main()
  File "/opt/esp/python_env/idf5.0_py3.8_env/lib/python3.8/site-packages/esptool/__init__.py", line 1139, in _main
    main()
  File "/opt/esp/python_env/idf5.0_py3.8_env/lib/python3.8/site-packages/esptool/__init__.py", line 669, in main
    args = parser.parse_args(argv)
  File "/usr/lib/python3.8/argparse.py", line 1780, in parse_args
    args, argv = self.parse_known_args(args, namespace)
  File "/usr/lib/python3.8/argparse.py", line 1812, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
  File "/usr/lib/python3.8/argparse.py", line 2000, in _parse_known_args
    positionals_end_index = consume_positionals(start_index)
  File "/usr/lib/python3.8/argparse.py", line 1977, in consume_positionals
    take_action(action, args)
  File "/usr/lib/python3.8/argparse.py", line 1886, in take_action
    action(self, namespace, argument_values, option_string)
  File "/usr/lib/python3.8/argparse.py", line 1171, in __call__
    subnamespace, arg_strings = parser.parse_known_args(arg_strings, None)
  File "/usr/lib/python3.8/argparse.py", line 1812, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
  File "/usr/lib/python3.8/argparse.py", line 2021, in _parse_known_args
    stop_index = consume_positionals(start_index)
  File "/usr/lib/python3.8/argparse.py", line 1977, in consume_positionals
    take_action(action, args)
  File "/usr/lib/python3.8/argparse.py", line 1886, in take_action
    action(self, namespace, argument_values, option_string)
  File "/opt/esp/python_env/idf5.0_py3.8_env/lib/python3.8/site-packages/esptool/__init__.py", line 1113, in __call__
    argfile = intel_hex_to_bin(argfile, address)
  File "/opt/esp/python_env/idf5.0_py3.8_env/lib/python3.8/site-packages/esptool/bin_image.py", line 51, in intel_hex_to_bin
    ih.loadhex(file.name)
  File "/opt/esp/python_env/idf5.0_py3.8_env/lib/python3.8/site-packages/intelhex/__init__.py", line 210, in loadhex
    for s in fobj:
  File "/usr/lib/python3.8/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe4 in position 1: invalid continuation byte

What is the Expected Behaviour?

I expect that I can flash a bin-file that is encrypted, without have to ensure it do not randomly start with :.

More Information

by shire chance the encrypted bin file for the esp32 started with a :, and the esptool tries to parse it as a intel Hex-file.
The file name do have the file-extension: .bin and NOT the .ihex or .rom that a intelhex-file could have.

Other Steps to Reproduce

No response

@github-actions github-actions bot changed the title Intelhex check can prevent flashing of binary file. Intelhex check can prevent flashing of binary file. (ESPTOOL-855) May 7, 2024
@tacozMacleo
Copy link
Author

It looks like a workaround have been make for v4.8.dev2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant