diff options
author | 2020-10-13 13:14:03 +0000 | |
---|---|---|
committer | 2020-10-13 13:14:03 +0000 | |
commit | 1db5faad62c89cff19d2a94c8ce7b98bac9439ac (patch) | |
tree | b695a3ba77a6d8e3d1b3bd9c0a1c86f947e958c2 | |
parent | b8665a2f312d325a9963075614a6c406e9fe3882 (diff) | |
parent | efe6b516fb4def3b704216362155633c0834dcc7 (diff) | |
download | rtic-1db5faad62c89cff19d2a94c8ce7b98bac9439ac.tar.gz rtic-1db5faad62c89cff19d2a94c8ce7b98bac9439ac.tar.zst rtic-1db5faad62c89cff19d2a94c8ce7b98bac9439ac.zip |
Merge #392
392: device path must be absolute; clarify r=AfoHT a=dcarosone
feel free to nitpick path terminology
Co-authored-by: Daniel Carosone <Daniel.Carosone@gmail.com>
-rw-r--r-- | book/en/src/by-example/app.md | 13 | ||||
-rw-r--r-- | book/en/src/by-example/new.md | 18 |
2 files changed, 25 insertions, 6 deletions
diff --git a/book/en/src/by-example/app.md b/book/en/src/by-example/app.md index ab6f4524..c4f18c7a 100644 --- a/book/en/src/by-example/app.md +++ b/book/en/src/by-example/app.md @@ -7,11 +7,14 @@ This is the smallest possible RTIC application: ``` All RTIC applications use the [`app`] attribute (`#[app(..)]`). This attribute -must be applied to a `mod`-item. The `app` attribute has -a mandatory `device` argument that takes a *path* as a value. This path must -point to a *peripheral access crate* (PAC) generated using [`svd2rust`] -**v0.14.x** or newer. The `app` attribute will expand into a suitable entry -point so it's not required to use the [`cortex_m_rt::entry`] attribute. +must be applied to a `mod`-item. The `app` attribute has a mandatory `device` +argument that takes a *path* as a value. This must be a full path pointing to a +*peripheral access crate* (PAC) generated using [`svd2rust`] **v0.14.x** or +newer. More details can be found in the [Starting a new project](./new.md) +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 [`svd2rust`]: https://crates.io/crates/svd2rust diff --git a/book/en/src/by-example/new.md b/book/en/src/by-example/new.md index 866a9fa5..82681bf4 100644 --- a/book/en/src/by-example/new.md +++ b/book/en/src/by-example/new.md @@ -52,7 +52,23 @@ $ curl \ > 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 $ cargo add panic-semihosting |