mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-12-25 19:39:32 +01:00
parent
4d61437bb4
commit
baa2edfe72
5 changed files with 32 additions and 16 deletions
|
@ -55,7 +55,8 @@ process.
|
|||
|
||||
``` console
|
||||
$ cargo run --example init
|
||||
{{#include ../../../../ci/expected/init.run}}```
|
||||
{{#include ../../../../ci/expected/init.run}}
|
||||
```
|
||||
|
||||
## `idle`
|
||||
|
||||
|
@ -86,7 +87,8 @@ in LLVM which miss-optimizes empty loops to a `UDF` instruction in release mode.
|
|||
|
||||
``` console
|
||||
$ cargo run --example idle
|
||||
{{#include ../../../../ci/expected/idle.run}}```
|
||||
{{#include ../../../../ci/expected/idle.run}}
|
||||
```
|
||||
|
||||
## Hardware tasks
|
||||
|
||||
|
@ -107,7 +109,8 @@ mut` variables are safe to use within a hardware task.
|
|||
|
||||
``` console
|
||||
$ cargo run --example hardware
|
||||
{{#include ../../../../ci/expected/hardware.run}}```
|
||||
{{#include ../../../../ci/expected/hardware.run}}
|
||||
```
|
||||
|
||||
So far all the RTIC applications we have seen look no different than the
|
||||
applications one can write using only the `cortex-m-rt` crate. From this point
|
||||
|
@ -139,7 +142,8 @@ The following example showcases the priority based scheduling of tasks.
|
|||
|
||||
``` console
|
||||
$ cargo run --example preempt
|
||||
{{#include ../../../../ci/expected/preempt.run}}```
|
||||
{{#include ../../../../ci/expected/preempt.run}}
|
||||
```
|
||||
|
||||
Note that the task `gpiob` does *not* preempt task `gpioc` because its priority
|
||||
is the *same* as `gpioc`'s. However, once `gpioc` terminates the execution of
|
||||
|
|
|
@ -63,4 +63,5 @@ $ cargo add panic-semihosting
|
|||
``` console
|
||||
$ # NOTE: I have uncommented the `runner` option in `.cargo/config`
|
||||
$ cargo run
|
||||
{{#include ../../../../ci/expected/init.run}}```
|
||||
{{#include ../../../../ci/expected/init.run}}
|
||||
```
|
||||
|
|
|
@ -29,7 +29,8 @@ access to a resource named `shared`.
|
|||
|
||||
``` console
|
||||
$ cargo run --example resource
|
||||
{{#include ../../../../ci/expected/resource.run}}```
|
||||
{{#include ../../../../ci/expected/resource.run}}
|
||||
```
|
||||
|
||||
Note that the `shared` resource cannot be accessed from `idle`. Attempting to do
|
||||
so results in a compile error.
|
||||
|
@ -71,7 +72,8 @@ lowest priority handler.
|
|||
|
||||
``` console
|
||||
$ cargo run --example lock
|
||||
{{#include ../../../../ci/expected/lock.run}}```
|
||||
{{#include ../../../../ci/expected/lock.run}}
|
||||
```
|
||||
|
||||
## Late resources
|
||||
|
||||
|
@ -97,7 +99,8 @@ the consumer resource.
|
|||
|
||||
``` console
|
||||
$ cargo run --example late
|
||||
{{#include ../../../../ci/expected/late.run}}```
|
||||
{{#include ../../../../ci/expected/late.run}}
|
||||
```
|
||||
|
||||
## Only shared access
|
||||
|
||||
|
@ -127,4 +130,5 @@ any kind of lock.
|
|||
|
||||
``` console
|
||||
$ cargo run --example only-shared-access
|
||||
{{#include ../../../../ci/expected/only-shared-access.run}}```
|
||||
{{#include ../../../../ci/expected/only-shared-access.run}}
|
||||
```
|
||||
|
|
|
@ -25,7 +25,8 @@ priorities. The three software tasks are mapped to 2 interrupts handlers.
|
|||
|
||||
``` console
|
||||
$ cargo run --example task
|
||||
{{#include ../../../../ci/expected/task.run}}```
|
||||
{{#include ../../../../ci/expected/task.run}}
|
||||
```
|
||||
|
||||
## Message passing
|
||||
|
||||
|
@ -41,7 +42,8 @@ The example below showcases three tasks, two of them expect a message.
|
|||
|
||||
``` console
|
||||
$ cargo run --example message
|
||||
{{#include ../../../../ci/expected/message.run}}```
|
||||
{{#include ../../../../ci/expected/message.run}}
|
||||
```
|
||||
|
||||
## Capacity
|
||||
|
||||
|
@ -63,7 +65,8 @@ fail (panic).
|
|||
|
||||
``` console
|
||||
$ cargo run --example capacity
|
||||
{{#include ../../../../ci/expected/capacity.run}}```
|
||||
{{#include ../../../../ci/expected/capacity.run}}
|
||||
```
|
||||
|
||||
## Error handling
|
||||
|
||||
|
|
|
@ -24,7 +24,8 @@ Here's one such example:
|
|||
|
||||
``` console
|
||||
$ cargo run --example generics
|
||||
{{#include ../../../../ci/expected/generics.run}}```
|
||||
{{#include ../../../../ci/expected/generics.run}}
|
||||
```
|
||||
|
||||
Using generics also lets you change the static priorities of tasks during
|
||||
development without having to rewrite a bunch code every time.
|
||||
|
@ -47,7 +48,8 @@ the program has been compiled using the `dev` profile.
|
|||
$ cargo run --example cfg --release
|
||||
|
||||
$ cargo run --example cfg
|
||||
{{#include ../../../../ci/expected/cfg.run}}```
|
||||
{{#include ../../../../ci/expected/cfg.run}}
|
||||
```
|
||||
|
||||
## Running tasks from RAM
|
||||
|
||||
|
@ -78,7 +80,8 @@ Running this program produces the expected output.
|
|||
|
||||
``` console
|
||||
$ cargo run --example ramfunc
|
||||
{{#include ../../../../ci/expected/ramfunc.run}}```
|
||||
{{#include ../../../../ci/expected/ramfunc.run}}
|
||||
```
|
||||
|
||||
One can look at the output of `cargo-nm` to confirm that `bar` ended in RAM
|
||||
(`0x2000_0000`), whereas `foo` ended in Flash (`0x0000_0000`).
|
||||
|
@ -115,7 +118,8 @@ Here's an example where `heapless::Pool` is used to "box" buffers of 128 bytes.
|
|||
```
|
||||
``` console
|
||||
$ cargo run --example pool
|
||||
{{#include ../../../../ci/expected/pool.run}}```
|
||||
{{#include ../../../../ci/expected/pool.run}}
|
||||
```
|
||||
|
||||
## Inspecting the expanded code
|
||||
|
||||
|
|
Loading…
Reference in a new issue