Open ghost opened 1 year ago
Have you tried running cargo embed --target thumbv7em-none-eabihf --features v2
?
Looks like the docs use --features v2
in the example cargo run command.
@curt-wise does the thumbs-up mean that it worked for you? If so I think we should close this issue 🙂
Have you tried running
cargo embed --target thumbv7em-none-eabihf --features v2
? Looks like the docs use--features v2
in the example cargo run command.
Yes i know that the docs state that. But i want to make it work using only:
cargo embed --target thumbv7em-none-eabihf
and preferably using only:
cargo embed
Any idea how i might do that ?
@curt-wise you can read up on cargo features but as I understand it you would have to create your own version of the crate with all conditional compilation for "v2" removed. This would then break compilation for v1.
I am not sure if it is possible to enable a default set of features for cargo otherwise.
However, see here on how to set a default target.
I wanted to create my own project from scratch but could not do that. Like doing cargo new <project_name>
and add the microbit v2 crate in cargo.toml
. I wanted to do that instead of cloning the repository and modifying in it.
possibly have to remove the optional: [dependencies] microbit-v2 = { version = "0.13.0", optional = true }
remove from Cargo.toml: [features] v2 = ["microbit-v2"]
try to compile. if compilation doesn't work, check errors, may have to add this to your .cargo/config if you get linker errors:
[target.'cfg(all(target_arch = "arm", target_os = "none"))'] rustflags = [ "-C", "link-arg=-Tlink.x", ]
should be able to create a new project with cargo new and flash with cargo embed --target thumbv7em-none-eabihf
I have a micro:bit v2.21 and using Linux Kubuntu, i created a new rust project using cargo and modified the files like this:
Cargo.toml
main.rs
When i run
cargo embed --target thumbv7em-none-eabihf
, i get that error: