Skip to content
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

Docs 2 #741

Merged
merged 31 commits into from
May 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
16f8ea9
Fix this link
datdenkikniet Apr 22, 2023
1dc2f80
Begin migration guide
datdenkikniet Apr 22, 2023
d90fa95
Add some more
datdenkikniet Apr 22, 2023
6c91ff2
Include the examples
datdenkikniet Apr 22, 2023
825b2c2
Update tips on Monotonic implemenations
datdenkikniet Apr 22, 2023
4437f12
Remove link to inactive `embedded_time`
datdenkikniet Apr 22, 2023
9ddae20
Fix links & info
datdenkikniet Apr 22, 2023
d22faec
Fix run-on sentence
datdenkikniet Apr 22, 2023
ed465b0
Fix #699
datdenkikniet Apr 22, 2023
3d97c9e
Move deprecated migration guides to deprecated folder
datdenkikniet Apr 22, 2023
3d98102
Refer to rtic-rs/rtic/examples instead
datdenkikniet Apr 22, 2023
a14d240
Update delay.md file to be a bit easier to read, and add spoiler tags…
datdenkikniet Apr 22, 2023
552ecd4
Promote starting a new project to it's own chapter
datdenkikniet Apr 22, 2023
a76f4cd
monotonic.md is now deprecated
datdenkikniet Apr 22, 2023
6c2c1ab
Clarify delay and timeout uses monotonics
datdenkikniet Apr 22, 2023
cb0ceea
Remove v1 reference here
datdenkikniet Apr 23, 2023
e51146a
Move tips into their own subdir
datdenkikniet Apr 23, 2023
0807aa5
Include this code as blocks instead
datdenkikniet Apr 23, 2023
a66540e
Disable the playground on all of these
datdenkikniet Apr 23, 2023
d41d28b
Add check-book.sh script
datdenkikniet May 5, 2023
0b8ea07
Fix links
datdenkikniet May 5, 2023
e3603d1
Rename deprecated to archive
datdenkikniet May 5, 2023
f2a57de
taste the rainbow!
datdenkikniet May 5, 2023
5b705dd
Don't build core and alloc & update Cargo.lock
datdenkikniet May 5, 2023
03b16a3
Archive app_task.md
datdenkikniet May 5, 2023
5c6483f
Update these
datdenkikniet May 5, 2023
ab17bbf
Demarcate a bit more
datdenkikniet May 5, 2023
4b3bf59
Move some more stuff to the archive, update this link
datdenkikniet May 20, 2023
039c2b8
Add some docs on RTIC AND embassy
datdenkikniet May 20, 2023
311291b
Make Monotonic implementation more obvious
datdenkikniet May 20, 2023
9fa073f
Fix link
datdenkikniet May 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
/target
Cargo.lock
*.hex
book-target/
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ This activates the monotonics making it possible to use them.

See the following example:

