esp-rs / espflash

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

cargo espflash behaves differently to espflash when trying to flash bins > 1MB #569

Closed Vollbrecht closed 8 months ago

Vollbrecht commented 8 months ago

We promoting the usage of cargo espflash for simple and easy testing of --examples in a repository. Unfortunately when one of the examples is bigger than 1MB than cargo espflash wont be able to flash it. For example the usage of cargo espflash flash --target riscv32imc-esp-espidf --example wifi --monitor inside esp-idf-svc.

The error that is reported is as follows

Error: espflash::image_too_big (link)

  × Supplied ELF image of 1802560B 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.

espflash is able the handle that issue and autoincrease the app partition itself. I think it would make sense if cargo espflash behave the same.

SergioGasquez commented 8 months ago

cargo-espflash uses the partition-table generated from ESP-IDF project built, while espflash generates a partition table using esp-idf-part and uses it. If you add the partition table arg to espflash and point to the esp-idf generated one, the result should be the same.

MabezDev commented 8 months ago

I think we shouldn't do anything here. I don't think we want to stop the default behaviour of using the bootloader from esp-idf-sys, therefore I think you should add a partitions.csv with a bigger default partition to run your examples.

Feel free to reopen if you have a better suggestion :).

Vollbrecht commented 8 months ago

I am fine with it, it was just a bit anoying that with cargo espflash you get a new option -> automatically getting the esp-idf-sys build partition.csv, but you cant get the feature for auto-resizing, the only alternative is that you have to manually specify the partition.csv. So you get a option by removing another so to speak.

On that note, i now would use the espflash.toml to setup the configuration in esp-idf-hal/svc to workaround the issue. You were talking about removing the .toml and unify the places for settings?

SergioGasquez commented 8 months ago

On that note, i now would use the espflash.toml to setup the configuration in esp-idf-hal/svc to workaround the issue. You were talking about removing the .toml and unify the places for settings?

Not sure what you mean by removing the .toml, but we only support espflash.toml settings now (locals or global), that means that, when using cargo-espflash, you can't specify settings in the package metadata anymore.