Closed Code-Tap closed 4 years ago
Hm, what is microbit-blinky
? Judging from the error message I have a suspicion that you're using parts of the example code was written for an older version of cortex-m-rtfm
than the version you're using. Try downgrading the version.
microbit-blinky was a tutorial i was following in 2 places : https://flames-of-code.netlify.com/blog/rust-microbit/ https://droogmic.github.io/microrust/getting-started/01.00.BUILD.html
but i couldn't get the first one to work, so i came to the crate and tried to find a working example. edit: Got the 2nd one to build ( just an empty main loop ) they had a critical line commented out in the linker, but made no mention of it.
i immediately came back and tried to re-compile this one, I dropped to an older rtfm ( cortex-m-rtfm = "0.4.2" ) and progressively tried recompiling with every version of microbit crate available in reverse order. none worked
one positive is that one error and 2 warnings have now dissapeared.
here is whats left
error[E0433]: failed to resolve: could not find `display` in `microbit`
--> src/main.rs:18:16
|
18 | use microbit::display::image::GreyscaleImage;
| ^^^^^^^ could not find `display` in `microbit`
error[E0432]: unresolved imports `microbit::display`, `microbit::display`
--> src/main.rs:19:26
|
19 | use microbit::display::{self, Display, Frame, MicrobitDisplayTimer, MicrobitFrame};
| ^^^^^^^ ^^^^ no `display` in the root
| |
| could not find `display` in `microbit`
error[E0433]: failed to resolve: use of undeclared type or module `GreyscaleImage`
--> src/main.rs:26:6
|
26 | GreyscaleImage::new(&[
| ^^^^^^^^^^^^^^ use of undeclared type or module `GreyscaleImage`
error[E0412]: cannot find type `GreyscaleImage` in this scope
--> src/main.rs:24:42
|
24 | fn heart_image(inner_brightness: u8) -> GreyscaleImage {
| ^^^^^^^^^^^^^^ not found in this scope
error: aborting due to 4 previous errors
There's an example for making the display work right in this crate: https://github.com/therealprof/microbit/blob/master/examples/led_nonblocking.rs
If you check out the the repository you should be able to compile it via:
cargo build --release --example led_nonblocking
and then we can take it from there?
I've now moved the example from the doc_example directly to an example and added the correct dependency to the dev-dependencies
so this can be built out of the box.
https://github.com/therealprof/microbit/blob/master/examples/led_rtfm.rs
Hope that helps.
Thats brilliant! Thanks for responding so quickly. I will have a go later when im back to my computer. I cant wait to do some speed comparisons compared to microython.
No problem.
Huzzah!!!
~/Projects/rustlang
❯ cd microbit
microbit on master is 📦 v0.8.0 via 🦀 v1.41.1
❯ cargo build
Updating crates.io index
Compiling semver-parser v0.7.0
Compiling typenum v1.11.2
Compiling proc-macro2 v1.0.9
Compiling unicode-xid v0.2.0
Compiling cortex-m v0.6.2
Compiling syn v1.0.16
Compiling stable_deref_trait v1.1.1
Compiling cortex-m-rt v0.6.12
Compiling vcell v0.1.2
Compiling fpa v0.1.0
Compiling r0 v0.2.2
Compiling nrf51 v0.7.0
Compiling void v1.0.2
Compiling nb v0.1.2
Compiling microbit v0.8.0 (~/Projects/rustlang/microbit)
Compiling tiny-led-matrix v1.0.2
Compiling semver v0.9.0
Compiling volatile-register v0.2.0
Compiling embedded-hal v0.2.3
Compiling rustc_version v0.2.3
Compiling quote v1.0.2
Compiling generic-array v0.13.2
Compiling generic-array v0.12.3
Compiling bare-metal v0.2.5
Compiling cast v0.2.3
Compiling as-slice v0.1.3
Compiling aligned v0.3.2
Compiling cortex-m-rt-macros v0.1.8
Compiling nrf51-hal v0.7.1
Finished dev [unoptimized + debuginfo] target(s) in 52.06s
microbit on master is 📦 v0.8.0 via 🦀 v1.41.1 took 52s
❯
Well, you haven't built any examples yet. ;) Try:
cargo build --release --examples
Another success! found the built files here
microbit/target/thumbv6m-none-eabi/release/examples
Just got to read up on transferring the code to the microbit and running it now! did'nt expect to get this far this fast!
I feel like I have superpowers tonight You've been amazing and I feel I'm now in a place where I can really start learning about rust and embedded.
Im am struggling to get this to build, as you can see by the errors it seems to have multiple issues.
[dependencies] panic-halt = "~0.2" microbit="~0.8.0" cortex-m-rt="~0.6" cortex-m-rtfm = "0.5.1"
MEMORY { / NOTE K = KiBi = 1024 bytes / FLASH : ORIGIN = 0x00000000, LENGTH = 256K RAM : ORIGIN = 0x20000000, LENGTH = 16K }