``` rust
``` rust,noplayground
{{#include ../../../../examples/schedule.rs}}
```

Expand All @@ -54,7 +54,7 @@ which allows canceling or rescheduling of the task scheduled to run in the futur
If `cancel` or `reschedule_at`/`reschedule_after` returns an `Err` it means that the operation was
too late and that the task is already sent for execution. The following example shows this in action:

``` rust
``` rust,noplayground
{{#include ../../../../examples/cancel-reschedule.rs}}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ improve performance in some cases.

The example below shows how to place the higher priority task, `bar`, in RAM.

``` rust
{{#include ../../../../rtic/examples/ramfunc.rs}}
``` rust,noplayground
{{#include ../../../../../rtic/examples/ramfunc.rs}}
```

Running this program produces the expected output.
Expand All @@ -22,7 +22,7 @@ $ cargo run --target thumbv7m-none-eabi --example ramfunc
```

``` console
{{#include ../../../../rtic/ci/expected/ramfunc.run}}
{{#include ../../../../../rtic/ci/expected/ramfunc.run}}
```

One can look at the output of `cargo-nm` to confirm that `bar` ended in RAM
Expand All @@ -33,13 +33,13 @@ $ cargo nm --example ramfunc --release | grep ' foo::'
```

``` console
{{#include ../../../../rtic/ci/expected/ramfunc.run.grep.foo}}
{{#include ../../../../../rtic/ci/expected/ramfunc.run.grep.foo}}
```

``` console
$ cargo nm --example ramfunc --target thumbv7m-none-eabi --release | grep '*bar::'
```

``` console
{{#include ../../../../rtic/ci/expected/ramfunc.run.grep.bar}}
{{#include ../../../../../rtic/ci/expected/ramfunc.run.grep.bar}}
```
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ cortex-m-rtic = "0.5.3"
The only code change that needs to be made is that any reference to `rtfm` before now need to point
to `rtic` as follows:

``` rust
``` rust,noplayground
//
// Change this
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ framework: `resources`, `spawn`, `schedule` -- these variables will become
fields of the `Context` structure. Each function within the `#[rtfm::app]` item
gets a different `Context` type.

``` rust
``` rust,noplayground
#[rtfm::app(/* .. */)]
const APP: () = {
// change this
Expand Down Expand Up @@ -90,7 +90,7 @@ const APP: () = {
The syntax used to declare resources has changed from `static mut`
variables to a `struct Resources`.

``` rust
``` rust,noplayground
#[rtfm::app(/* .. */)]
const APP: () = {
// change this
Expand Down Expand Up @@ -118,7 +118,7 @@ the `device` field of the `init::Context` structure.

Change this:

``` rust
``` rust,noplayground
#[rtfm::app(/* .. */)]
const APP: () = {
#[init]
Expand All @@ -132,7 +132,7 @@ const APP: () = {

Into this:

``` rust
``` rust,noplayground
#[rtfm::app(/* .. */, peripherals = true)]
// ^^^^^^^^^^^^^^^^^^
const APP: () = {
Expand All @@ -155,7 +155,7 @@ attribute with the `binds` argument instead.

Change this:

``` rust
``` rust,noplayground
#[rtfm::app(/* .. */)]
const APP: () = {
// hardware tasks
Expand All @@ -175,7 +175,7 @@ const APP: () = {

Into this:

``` rust
``` rust,noplayground
#[rtfm::app(/* .. */)]
const APP: () = {
#[task(binds = SVCall)]
Expand Down Expand Up @@ -212,7 +212,7 @@ ensure it is enabled by the application inside `init`.

Change this:

``` rust
``` rust,noplayground
use rtfm::{Duration, Instant, U32Ext};

#[rtfm::app(/* .. */)]
Expand All @@ -226,7 +226,7 @@ const APP: () = {

Into this:

``` rust
``` rust,noplayground
use rtfm::cyccnt::{Duration, Instant, U32Ext};
// ^^^^^^^^

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ With the support of attributes on modules the `const APP` workaround is not need

Change

``` rust
``` rust,noplayground
#[rtic::app(/* .. */)]
const APP: () = {
[code here]
Expand All @@ -21,7 +21,7 @@ const APP: () = {

into

``` rust
``` rust,noplayground
#[rtic::app(/* .. */)]
mod app {
[code here]
Expand Down Expand Up @@ -75,7 +75,7 @@ mod app {

Change

``` rust
``` rust,noplayground
#[rtic::app(/* .. */)]
const APP: () = {
[code here]
Expand All @@ -92,7 +92,7 @@ const APP: () = {

into

``` rust
``` rust,noplayground
#[rtic::app(/* .. */, dispatchers = [SSI0, QEI0])]
mod app {
[code here]
Expand All @@ -106,7 +106,7 @@ This works also for ram functions, see examples/ramfunc.rs

Previously the RTIC resources had to be in in a struct named exactly "Resources":

``` rust
``` rust,noplayground
struct Resources {
// Resources defined in here
}
Expand All @@ -115,7 +115,7 @@ struct Resources {
With RTIC v1.0.0 the resources structs are annotated similarly like
`#[task]`, `#[init]`, `#[idle]`: with the attributes `#[shared]` and `#[local]`

``` rust
``` rust,noplayground
#[shared]
struct MySharedResources {
// Resources shared between tasks are defined here
Expand All @@ -136,7 +136,7 @@ In v1.0.0 resources are split between `shared` resources and `local` resources.

In v0.5.x:

``` rust
``` rust,noplayground
struct Resources {
local_to_b: i64,
shared_by_a_and_b: i64,
Expand All @@ -151,7 +151,7 @@ fn b(_: b::Context) {}

In v1.0.0:

``` rust
``` rust,noplayground
#[shared]
struct Shared {
shared_by_a_and_b: i64,
Expand All @@ -176,7 +176,7 @@ to be used for all `shared` resource access.
In old code one could do the following as the high priority
task has exclusive access to the resource:

``` rust
``` rust,noplayground
#[task(priority = 2, resources = [r])]
fn foo(cx: foo::Context) {
cx.resources.r = /* ... */;
Expand All @@ -190,7 +190,7 @@ fn bar(cx: bar::Context) {

And with symmetric locks one needs to use locks in both tasks:

``` rust
``` rust,noplayground
#[task(priority = 2, shared = [r])]
fn foo(cx: foo::Context) {
cx.shared.r.lock(|r| r = /* ... */);
Expand All @@ -211,7 +211,7 @@ This is still possible in 1.0: the `#[shared]` resource must be annotated with t

v0.5 code:

``` rust
``` rust,noplayground
struct Resources {
counter: u64,
}
Expand All @@ -229,7 +229,7 @@ fn b(cx: b::Context) {

v1.0 code:

``` rust
``` rust,noplayground
#[shared]
struct Shared {
#[lock_free]
Expand All @@ -254,7 +254,7 @@ Instead of that syntax, use the `local` argument in `#[init]`.

v0.5.x code:

``` rust
``` rust,noplayground
#[init]
fn init(_: init::Context) {
static mut BUFFER: [u8; 1024] = [0; 1024];
Expand All @@ -264,7 +264,7 @@ fn init(_: init::Context) {

v1.0.0 code:

``` rust
``` rust,noplayground
#[init(local = [
buffer: [u8; 1024] = [0; 1024]
// type ^^^^^^^^^^^^ ^^^^^^^^^ initial value
Expand All @@ -282,7 +282,7 @@ In order to make the API more symmetric the #[init]-task always returns a late r

From this:

``` rust
``` rust,noplayground
#[rtic::app(device = lm3s6965)]
const APP: () = {
#[init]
Expand All @@ -296,7 +296,7 @@ const APP: () = {

to this:

``` rust
``` rust,noplayground
#[rtic::app(device = lm3s6965)]
mod app {
#[shared]
Expand All @@ -321,7 +321,7 @@ mod app {
With the new spawn/spawn_after/spawn_at interface,
old code requiring the context `cx` for spawning such as:

``` rust
``` rust,noplayground
#[task(spawn = [bar])]
fn foo(cx: foo::Context) {
cx.spawn.bar().unwrap();
Expand All @@ -335,7 +335,7 @@ fn bar(cx: bar::Context) {

Will now be written as:

``` rust
``` rust,noplayground
#[task]
fn foo(_c: foo::Context) {
bar::spawn().unwrap();
Expand Down
39 changes: 24 additions & 15 deletions book/en/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,40 @@

[Preface](./preface.md)

---

- [Starting a new project](./starting_a_project.md)
- [RTIC by example](./by-example.md)
- [The `app`](./by-example/app.md)
- [Hardware tasks & `pend`](./by-example/hardware_tasks.md)
- [Hardware tasks](./by-example/hardware_tasks.md)
- [Software tasks & `spawn`](./by-example/software_tasks.md)
- [Resources](./by-example/resources.md)
- [The init task](./by-example/app_init.md)
- [The idle task](./by-example/app_idle.md)
- [Channel based communication](./by-example/channel.md)
- [Delay and Timeout](./by-example/delay.md)
- [Starting a new project](./by-example/starting_a_project.md)
- [Delay and Timeout using Monotonics](./by-example/delay.md)
- [The minimal app](./by-example/app_minimal.md)
- [Tips & Tricks](./by-example/tips.md)
- [Implementing Monotonic](./by-example/tips_monotonic_impl.md)
- [Resource de-structure-ing](./by-example/tips_destructureing.md)
- [Avoid copies when message passing](./by-example/tips_indirection.md)
- [`'static` super-powers](./by-example/tips_static_lifetimes.md)
- [Inspecting generated code](./by-example/tips_view_code.md)
<!-- - [Running tasks from RAM](./by-example/tips_from_ram.md) -->
<!-- - [`#[cfg(..)]` support](./by-example/tips.md) -->
- [Tips & Tricks](./by-example/tips/index.md)
- [Resource de-structure-ing](./by-example/tips/destructureing.md)
- [Avoid copies when message passing](./by-example/tips/indirection.md)
- [`'static` super-powers](./by-example/tips/static_lifetimes.md)
- [Inspecting generated code](./by-example/tips/view_code.md)
- [Monotonics & the Timer Queue](./monotonic_impl.md)
- [RTIC vs. the world](./rtic_vs.md)
- [RTIC and Embassy](./rtic_and_embassy.md)
- [Awesome RTIC examples](./awesome_rtic.md)
<!-- - [Migration Guides](./migration.md)
- [v0.5.x to v1.0.x](./migration/migration_v5.md)
- [v0.4.x to v0.5.x](./migration/migration_v4.md)
- [RTFM to RTIC](./migration/migration_rtic.md) -->

---

- [Migrating from v1.0.x to v2.0.0](./migration_v1_v2.md)
- [Rust Nightly & features](./migration_v1_v2/nightly.md)
- [Migrating to `rtic-monotonics`](./migration_v1_v2/monotonics.md)
- [Software tasks must now be `async`](./migration_v1_v2/async_tasks.md)
- [Using and understanding `rtic-sync`](./migration_v1_v2/rtic-sync.md)
- [A code example on migration](./migration_v1_v2/complete_example.md)

---

- [Under the hood](./internals.md)
- [Cortex-M architectures](./internals/targets.md)
<!--- [Interrupt configuration](./internals/interrupt-configuration.md)-->
Expand Down
7 changes: 3 additions & 4 deletions book/en/src/awesome_rtic.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Awesome RTIC examples

See the [`rtic-rs/rtic-examples`][rticexamples] repository for community
provided complete examples.
See the [`rtic-rs/rtic/examples`][rticexamples] repository for complete examples.

Pull-requests to this repo are welcome!
Pull-requests are welcome!

[rticexamples]: https://github.com/rtic-rs/rtic-examples
[rticexamples]: https://github.com/rtic-rs/rtic/tree/master/examples
Loading