Closed jerabaul29 closed 1 year ago
(FYI @gauteh , this was tonight's embassy hacking, if you have ideas of why this is broken / where I am doing something wrong just let me know - not very used to setting up new projects, cargo, etc, on my end :) . If not, I will ask on matrix the embassy users :) ).
Are you building it for the correct target? Thumbv7 or similar?
Good point, many thanks for the help, I added a .cargo config with target information copied from the embassy example (pushed to this repo now), this solved a couple of issues, getting new ones now :) . Any idea?
✔ ~/Desktop/Git/embassy_experiments/examples/blink [main|✔]> cargo build --bin blinky --release
[...]
Compiling embedded-hal-async v1.0.0-rc.1
error[E0554]: `#![feature]` may not be used on the stable release channel
--> /home/jrmet/.cargo/registry/src/index.crates.io-6f17d22bba15001f/embedded-hal-async-1.0.0-rc.1/src/lib.rs:4:1
|
4 | #![feature(async_fn_in_trait, impl_trait_projections)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Compiling embedded-storage-async v0.4.0
error[E0554]: `#![feature]` may not be used on the stable release channel
--> /home/jrmet/.cargo/registry/src/index.crates.io-6f17d22bba15001f/embedded-storage-async-0.4.0/src/lib.rs:7:1
|
7 | #![feature(async_fn_in_trait)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
For more information about this error, try `rustc --explain E0554`.
error: could not compile `embedded-storage-async` (lib) due to previous error
warning: build failed, waiting for other jobs to finish...
error: could not compile `embedded-hal-async` (lib) due to previous error
✘-INT ~/Desktop/Git/embassy_experiments/examples/blink [main| …4]>
✘-INT ~/Desktop/Git/embassy_experiments/examples/blink [main| …4]> cargo +nightly build --bin blinky --release
Compiling proc-macro2 v1.0.67
Compiling unicode-ident v1.0.12
Compiling syn v1.0.109
Compiling defmt v0.3.5
Compiling version_check v0.9.4
Compiling thiserror v1.0.49
Compiling defmt-macros v0.3.6
Compiling semver-parser v0.7.0
Compiling semver v0.9.0
Compiling bitflags v1.3.2
error[E0463]: can't find crate for `core`
|
= note: the `thumbv8m.main-none-eabihf` target may not be installed
= help: consider downloading the target with `rustup target add thumbv8m.main-none-eabihf`
= help: consider building the standard library from source with `cargo build -Zbuild-std`
error[E0463]: can't find crate for `compiler_builtins`
error[E0463]: can't find crate for `core`
--> /home/jrmet/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bitflags-1.3.2/src/lib.rs:282:1
|
282 | pub extern crate core as _core;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
|
= note: the `thumbv8m.main-none-eabihf` target may not be installed
= help: consider downloading the target with `rustup target add thumbv8m.main-none-eabihf`
= help: consider building the standard library from source with `cargo build -Zbuild-std`
For more information about this error, try `rustc --explain E0463`.
error: could not compile `bitflags` (lib) due to 3 previous errors
warning: build failed, waiting for other jobs to finish...
Looks like you need to rustup add target the correct target, e.g. for armv7: rustup target add thumbv7em-none-eabihf
Many thanks for the help, after a bit of trial and errors this worked out :) . The trick is that I needed to use nightly, and to install what I needed also in nightly (not in stable). I.e.:
✔ ~/Desktop/Git/embassy_experiments/examples/blink [main| …4]> rustup target add thumbv8m.main-none-eabihf
info: component 'rust-std' for target 'thumbv8m.main-none-eabihf' is up to date
✔ ~/Desktop/Git/embassy_experiments/examples/blink [main| …4]> cargo +nightly build --bin blinky --release
[...]
Compiling futures-core v0.3.28
error[E0463]: can't find crate for `core`
|
= note: the `thumbv8m.main-none-eabihf` target may not be installed
= help: consider downloading the target with `rustup target add thumbv8m.main-none-eabihf`
= help: consider building the standard library from source with `cargo build -Zbuild-std`
✘-101 ~/Desktop/Git/embassy_experiments/examples/blink [main| …4]> rustup +nightly target add thumbv8m.main-none-eabihf
info: downloading component 'rust-std' for 'thumbv8m.main-none-eabihf'
info: installing component 'rust-std' for 'thumbv8m.main-none-eabihf'
✔ ~/Desktop/Git/embassy_experiments/examples/blink [main| …4]> cargo +nightly build --bin blinky --release
[...]
Finished release [optimized + debuginfo] target(s) in 22.54s
A bit tricky to get going the first time, but looks like it is all good now :) . Thanks again for the help :) .
I will definitely have to set up some form of container to be able to easily build this - otherwise I think I am going to bump my head on these points again and again ^^ .
I am trying to get inspiration from the example at https://github.com/embassy-rs/embassy/tree/main/examples/stm32u5 to understand how to "start" a new project with embassy.
If I understand correctly, I have to link to the source in the Cargo.toml file, i.e. something like:
and not something like:
as the crate is empty online (same for the other embassy stm32 crates):
https://crates.io/crates/embassy-stm32 .
However, trying to adapt the working example from the embassy repo https://github.com/embassy-rs/embassy/tree/main/examples/stm32u5 , into my own example https://github.com/jerabaul29/embassy_experiments/tree/main/examples/blink , I get issues: