mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-27 22:15:07 +01:00
1.8 KiB
1.8 KiB
Starting a new project
Now that you have learned about the main features of the RTFM framework you can try it out on your hardware by following these instructions.
- Instantiate the
cortex-m-quickstart
template.
$ # for example using `cargo-generate`
$ cargo generate \
--git https://github.com/rust-embedded/cortex-m-quickstart \
--name app
$ # follow the rest of the instructions
- Add a peripheral access crate (PAC) that was generated using
svd2rust
v0.14.x, or a board support crate that depends on one such PAC as a dependency. Make sure that thert
feature of the crate is enabled.
In this example, I'll use the lm3s6965
device crate. This device crate
doesn't have an rt
Cargo feature; that feature is always enabled.
This device crate provides a linker script with the memory layout of the target
device so memory.x
and build.rs
need to be removed.
$ cargo add lm3s6965 --vers 0.1.3
$ rm memory.x build.rs
- Add the
cortex-m-rtfm
crate as a dependency and, if you need it, enable thetimer-queue
feature.
$ cargo add cortex-m-rtfm --allow-prerelease
- Write your RTFM application.
Here I'll use the init
example from the cortex-m-rtfm
crate.
$ curl \
-L https://github.com/japaric/cortex-m-rtfm/raw/v0.5.0-alpha.1/examples/init.rs \
> src/main.rs
That example depends on the panic-semihosting
crate:
$ cargo add panic-semihosting
- Build it, flash it and run it.
$ # NOTE: I have uncommented the `runner` option in `.cargo/config`
$ cargo run
{{#include ../../../../ci/expected/init.run}}```