esp-rs / espflash

Serial flasher utility for Espressif SoCs and modules based on esptool.py
Apache License 2.0
488 stars 118 forks source link

cargo-espflash's `--erase-part` option requires `--partition-table` even when the partition table is set via metadata #390

Closed codyps closed 1 year ago

codyps commented 1 year ago

When passing --erase-part to cargo-espflash for a package that has a partition table in package metadata (ie: in Cargo.toml's [package.metadata.espflash] section), cargo-espflash still complains with:

error: the following required arguments were not provided:
  --partition-table <FILE>

Instead of returning an error, cargo-espflash should use the partition table provided by the metadata when a partition erase is requested (if that metadata is present for the package used).

SergioGasquez commented 1 year ago

I've peeked into this issue, and there is some entangling to solve. Both --erase-parts and --erase-data-parts require --partition-table since in espflash we dont access the Cargo.toml, hence we can't read the partition from there. In cargo-espflash we reuse the FlashArgs defined in espflash.

One possible solution would be to remove the requirement of --partition-table and improve the error message when it's not supplied suggesting that you may have missed adding it.