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

cargo runner error: unexpected argument #583

Closed
phemmer opened this issue Feb 15, 2024 · 4 comments
Closed

cargo runner error: unexpected argument #583

phemmer opened this issue Feb 15, 2024 · 4 comments

Comments

@phemmer
Copy link

phemmer commented Feb 15, 2024

Using the template esp-rs/esp-template to create a project defaults to using espflash. However the "Rust on ESP book" says that cargo-espflash should be preferred. After installing cargo-espflash and trying to switch to it, it generates an error:

# cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.12s
     Running `cargo espflash flash -p '/dev/serial/by-id/usb-Espressif_USB_JTAG_serial_debug_unit_54:32:04:07:2E:94-if00' --monitor target/riscv32imac-unknown-none-elf/debug/pumps`
error: unexpected argument 'target/riscv32imac-unknown-none-elf/debug/pumps' found

Usage: cargo espflash flash [OPTIONS]

For more information, try '--help'.

From the following runner config in config.toml:

[target.riscv32imac-unknown-none-elf]
runner = "cargo espflash flash -p /dev/serial/by-id/usb-Espressif_USB_JTAG_serial_debug_unit_54:32:04:07:2E:94-if00 --monitor"

Looking at the --help of the two commands, it seems there is a difference in that espflash takes a path to an image as a positional argument, while cargo-espflash does not. It also does not appear that any of the flags (e.g. --bin) accept the path that cargo gives it.

Can we get some documentation on how to properly integrate cargo-espflash into the cargo config as a runner?

@SergioGasquez
Copy link
Member

Hi! cargo-espflash cant be used as a Cargo custom runner, if you do cargo espflash flash --monitor it will build, flash and monitor. cargo espflash basically adds espflash the building features. Hence, if you want to use a custom runner, use espflash.

However the "Rust on ESP book" says that cargo-espflash should be preferred.

Can you point me to where this is in the book?

@phemmer
Copy link
Author

phemmer commented Feb 15, 2024

https://esp-rs.github.io/book/troubleshooting/espflash.html

You should also prefer using cargo-espflash over espflash.

@SergioGasquez
Copy link
Member

SergioGasquez commented Feb 15, 2024

That statement does not apply to you:

If you are building an esp-idf-sys based project

This is not your case, you are not building an esp-idf-sys based project.

@SergioGasquez
Copy link
Member

I will close the issue, should you have more questions feel free to post them here or in the matrix room

@github-project-automation github-project-automation bot moved this from Todo to Done in esp-rs Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants