badgeteam / website

The Badge.team website
https://badge.team
3 stars 18 forks source link

Build instructions for Rust on ESP32 fail #90

Closed jhaand closed 2 years ago

jhaand commented 2 years ago

Thank you for making Rust work on the MCH2022 badge. Unfortunately I couldn't get the example working out of the box.

Time: 2022-07-29T21:48 Observed: \ When executing the step with: cargo espflash save-image ESP32 rust_esp.img I get an error: \ error: Found argument 'rust_esp.img' which wasn't expected, or isn't valid in this context

Expected: \ Build starting as described in documents.

Work around: \ The build finishes succesfully when using cargo espflash save-image rust_esp.img or \ cargo espflash save-image --target xtensa-esp32-espidf rust_esp.img

cc: @p2mate @a2800276

p2mate commented 2 years ago

try cargo espflash save-image ESP32 rust_esp.img

no idea why this is needed

Peter.

On Fri, 29 Jul 2022, 21.59 Jelle Haandrikman, @.***> wrote:

Thank you for making Rust work on the MCH2022 badge. Unfortunately I couldn't get the example working out of the box.

Time: 2022-07-29T21:48 Observed: When executing the step with: cargo espflash save-image ESP32 rust_esp.img I get an error: error: Found argument 'rust_esp.img' which wasn't expected, or isn't valid in this context

Expected: Build starting as described in documents.

Work around: The build finishes succesfully when using cargo espflash save-image rust_esp.img or cargo espflash save-image --target xtensa-esp32-espidf rust_esp.img

cc: @p2mate https://github.com/p2mate @a2800276 https://github.com/a2800276

— Reply to this email directly, view it on GitHub https://github.com/badgeteam/website/issues/90, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGXA2MOVZOPR7HWKCEXO5BDVWQZ3XANCNFSM55BZRRKQ . You are receiving this because you were mentioned.Message ID: @.***>

jhaand commented 2 years ago

The command you suggested doesn't work.

If you move the save-image to the back, then it works; cargo espflash ESP32 save-image rust_esp.img

It's written correctly in the more extensive example. So the document needs an update.

p2mate commented 2 years ago

Ok, will check tomorrow

On Fri, 29 Jul 2022, 22.28 Jelle Haandrikman, @.***> wrote:

The command you suggested doesn't work.

If you move the save-image to the back, then it works; cargo espflash ESP32 save-image rust_esp.img

It's written correctly in the more extensive example. So the document needs an update.

— Reply to this email directly, view it on GitHub https://github.com/badgeteam/website/issues/90#issuecomment-1199923187, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGXA2MN4TX3FED5TM27ENXDVWQ5IPANCNFSM55BZRRKQ . You are receiving this because you were mentioned.Message ID: @.***>

a2800276 commented 2 years ago

Hmmm, we went through step by step to make sure everything works. Seems like we missed something.

Random thoughts:

I'll try again tomorrow. Maybe theirs some prerequisite we both had installed and assumed to just exist...?

jhaand commented 2 years ago

Hi, Just to make things clear. I run Debian Testing. I used the 'git clone' method for installing the esp-rs tooling. The PATH's are included in my shell environment. I rebuild cargo-generate and espflash. With cargo-generate I used the options: MCU: ESP32, Dev containers: false, ESP-IDF version: 4.4, STD support: true.

This command works: \ cargo espflash ESP32 save-image rust_esp.img

This command fails: \ cargo espflash save-image ESP32 rust_esp.img

See the attached log: mch_rust_badge.txt

a2800276 commented 2 years ago

Thanks, I think we used the downloaded tools to build this, maybe you are using the "cutting edge " version and the arg order got switch. I'll check if it works the other way round on my setup and will update docs accordingly.

Won't happen before the end of the weekend l, though.

Thanks for the update!

jhaand commented 2 years ago

Great to hear it. Glad to help and make things better. Have a nice weekend.

stappersg commented 2 years ago

Crossreference to #94, binary needs to be called main.bin.

a2800276 commented 2 years ago

I'm afraid I know nothing about rust on esp. But the instructions as they are described on the docs site "work on my computer". I can't tell if this this the "canoncial" way to install the rust/esp tools though. And whether what you are doing is the "right" way or not. Please let me know what version you are using, i.e not "the one from Debian testing using git", but the output of:

$ cargo espflash save-image --help  
cargo-espflash-save-image 1.6.0
Save the image to disk instead of flashing to device

USAGE:
    cargo espflash save-image [OPTIONS] <CHIP> <FILE>

As best as I can tell from this, having the info after save-image is correct and 1.6.0 seems to be the current version. Maybe you are using an older version of the tools (or one that is not yet a stable release?)

As our usage messages are different, I assume we are using different versions ...

Also:

$ cargo espflash save-image ESP32 rust_esp.img
... works ...
$ cargo espflash ESP32 save-image rust_esp.img
error: The following required arguments were not provided:
    <FILE>

USAGE:
    cargo espflash save-image <CHIP> <FILE>

For more information try --help

so it it would be beneficial to know which is the correct argument order.

jhaand commented 2 years ago

Hi, I use espflash 1.6.0 The one generated by Cargo. But this might explain it. The cargo-espflash binary still uses 1.4.1

breetai@thinktop2:~/code/rust4mch$ cargo espflash save-image --help
cargo-espflash-save-image 1.4.1
Save the image to disk instead of flashing to device

A quick cargo install --force cargo-espflash helped with that one.

breetai@thinktop2:~/code/rust4mch$ cargo espflash --version
cargo-espflash 1.6.0

Which means that the cargo-espflash now works as you described.

breetai@thinktop2:~/code/rust4mch$ cargo espflash save-image ESP32 rust_esp.img
   Compiling rust4mch v0.1.0 (/home/breetai/code/rust4mch)
    Finished dev [optimized + debuginfo] target(s) in 3.06s

I think this issue can now be closed. Sorry for the inconvenience.

a2800276 commented 2 years ago

No worries! And thanks very much for figuring this out and posting an update!