-
Notifications
You must be signed in to change notification settings - Fork 33
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
Example using teensy4_bsp
with rtic
?
#62
Comments
RTIC (formerly RTFM) support isn't as straight forward as we'd like. But, it's do-able. We'll show how to turn on the LED from RTIC, then we'll talk about today's biggest limitation. I've started by prototyping RTIC support in the Check out the #![no_std]
#![no_main]
extern crate teensy4_fcb;
use embedded_hal::digital::v2::OutputPin;
use panic_halt as _;
use imxrt_hal::gpio::IntoGpio;
// Note: HAL, not BSP --v
#[rtic::app(device = imxrt_hal, peripherals = true)]
const APP: () = {
#[init]
fn init(cx: init::Context) {
// Cortex-M peripherals
let _core: cortex_m::Peripherals = cx.core;
// Device specific peripherals
let device: imxrt_hal::Peripherals = cx.device;
// Prepare the LED
//
// The LED on the Teensy 4 is driven by pad B0_03.
let mut led = device.iomuxc.gpio_b0_03.alt5().into_gpio().output();
led.set_high().unwrap();
}
#[idle]
fn idle(_: idle::Context) -> ! {
loop {
core::sync::atomic::spin_loop_hint();
}
}
}; The brief README describes how to build and download the example to your Teensy 4. Limitation: RTIC directly depends on
I went with the second approach in this prototype. See the This might get us started with RTIC on the Teensy 4. For a longer-term solution, we need to reconcile the runtime crate disparity. Let me know your thoughts on this, or if anything was unclear! |
Thanks so much for such a thorough explanation and putting together this example! I finally had a chance to compile and run the example in your imxrt-rs fork without issues 👍 For now I think your |
Update: I've got the I'm planning on opening two PRs:
In the meantime feel free to let me know if you'd prefer I took a different route, otherwise I'll likely open these soon. |
This adds a `cortex-m-rt-patch` directory that contains a tiny crate that re-exports `teensy4-rt` in its entirety under the crate name `cortex-m-rt` to provide a convenient way of patching upstream crates. The hope is to make workarounds for issues like mciantyre#62 a little easier pending solving rust-embedded/cortex-m-rt#164 and the reconciliation of `cortex-m-rt` and `teensy4-rt`.
Hi! I'm interested in creating a small example that demonstrates how to use
teensy4_bsp
alongsidertic
. Something simple like blinking the on-board LED that demonstrates the basic setup required.Here's what I have so far:
I'm just starting with minimum viable project rtic project as described in their guide here, though so far I'm running into this compilation error:
One of the first things I'm unsure about is whether or not I'm able to directly specify the
teensy4_bsp
crate as thertic::app
device
parameter as I'm doing above. The book mentions that a crate should be specified that was generated viasvd2rust
- teensy4-bsp appears to be hand-rolled but I did notice that theimxrt-hal
crate has anrtfm
feature (the previous moniker forrtic
) so perhaps it's a matter of exposing this via a feature?I'm quite new to both rust-embedded and rtic, so any advice you could offer on how to move ahead with this example would be greatly appreciated! Would also be happy to open a PR up here with the
rtic_led.rs
example if once complete if you're interested.Edit: Ahh I just noticed #52 - my understanding is that this would allow creating the
teensy4_bsp
peripherals from theimxrt
peripherals, though it looks like since the PR was opened thepac
crate has been deprecated in favour of the newral
crate. Any advice on using theral
alongsidertic
?The text was updated successfully, but these errors were encountered: