esp-rs / esp-idf-svc

Type-Safe Rust Wrappers for various ESP-IDF services (WiFi, Network, Httpd, Logging, etc.)
https://docs.esp-rs.org/esp-idf-svc/
Apache License 2.0
309 stars 175 forks source link

cargo-espflash not picking up partitions.csv? #402

Closed weiying-chen closed 6 months ago

weiying-chen commented 6 months ago

I cloned the repo and ran:

MCU=esp32c3 cargo espflash flash --target riscv32imc-esp-espidf --example wifi --monitor

And I got this error:

Error: espflash::image_too_big (link)

  × Supplied ELF image of 1799664B is too big, and doesn't fit configured app partition of 1048576B
  help: Reduce the size of the binary or increase the size of the app partition.

This is the current partitions.csv:

# Name,   Type, SubType, Offset,  Size, Flags
# Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap
nvs,      data, nvs,     ,        0x6000,
phy_init, data, phy,     ,        0x1000,
factory,  app,  factory, ,        3M,

The app partition seems to be set to 3M. And no matter how I change partitions.csv, I keep getting the same error.

weiying-chen commented 6 months ago

I solved the issue by generating my own partitions-table.bin (in the repo's root folder):

espflash partition-table --to-binary --output partition-table.bin partitions.csv

Then passing it to cargo espflash as an argument:

MCU=esp32c3 cargo espflash flash --target riscv32imc-esp-espidf --example wifi --monitor --partition-table="partition-table.bin"
Vollbrecht commented 6 months ago

If you are using espflash than this is not a problem, but cargo espflash works a bit different. Because they made changes in the respected versions 3 of espflash and cargo espflash we now provide the partitions.csv in the root. Though with the extra espflash.toml file it should automatically pick it up.

What version of espflash are you using? It should working with a csv file and if not it may indicate a bug in espflash

weiying-chen commented 6 months ago

Ah, I updated espflash and cargo-espflash (from 2.x.x to 3.x.x). The error is gone. Sorry, I should have done that before opening this issue.