mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-30 15:34:33 +01:00
device path must be absolute; clarify
This commit is contained in:
parent
b8665a2f31
commit
efe6b516fb
2 changed files with 25 additions and 6 deletions
|
@ -7,11 +7,14 @@ This is the smallest possible RTIC application:
|
||||||
```
|
```
|
||||||
|
|
||||||
All RTIC applications use the [`app`] attribute (`#[app(..)]`). This attribute
|
All RTIC applications use the [`app`] attribute (`#[app(..)]`). This attribute
|
||||||
must be applied to a `mod`-item. The `app` attribute has
|
must be applied to a `mod`-item. The `app` attribute has a mandatory `device`
|
||||||
a mandatory `device` argument that takes a *path* as a value. This path must
|
argument that takes a *path* as a value. This must be a full path pointing to a
|
||||||
point to a *peripheral access crate* (PAC) generated using [`svd2rust`]
|
*peripheral access crate* (PAC) generated using [`svd2rust`] **v0.14.x** or
|
||||||
**v0.14.x** or newer. The `app` attribute will expand into a suitable entry
|
newer. More details can be found in the [Starting a new project](./new.md)
|
||||||
point so it's not required to use the [`cortex_m_rt::entry`] attribute.
|
section.
|
||||||
|
|
||||||
|
The `app` attribute will expand into a suitable entry point so it's not required
|
||||||
|
to use the [`cortex_m_rt::entry`] attribute.
|
||||||
|
|
||||||
[`app`]: ../../../api/cortex_m_rtic_macros/attr.app.html
|
[`app`]: ../../../api/cortex_m_rtic_macros/attr.app.html
|
||||||
[`svd2rust`]: https://crates.io/crates/svd2rust
|
[`svd2rust`]: https://crates.io/crates/svd2rust
|
||||||
|
|
|
@ -52,7 +52,23 @@ $ curl \
|
||||||
> src/main.rs
|
> src/main.rs
|
||||||
```
|
```
|
||||||
|
|
||||||
That example depends on the `panic-semihosting` crate:
|
The `init` example uses the `lm3s6965` device. Remember to adjust the `device`
|
||||||
|
argument in the app macro attribute to match the path of your PAC crate, if
|
||||||
|
different, and add peripherals or other arguments if needed. Although aliases
|
||||||
|
can be used, this needs to be a full path (from the crate root). For many
|
||||||
|
devices, it is common for the HAL implementation crate (aliased as `hal`) or
|
||||||
|
Board Support crate to re-export the PAC as `pac`, leading to a pattern similar
|
||||||
|
to the below:
|
||||||
|
|
||||||
|
```rust
|
||||||
|
use abcd123_hal as hal;
|
||||||
|
//...
|
||||||
|
|
||||||
|
#[rtic::app(device = crate::hal::pac, peripherals = true, monotonic = rtic::cyccnt::CYCCNT)]
|
||||||
|
mod app { /*...*/ }
|
||||||
|
```
|
||||||
|
|
||||||
|
The `init` example also depends on the `panic-semihosting` crate:
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo add panic-semihosting
|
$ cargo add panic-semihosting
|
||||||
|
|
Loading…
Reference in a new issue