can't run espcoredump.py

willemmerson
Posts: 40
Joined: Mon Mar 18, 2019 12:34 pm

can't run espcoredump.py

Postby willemmerson » Wed Feb 12, 2020 10:55 am

I can't run espcoredump and get the following error:

Code: Select all

espcoredump.py -p /dev/ttyUSB0 info_corefile build/8-channel.elf
espcoredump.py v0.4-dev
INFO: Invoke parttool to read image.
/home/willemmerson/.espressif/python_env/idf4.1_py3.7_env/bin/python: can't open file 'parttool.py': [Errno 2] No such file or directory
ERROR: parttool script execution failed with err 2
WARNING: System path is not set. Try to use predefined path.
Traceback (most recent call last):
  File "/home/willemmerson/esp/esp-idf/components/partition_table/parttool.py", line 346, in <module>
    main()
  File "/home/willemmerson/esp/esp-idf/components/partition_table/parttool.py", line 339, in main
    op(**common_args)
  File "/home/willemmerson/esp/esp-idf/components/partition_table/parttool.py", line 182, in _read_partition
    target.read_partition(partition_id, output)
  File "/home/willemmerson/esp/esp-idf/components/partition_table/parttool.py", line 159, in read_partition
    self._call_esptool(["read_flash", str(partition.offset), str(partition.size), output] + self.esptool_read_args)
  File "/home/willemmerson/esp/esp-idf/components/partition_table/parttool.py", line 132, in _call_esptool
    subprocess.check_call(esptool_args, stdout=null_file, stderr=null_file)
  File "/usr/lib64/python3.7/subprocess.py", line 363, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/home/willemmerson/.espressif/python_env/idf4.1_py3.7_env/bin/python', '/home/willemmerson/esp/esp-idf/components/esptool_py/esptool/esptool.py', '--port', '/dev/ttyUSB0', 'read_flash', '1114112', '65536', '/tmp/tmpx0t3ocqs']' returned non-zero exit status 2.
ERROR: parttool script execution failed with err 1
Traceback (most recent call last):
  File "/home/willemmerson/esp/esp-idf/components/espcoredump/espcoredump.py", line 1093, in _load_coredump
    f = self.invoke_parttool(tool_path=tool_path)
  File "/home/willemmerson/esp/esp-idf/components/espcoredump/espcoredump.py", line 1033, in invoke_parttool
    raise e
  File "/home/willemmerson/esp/esp-idf/components/espcoredump/espcoredump.py", line 1017, in invoke_parttool
    et_out = subprocess.check_output(part_tool_args)
  File "/usr/lib64/python3.7/subprocess.py", line 411, in check_output
    **kwargs).stdout
  File "/usr/lib64/python3.7/subprocess.py", line 512, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/home/willemmerson/.espressif/python_env/idf4.1_py3.7_env/bin/python', 'parttool.py', '--port', '/dev/ttyUSB0', 'read_partition', '--partition-type', 'data', '--partition-subtype', 'coredump', '--output', '/tmp/tmpwvrhrlsc']' returned non-zero exit status 2.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/willemmerson/esp/esp-idf/components/espcoredump/espcoredump.py", line 1763, in <module>
    main()
  File "/home/willemmerson/esp/esp-idf/components/espcoredump/espcoredump.py", line 1758, in main
    operation_func(args)
  File "/home/willemmerson/esp/esp-idf/components/espcoredump/espcoredump.py", line 1500, in info_corefile
    loader = ESPCoreDumpFlashLoader(args.off, port=args.port, baud=args.baud)
  File "/home/willemmerson/esp/esp-idf/components/espcoredump/espcoredump.py", line 965, in __init__
    self.fcore = self._load_coredump(off)
  File "/home/willemmerson/esp/esp-idf/components/espcoredump/espcoredump.py", line 1103, in _load_coredump
    f = self.invoke_parttool(tool_path=tool_path)
  File "/home/willemmerson/esp/esp-idf/components/espcoredump/espcoredump.py", line 1033, in invoke_parttool
    raise e
  File "/home/willemmerson/esp/esp-idf/components/espcoredump/espcoredump.py", line 1017, in invoke_parttool
    et_out = subprocess.check_output(part_tool_args)
  File "/usr/lib64/python3.7/subprocess.py", line 411, in check_output
    **kwargs).stdout
  File "/usr/lib64/python3.7/subprocess.py", line 512, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/home/willemmerson/.espressif/python_env/idf4.1_py3.7_env/bin/python', '/home/willemmerson/esp/esp-idf/components/partition_table/parttool.py', '--port', '/dev/ttyUSB0', 'read_partition', '--partition-type', 'data', '--partition-subtype', 'coredump', '--output', '/tmp/tmpx0t3ocqs']' returned non-zero exit status 1.
I can see that it is trying to enter the bootloader and not being successful. I'm not sure why there is an error about not finding partool.py when it is clearly running above.
I am using the chip on a custom board and it is slightly temperamental regarding the bootloader however I am able to flash it reliably.

ESP-IDF: v4.1-dev-2196-g64654c044
Detecting chip type... ESP32
Chip is ESP32D0WDQ5 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz

ESP_igrr
Posts: 2067
Joined: Tue Dec 01, 2015 8:37 am

Re: can't run espcoredump.py

Postby ESP_igrr » Wed Feb 12, 2020 8:51 pm

It seems that the underlying error is that esptool read_flash operation fails, and espcoredump.py mistakenly assumes that the error is due to parttool.py not being found, so it tries to run parttool.py from a dift location.
Can you try running esptool.py read_flash command a few times and see if that works reliably?

willemmerson
Posts: 40
Joined: Mon Mar 18, 2019 12:34 pm

Re: can't run espcoredump.py

Postby willemmerson » Tue Feb 18, 2020 12:36 pm

esptool.py seems to work fine:

Code: Select all

esptool.py -p /dev/ttyUSB0 -b 2000000 read_flash 0 0x10000 flash_contents.bin
esptool.py v3.0-dev
Serial port /dev/ttyUSB0
Connecting.....
Detecting chip type... ESP32
Chip is ESP32D0WDQ5 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 24:6f:28:da:b9:94
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 2000000
Changed.
65536 (100 %)
65536 (100 %)
Read 65536 bytes at 0x0 in 0.4 seconds (1273.7 kbit/s)...
Hard resetting via RTS pin...

willemmerson
Posts: 40
Joined: Mon Mar 18, 2019 12:34 pm

Re: can't run espcoredump.py

Postby willemmerson » Thu Mar 05, 2020 10:50 am

The problem was fixed by using a different usb-serial converter. The one I was using was based around a CP2104 and I'd always had occasional problems flashing. But when using espcoredump.py or parttool.py it is generally doing two or more esptool.py operations in a row which the CP2104 doesn't like at all. The one I'm using now is based around a 2232HL which seems to work a bit better although parttool.py operation still seems to take a few attempts. I suspect our custom design isn't quite right with regard to strapping pins.

Who is online

Users browsing this forum: No registered users and 231 guests