mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-12-26 03:49:34 +01:00
parent
4d61437bb4
commit
baa2edfe72
5 changed files with 32 additions and 16 deletions
|
@ -55,7 +55,8 @@ process.
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo run --example init
|
$ cargo run --example init
|
||||||
{{#include ../../../../ci/expected/init.run}}```
|
{{#include ../../../../ci/expected/init.run}}
|
||||||
|
```
|
||||||
|
|
||||||
## `idle`
|
## `idle`
|
||||||
|
|
||||||
|
@ -86,7 +87,8 @@ in LLVM which miss-optimizes empty loops to a `UDF` instruction in release mode.
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo run --example idle
|
$ cargo run --example idle
|
||||||
{{#include ../../../../ci/expected/idle.run}}```
|
{{#include ../../../../ci/expected/idle.run}}
|
||||||
|
```
|
||||||
|
|
||||||
## Hardware tasks
|
## Hardware tasks
|
||||||
|
|
||||||
|
@ -107,7 +109,8 @@ mut` variables are safe to use within a hardware task.
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo run --example hardware
|
$ 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
|
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
|
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
|
``` console
|
||||||
$ cargo run --example preempt
|
$ 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
|
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
|
is the *same* as `gpioc`'s. However, once `gpioc` terminates the execution of
|
||||||
|
|
|
@ -63,4 +63,5 @@ $ cargo add panic-semihosting
|
||||||
``` console
|
``` console
|
||||||
$ # NOTE: I have uncommented the `runner` option in `.cargo/config`
|
$ # NOTE: I have uncommented the `runner` option in `.cargo/config`
|
||||||
$ cargo run
|
$ cargo run
|
||||||
{{#include ../../../../ci/expected/init.run}}```
|
{{#include ../../../../ci/expected/init.run}}
|
||||||
|
```
|
||||||
|
|
|
@ -29,7 +29,8 @@ access to a resource named `shared`.
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo run --example resource
|
$ 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
|
Note that the `shared` resource cannot be accessed from `idle`. Attempting to do
|
||||||
so results in a compile error.
|
so results in a compile error.
|
||||||
|
@ -71,7 +72,8 @@ lowest priority handler.
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo run --example lock
|
$ cargo run --example lock
|
||||||
{{#include ../../../../ci/expected/lock.run}}```
|
{{#include ../../../../ci/expected/lock.run}}
|
||||||
|
```
|
||||||
|
|
||||||
## Late resources
|
## Late resources
|
||||||
|
|
||||||
|
@ -97,7 +99,8 @@ the consumer resource.
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo run --example late
|
$ cargo run --example late
|
||||||
{{#include ../../../../ci/expected/late.run}}```
|
{{#include ../../../../ci/expected/late.run}}
|
||||||
|
```
|
||||||
|
|
||||||
## Only shared access
|
## Only shared access
|
||||||
|
|
||||||
|
@ -127,4 +130,5 @@ any kind of lock.
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo run --example only-shared-access
|
$ 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
|
``` console
|
||||||
$ cargo run --example task
|
$ cargo run --example task
|
||||||
{{#include ../../../../ci/expected/task.run}}```
|
{{#include ../../../../ci/expected/task.run}}
|
||||||
|
```
|
||||||
|
|
||||||
## Message passing
|
## Message passing
|
||||||
|
|
||||||
|
@ -41,7 +42,8 @@ The example below showcases three tasks, two of them expect a message.
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo run --example message
|
$ cargo run --example message
|
||||||
{{#include ../../../../ci/expected/message.run}}```
|
{{#include ../../../../ci/expected/message.run}}
|
||||||
|
```
|
||||||
|
|
||||||
## Capacity
|
## Capacity
|
||||||
|
|
||||||
|
@ -63,7 +65,8 @@ fail (panic).
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo run --example capacity
|
$ cargo run --example capacity
|
||||||
{{#include ../../../../ci/expected/capacity.run}}```
|
{{#include ../../../../ci/expected/capacity.run}}
|
||||||
|
```
|
||||||
|
|
||||||
## Error handling
|
## Error handling
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,8 @@ Here's one such example:
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo run --example generics
|
$ 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
|
Using generics also lets you change the static priorities of tasks during
|
||||||
development without having to rewrite a bunch code every time.
|
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 --release
|
||||||
|
|
||||||
$ cargo run --example cfg
|
$ cargo run --example cfg
|
||||||
{{#include ../../../../ci/expected/cfg.run}}```
|
{{#include ../../../../ci/expected/cfg.run}}
|
||||||
|
```
|
||||||
|
|
||||||
## Running tasks from RAM
|
## Running tasks from RAM
|
||||||
|
|
||||||
|
@ -78,7 +80,8 @@ Running this program produces the expected output.
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo run --example ramfunc
|
$ 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
|
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`).
|
(`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
|
``` console
|
||||||
$ cargo run --example pool
|
$ cargo run --example pool
|
||||||
{{#include ../../../../ci/expected/pool.run}}```
|
{{#include ../../../../ci/expected/pool.run}}
|
||||||
|
```
|
||||||
|
|
||||||
## Inspecting the expanded code
|
## Inspecting the expanded code
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue