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

Allow passing partition table to forward to parttool (IDFGH-12300) #6

Closed
torkleyy opened this issue Mar 8, 2024 · 1 comment
Closed

Comments

@torkleyy
Copy link

torkleyy commented Mar 8, 2024

Right now the tool crashes when the partition table isn't in the default location in flash:

thomas@thomas-mbp ~/W/myproject (main) [SIGINT]> python ~/.espressif/esp-idf/v5.1.3/components/espcoredump/espcoredump.py -p /dev/cu.usbserial-114201 info_corefile firmware/target/xtensa-esp32-espidf/release/esp-firmware
WARNING: /Users/thomas/Workspace/myproject/firmware/target/xtensa-esp32-espidf/release/project_description.json does not exist. Please build the app with "idf.py build"
INFO: Invoke parttool to read image.
Failed to load core dump: parttool script execution failed with error 1, failed command was: '/Users/thomas/.espressif/python_env/idf5.1_py3.11_env/bin/python /Users/thomas/.espressif/esp-idf/v5.1.3/components/partition_table/parttool.py --port /dev/cu.usbserial-114201 --baud 115200 read_partition --partition-type data --partition-subtype coredump --output /var/folders/tn/8gmb5b0d3n939xr1fwtj8s2m0000gn/T/tmp2u3apg6e'

┌────── Additional information about the error:
│
│   esptool.py v4.7.0
│   Serial port /dev/cu.usbserial-114201
│   Connecting.....
│   Detecting chip type... Unsupported detection protocol, switching and trying again...
│   Connecting....
│   Detecting chip type... ESP32
│   Chip is ESP32-D0WD-V3 (revision v3.1)
│   Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
│   Crystal is 40MHz
│   MAC: fc:b4:67:ce:55:cc
│   Uploading stub...
│   Running stub...
│   Stub running...
│   3072 (100 %)
│   3072 (100 %)
│   Read 3072 bytes at 0x00008000 in 0.3 seconds (76.8 kbit/s)...
│   Hard resetting via RTS pin...
│   Running /Users/thomas/.espressif/python_env/idf5.1_py3.11_env/bin/python /Users/thomas/.espressif/esp-idf/v5.1.3/components/esptool_py/esptool/esptool.py --port /dev/cu.usbserial-114201 --baud 115200 read_flash 32768 3072 /var/folders/tn/8gmb5b0d3n939xr1fwtj8s2m0000gn/T/tmpchjndu0k...
│   Traceback (most recent call last):
│     File "/Users/thomas/.espressif/esp-idf/v5.1.3/components/partition_table/parttool.py", line 358, in <module>
│       main()
│     File "/Users/thomas/.espressif/esp-idf/v5.1.3/components/partition_table/parttool.py", line 327, in main
│       target = ParttoolTarget(**target_args)
│                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
│     File "/Users/thomas/.espressif/esp-idf/v5.1.3/components/partition_table/parttool.py", line 105, in __init__
│       partition_table = gen.PartitionTable.from_binary(f.read())
│                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
│     File "/Users/thomas/.espressif/esp-idf/v5.1.3/components/partition_table/gen_esp32part.py", line 318, in from_binary
│       result.append(PartitionDefinition.from_binary(data))
│                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
│     File "/Users/thomas/.espressif/esp-idf/v5.1.3/components/partition_table/gen_esp32part.py", line 467, in from_binary
│       res.name = res.name.decode()
│                  ^^^^^^^^^^^^^^^^^
│   UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte

│
└────── end of additional information about the error.

This is my partition table:

# name,   type, subtype,  offset,   size,   flags
ota_0,    app,  ota_0,    0x10000,  4M,
ota_1,    app,  ota_1,    0x410000, 4M,
coredump, data, coredump, 0x810000, 64k,
otadata,  data, ota,      0x820000, 0x2000,
phy_init, data, phy,      0x822000, 0x1000,
nvs_key,  data, nvs_keys, 0x823000, 0x1000, encrypted
efuse_em, data, efuse,    0x824000, 0x2000,
nvs,      data, nvs,      0x900000, 6M,     encrypted

Note: I'm not using idf.py directly because I'm using the ESP IDF with Rust.

@github-actions github-actions bot changed the title Allow passing partition table to forward to parttool Allow passing partition table to forward to parttool (IDFGH-12300) Mar 8, 2024
@peterdragun
Copy link
Collaborator

Hi @torkleyy, I am sorry for the inconvenience. The partition table offset is currently only supported in ESP-IDF, I will add the option to use it even when using the coredump as a separate tool.
In the meantime, you can set the offset of the coredump partition by adding --off argument. The option requires an integer, so in your case, the command should look something like this (0x810000 -> 8454144):
python ~/.espressif/esp-idf/v5.1.3/components/espcoredump/espcoredump.py -p /dev/cu.usbserial-114201 info_corefile firmware/target/xtensa-esp32-espidf/release/esp-firmware --off 8454144
or if you have esp-coredump installed from this repo:
esp-coredump -p /dev/cu.usbserial-114201 info_corefile firmware/target/xtensa-esp32-espidf/release/esp-firmware --off 8454144

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

3 participants