rtic/book/en/src/by-example/app.md

27 lines
987 B
Markdown
Raw Normal View History

2021-09-22 13:22:45 +02:00
# The `#[app]` attribute and an RTIC application
2018-11-03 17:02:41 +01:00
2021-09-22 13:22:45 +02:00
## Requirements on the `app` attribute
2018-11-03 17:02:41 +01:00
All RTIC applications use the [`app`] attribute (`#[app(..)]`). This attribute
2021-12-14 22:46:15 +01:00
only applies to a `mod`-item containing the RTIC application. 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
2021-09-22 13:22:45 +02:00
newer.
2021-12-14 22:46:15 +01:00
The `app` attribute will expand into a suitable entry point and thus replaces
the use of the [`cortex_m_rt::entry`] attribute.
[`app`]: ../../../api/cortex_m_rtic_macros/attr.app.html
[`svd2rust`]: https://crates.io/crates/svd2rust
[`cortex_m_rt::entry`]: ../../../api/cortex_m_rt_macros/attr.entry.html
2021-09-22 13:22:45 +02:00
## An RTIC application example
2018-11-03 17:02:41 +01:00
2021-12-14 22:46:15 +01:00
To give a flavour of RTIC, the following example contains commonly used features.
In the following sections we will go through each feature in detail.
2018-11-03 17:02:41 +01:00
``` rust
2021-09-22 13:22:45 +02:00
{{#include ../../../../examples/common.rs}}
2018-11-03 17:02:41 +01:00
```