-
Notifications
You must be signed in to change notification settings - Fork 1
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
Use probe-rs as probe-run is deprecated #1
Conversation
The probe-run carte has been deprecated, https://ferrous-systems.com/blog/probe-run-deprecation. I followed the migration steps in the Blog Post https://ferrous-systems.com/blog/probe-run-deprecation/#migration-steps With this change `cargo run --example blinky` flashes and the green LED blinks. If you have a version of probe-rs <= 0.22.0 then you may see an error; see: probe-rs/probe-rs#2072.
With `cargo run --example rprintln` you see both rprintln and debug_rprintln lines being printed. With `cargo run --release --example rprintln` you see just rprintln lines printed.
Build and run if probe-rs was installed using `cargo install probe-rs --features cli` $ cargo run --example channels-3u-1d Alternatively using embed and a multi-tabe terminal is seen. Use F1, F2 and F3 to switch between tabs, Ctrl-C to terminate: $ cargo embed --example channels-3u-1d Build and run using `probe-rs` directly: $ cargo build --example channels-3u-1d $ probe-rs run --chip STM32F446RETx target/thumbv7em-none-eabi/debug/examples/channels-3u-1d
Thanks for the PR! I agree it's a good idea to move to probe-rs since probe-run is deprecated. |
@@ -13,11 +13,12 @@ categories = ["embedded", "hardware-support", "no-std"] | |||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |||
|
|||
[dependencies] | |||
cortex-m = "0.7.5" | |||
cortex-m = { version = "0.7.5", features = ["critical-section-single-core"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this feature needed for? I initially had a build error that I think is due to this feature being added in a later version of cortex-m.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before adding that I got errors that _critical_section_1_0_release
and _critical_section_1_0_acquire
were undefined.
wink@3900x 24-01-25T17:29:44.278Z:~/prgs/rust/forks/nucleo-f446re (Use-probe-rs)
$ cargo run --example blinky
Compiling cortex-m v0.7.7
Compiling critical-section v1.1.2
Compiling rtt-target v0.4.0
Compiling stm32f4 v0.14.0
Compiling panic-probe v0.3.1
Compiling nucleo-f446re v0.1.0 (/home/wink/prgs/rust/forks/nucleo-f446re)
Compiling stm32f4xx-hal v0.13.2
error: linking with `rust-lld` failed: exit status: 1
|
= note: LC_ALL="C" PATH="/home/wink/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:
...
-f446re/target/thumbv7em-none-eabi/debug/examples/blinky-246071663e38f089" "--gc-sections" "--nmagic" "-Tlink.x"
= note: rust-lld: error: undefined symbol: _critical_section_1_0_acquire
>>> referenced by lib.rs:183 (/home/wink/.cargo/registry/src/index.crates.io-6f17d22bba15001f/critical-section-1.1.2/src/lib.rs:183)
>>> rtt_target-50579e5237c22b68.rtt_target.d2ed4632eeeaf5a9-cgu.0.rcgu.o:(critical_section::with::h4960bdd999319092) in archive /home/wink/prgs/rust/forks/nucleo-f446re/target/thumbv7em-none-eabi/debug/deps/librtt_target-50579e5237c22b68.rlib
rust-lld: error: undefined symbol: _critical_section_1_0_release
>>> referenced by lib.rs:200 (/home/wink/.cargo/registry/src/index.crates.io-6f17d22bba15001f/critical-section-1.1.2/src/lib.rs:200)
>>> rtt_target-50579e5237c22b68.rtt_target.d2ed4632eeeaf5a9-cgu.0.rcgu.o:(core::ptr::drop_in_place$LT$critical_section..with..Guard$GT$::h5caa149425e17113) in archive /home/wink/prgs/rust/forks/nucleo-f446re/target/thumbv7em-none-eabi/debug/deps/librtt_target-50579e5237c22b68.rlib
error: could not compile `nucleo-f446re` (example "blinky") due to previous error
wink@3900x 24-01-25T17:30:37.535Z:~/prgs/rust/forks/nucleo-f446re (Use-probe-rs)
I did a search for undefined _critical_section_1_0_release and found this so I added critical-section-single-core
. Actually, I didn't find that ferrous post originally, but it pedantically explains why so used that one here :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah! I see what's going on now. I had an older lockfile initially, which only use 0.7.5, which does fail to build with the feature (because it was added in 0.7.6). But, newer versions of the dependencies use 0.7.7 which does have the feature, and requires it in this situation (as your link to the Ferrous Systems blog explains). At least it makes sense now.
embedded-hal = "0.2.7" | ||
switch-hal = "0.4.0" | ||
stm32f4xx-hal = { version = "0.13.2", features = ["stm32f446"]} | ||
unwrap-infallible = "0.1.5" | ||
rtt-target = "0.5.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed for cargo embed for the example you added? If so, I think it's best to place it in the dev-dependencies as someone using the crate as a library has no need to add this as a dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'm going to remove the new examples so this will be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest, I don't see much value in this example being included in this repository. It seems more like a demonstration of rtt features as otherwise the behavior is identical to the blinky example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that was important feature you can when using probe-rs so I added it. But to simplify this change I'm removing them.
let mut output2 = channels.up.1; | ||
writeln!( | ||
output2, | ||
"Hi! I will turn anything you type on channel 0 into upper case." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran this example but couldn't get it to work like I thought. On channel 0 I am able to get an uppercase'd echo and periodic logs on channel 2, but channel 1 (which has this message) doesn't do anything. I probably need to read up more on RTT to get what is going on here.
It does feel similar to the comment I left on the other example, that I'm not sure this adds much to this nucleo crate (rather an example of RTT usage). But, it is a more involved example so I'm more inclined to include it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing for now
By the way, you mentioned not being able to get the serial working. The debugger built into the nucleo should provide a USB CDC serial port to your system. For Windows this shows up as a COM port and on Linux it might be a tty. You should be able to use any serial terminal to access it, for example PuTTy or |
Closing I've got a simpler PR that just Uses probe-rs |
First stab, the examples work except I don't know how to setup/test the serial examples.