mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-25 21:19:35 +01:00
change layout of books
This commit is contained in:
parent
68a937a72a
commit
0007a35a27
36 changed files with 95 additions and 92 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,7 +1,6 @@
|
||||||
**/*.rs.bk
|
**/*.rs.bk
|
||||||
.#*
|
.#*
|
||||||
.gdb_history
|
.gdb_history
|
||||||
/book/book
|
/book/*/book
|
||||||
/ru/book
|
|
||||||
/target
|
/target
|
||||||
Cargo.lock
|
Cargo.lock
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
This is the smallest possible RTFM application:
|
This is the smallest possible RTFM application:
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/smallest.rs}}
|
{{#include ../../../../examples/smallest.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
All RTFM applications use the [`app`] attribute (`#[app(..)]`). This attribute
|
All RTFM applications use the [`app`] attribute (`#[app(..)]`). This attribute
|
||||||
|
@ -47,7 +47,7 @@ The example below shows the types of the `core` and `device` variables and
|
||||||
showcases safe access to a `static mut` variable.
|
showcases safe access to a `static mut` variable.
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/init.rs}}
|
{{#include ../../../../examples/init.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
Running the example will print `init` to the console and then exit the QEMU
|
Running the example will print `init` to the console and then exit the QEMU
|
||||||
|
@ -55,7 +55,7 @@ process.
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo run --example init
|
$ cargo run --example init
|
||||||
{{#include ../../../ci/expected/init.run}}```
|
{{#include ../../../../ci/expected/init.run}}```
|
||||||
|
|
||||||
## `idle`
|
## `idle`
|
||||||
|
|
||||||
|
@ -78,12 +78,12 @@ references that are safe to access.
|
||||||
The example below shows that `idle` runs after `init`.
|
The example below shows that `idle` runs after `init`.
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/idle.rs}}
|
{{#include ../../../../examples/idle.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo run --example idle
|
$ cargo run --example idle
|
||||||
{{#include ../../../ci/expected/idle.run}}```
|
{{#include ../../../../ci/expected/idle.run}}```
|
||||||
|
|
||||||
## `interrupt` / `exception`
|
## `interrupt` / `exception`
|
||||||
|
|
||||||
|
@ -93,12 +93,12 @@ and exception handlers. In RTFM, we refer to interrupt and exception handlers as
|
||||||
*hardware* tasks.
|
*hardware* tasks.
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/interrupt.rs}}
|
{{#include ../../../../examples/interrupt.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo run --example interrupt
|
$ cargo run --example interrupt
|
||||||
{{#include ../../../ci/expected/interrupt.run}}```
|
{{#include ../../../../ci/expected/interrupt.run}}```
|
||||||
|
|
||||||
So far all the RTFM applications we have seen look no different that the
|
So far all the RTFM applications we have seen look no different that the
|
||||||
applications one can write using only the `cortex-m-rt` crate. In the next
|
applications one can write using only the `cortex-m-rt` crate. In the next
|
|
@ -64,4 +64,4 @@ $ 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}}```
|
|
@ -19,12 +19,12 @@ no preemption is possible. The `SHARED` resource can only be accessed by these
|
||||||
two handlers.
|
two handlers.
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/resource.rs}}
|
{{#include ../../../../examples/resource.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo run --example resource
|
$ cargo run --example resource
|
||||||
{{#include ../../../ci/expected/resource.run}}```
|
{{#include ../../../../ci/expected/resource.run}}```
|
||||||
|
|
||||||
## Priorities
|
## Priorities
|
||||||
|
|
||||||
|
@ -62,12 +62,12 @@ the critical section created by the lowest priority handler.
|
||||||
[`lock`]: ../../api/rtfm/trait.Mutex.html#method.lock
|
[`lock`]: ../../api/rtfm/trait.Mutex.html#method.lock
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/lock.rs}}
|
{{#include ../../../../examples/lock.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo run --example lock
|
$ cargo run --example lock
|
||||||
{{#include ../../../ci/expected/lock.run}}```
|
{{#include ../../../../ci/expected/lock.run}}```
|
||||||
|
|
||||||
## Late resources
|
## Late resources
|
||||||
|
|
||||||
|
@ -91,12 +91,12 @@ the consumer resource.
|
||||||
[`Queue`]: ../../api/heapless/spsc/struct.Queue.html
|
[`Queue`]: ../../api/heapless/spsc/struct.Queue.html
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/late.rs}}
|
{{#include ../../../../examples/late.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo run --example late
|
$ cargo run --example late
|
||||||
{{#include ../../../ci/expected/late.run}}```
|
{{#include ../../../../ci/expected/late.run}}```
|
||||||
|
|
||||||
## `static` resources
|
## `static` resources
|
||||||
|
|
||||||
|
@ -111,9 +111,9 @@ In the example below a key is loaded (or created) at runtime and then used from
|
||||||
two tasks that run at different priorities.
|
two tasks that run at different priorities.
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/static.rs}}
|
{{#include ../../../../examples/static.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo run --example static
|
$ cargo run --example static
|
||||||
{{#include ../../../ci/expected/static.run}}```
|
{{#include ../../../../ci/expected/static.run}}```
|
|
@ -18,9 +18,9 @@ the [`alloc-singleton`] abstractions.
|
||||||
[`alloc-singleton`]: https://crates.io/crates/alloc-singleton
|
[`alloc-singleton`]: https://crates.io/crates/alloc-singleton
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/singleton.rs}}
|
{{#include ../../../../examples/singleton.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo run --example singleton
|
$ cargo run --example singleton
|
||||||
{{#include ../../../ci/expected/singleton.run}}```
|
{{#include ../../../../ci/expected/singleton.run}}```
|
|
@ -19,12 +19,12 @@ The example below showcases three software tasks that run at 2 different
|
||||||
priorities. The three tasks map to 2 interrupts handlers.
|
priorities. The three tasks map to 2 interrupts handlers.
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/task.rs}}
|
{{#include ../../../../examples/task.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo run --example task
|
$ cargo run --example task
|
||||||
{{#include ../../../ci/expected/task.run}}```
|
{{#include ../../../../ci/expected/task.run}}```
|
||||||
|
|
||||||
## Message passing
|
## Message passing
|
||||||
|
|
||||||
|
@ -35,12 +35,12 @@ the signature of the task handler.
|
||||||
The example below showcases three tasks, two of them expect a message.
|
The example below showcases three tasks, two of them expect a message.
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/message.rs}}
|
{{#include ../../../../examples/message.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo run --example message
|
$ cargo run --example message
|
||||||
{{#include ../../../ci/expected/message.run}}```
|
{{#include ../../../../ci/expected/message.run}}```
|
||||||
|
|
||||||
## Capacity
|
## Capacity
|
||||||
|
|
||||||
|
@ -55,9 +55,9 @@ capacity is not specified then the second `spawn.foo` call in `UART0` would
|
||||||
fail.
|
fail.
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/capacity.rs}}
|
{{#include ../../../../examples/capacity.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo run --example capacity
|
$ cargo run --example capacity
|
||||||
{{#include ../../../ci/expected/capacity.run}}```
|
{{#include ../../../../ci/expected/capacity.run}}```
|
|
@ -38,13 +38,13 @@ was scheduled to run first.
|
||||||
> counter functionality has not been implemented in `qemu-system-arm`.
|
> counter functionality has not been implemented in `qemu-system-arm`.
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/schedule.rs}}
|
{{#include ../../../../examples/schedule.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
Running the program on real hardware produces the following output in the console:
|
Running the program on real hardware produces the following output in the console:
|
||||||
|
|
||||||
``` text
|
``` text
|
||||||
{{#include ../../../ci/expected/schedule.run}}
|
{{#include ../../../../ci/expected/schedule.run}}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Periodic tasks
|
## Periodic tasks
|
||||||
|
@ -54,7 +54,7 @@ through the `scheduled` variable. This information and the `schedule` API can be
|
||||||
used to implement periodic tasks as shown in the example below.
|
used to implement periodic tasks as shown in the example below.
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/periodic.rs}}
|
{{#include ../../../../examples/periodic.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
This is the output produced by the example. Note that there is zero drift /
|
This is the output produced by the example. Note that there is zero drift /
|
||||||
|
@ -62,7 +62,7 @@ jitter even though `schedule.foo` was invoked at the *end* of `foo`. Using
|
||||||
`Instant::now` instead of `scheduled` would have resulted in drift / jitter.
|
`Instant::now` instead of `scheduled` would have resulted in drift / jitter.
|
||||||
|
|
||||||
``` text
|
``` text
|
||||||
{{#include ../../../ci/expected/periodic.run}}
|
{{#include ../../../../ci/expected/periodic.run}}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Baseline
|
## Baseline
|
||||||
|
@ -87,11 +87,11 @@ spawned from it will use `Instant::now()` as their baseline time.
|
||||||
The example below showcases the different meanings of the *baseline*.
|
The example below showcases the different meanings of the *baseline*.
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/baseline.rs}}
|
{{#include ../../../../examples/baseline.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
Running the program on real hardware produces the following output in the console:
|
Running the program on real hardware produces the following output in the console:
|
||||||
|
|
||||||
``` text
|
``` text
|
||||||
{{#include ../../../ci/expected/baseline.run}}
|
{{#include ../../../../ci/expected/baseline.run}}
|
||||||
```
|
```
|
|
@ -8,12 +8,12 @@ data. This lets you easily write generic code that operates on resources and can
|
||||||
be called from different tasks. Here's one such example:
|
be called from different tasks. Here's one such example:
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/generics.rs}}
|
{{#include ../../../../examples/generics.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo run --example generics
|
$ cargo run --example generics
|
||||||
{{#include ../../../ci/expected/generics.run}}```
|
{{#include ../../../../ci/expected/generics.run}}```
|
||||||
|
|
||||||
This also lets you change the static priorities of tasks without having to
|
This also lets you change the static priorities of tasks without having to
|
||||||
rewrite code. If you consistently use `lock`s to access the data behind shared
|
rewrite code. If you consistently use `lock`s to access the data behind shared
|
||||||
|
@ -31,7 +31,7 @@ The example below logs a message whenever the `foo` task is spawned, but only if
|
||||||
the program has been compiled using the `dev` profile.
|
the program has been compiled using the `dev` profile.
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/cfg.rs}}
|
{{#include ../../../../examples/cfg.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Running tasks from RAM
|
## Running tasks from RAM
|
||||||
|
@ -56,22 +56,22 @@ improve performance in some cases.
|
||||||
The example below shows how to place the higher priority task, `bar`, in RAM.
|
The example below shows how to place the higher priority task, `bar`, in RAM.
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/ramfunc.rs}}
|
{{#include ../../../../examples/ramfunc.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
Running this program produces the expected output.
|
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`).
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo nm --example ramfunc --release | grep ' foo::'
|
$ cargo nm --example ramfunc --release | grep ' foo::'
|
||||||
{{#include ../../../ci/expected/ramfunc.grep.foo}}```
|
{{#include ../../../../ci/expected/ramfunc.grep.foo}}```
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo nm --example ramfunc --release | grep ' bar::'
|
$ cargo nm --example ramfunc --release | grep ' bar::'
|
||||||
{{#include ../../../ci/expected/ramfunc.grep.bar}}```
|
{{#include ../../../../ci/expected/ramfunc.grep.bar}}```
|
|
@ -13,7 +13,7 @@ function.
|
||||||
The example below shows the different types generates by the `app` attribute.
|
The example below shows the different types generates by the `app` attribute.
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/types.rs}}
|
{{#include ../../../../examples/types.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
## `Send`
|
## `Send`
|
||||||
|
@ -36,7 +36,7 @@ shared `static mut` resources.
|
||||||
The example below shows where a type that doesn't implement `Send` can be used.
|
The example below shows where a type that doesn't implement `Send` can be used.
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/not-send.rs}}
|
{{#include ../../../../examples/not-send.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
## `Sync`
|
## `Sync`
|
||||||
|
@ -56,5 +56,5 @@ resources shared between tasks that run at the *same* priority.
|
||||||
The example below shows where a type that doesn't implement `Sync` can be used.
|
The example below shows where a type that doesn't implement `Sync` can be used.
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/not-sync.rs}}
|
{{#include ../../../../examples/not-sync.rs}}
|
||||||
```
|
```
|
|
@ -9,8 +9,8 @@ This book contains user level documentation for the Real Time For the Masses
|
||||||
|
|
||||||
There is a translation of this book in [Russian].
|
There is a translation of this book in [Russian].
|
||||||
|
|
||||||
[Russian]: ru/index.html
|
[Russian]: ../ru/index.html
|
||||||
|
|
||||||
{{#include ../../README.md:5:46}}
|
{{#include ../../../README.md:5:46}}
|
||||||
|
|
||||||
{{#include ../../README.md:52:}}
|
{{#include ../../../README.md:52:}}
|
|
@ -3,7 +3,7 @@
|
||||||
Это наименьшая возможная программа на RTFM:
|
Это наименьшая возможная программа на RTFM:
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/smallest.rs}}
|
{{#include ../../../../examples/smallest.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
Все программы на RTFM используют атрибут [`app`] (`#[app(..)]`). Этот атрибут
|
Все программы на RTFM используют атрибут [`app`] (`#[app(..)]`). Этот атрибут
|
||||||
|
@ -44,14 +44,14 @@
|
||||||
демонстрирует безопасный доступ к переменной `static mut`.
|
демонстрирует безопасный доступ к переменной `static mut`.
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/init.rs}}
|
{{#include ../../../../examples/init.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
Запуск примера напечатает `init` в консоли и завершит процесс QEMU.
|
Запуск примера напечатает `init` в консоли и завершит процесс QEMU.
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo run --example init
|
$ cargo run --example init
|
||||||
{{#include ../../../ci/expected/init.run}}```
|
{{#include ../../../../ci/expected/init.run}}```
|
||||||
|
|
||||||
## `idle`
|
## `idle`
|
||||||
|
|
||||||
|
@ -74,12 +74,12 @@ $ cargo run --example init
|
||||||
В примере ниже показан запуск `idle` после `init`.
|
В примере ниже показан запуск `idle` после `init`.
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/idle.rs}}
|
{{#include ../../../../examples/idle.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo run --example idle
|
$ cargo run --example idle
|
||||||
{{#include ../../../ci/expected/idle.run}}```
|
{{#include ../../../../ci/expected/idle.run}}```
|
||||||
|
|
||||||
## `interrupt` / `exception`
|
## `interrupt` / `exception`
|
||||||
|
|
||||||
|
@ -89,12 +89,12 @@ $ cargo run --example idle
|
||||||
*аппаратными* задачами.
|
*аппаратными* задачами.
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/interrupt.rs}}
|
{{#include ../../../../examples/interrupt.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo run --example interrupt
|
$ cargo run --example interrupt
|
||||||
{{#include ../../../ci/expected/interrupt.run}}```
|
{{#include ../../../../ci/expected/interrupt.run}}```
|
||||||
|
|
||||||
До сих пор программы RTFM, которые мы видели не отличались от программ, которые
|
До сих пор программы RTFM, которые мы видели не отличались от программ, которые
|
||||||
можно написать, используя только библиотеку `cortex-m-rt`. В следующем разделе
|
можно написать, используя только библиотеку `cortex-m-rt`. В следующем разделе
|
|
@ -64,4 +64,4 @@ $ cargo add panic-semihosting
|
||||||
``` console
|
``` console
|
||||||
$ # ПРИМЕЧАНИЕ: Я раскомментировал опцию `runner` в `.cargo/config`
|
$ # ПРИМЕЧАНИЕ: Я раскомментировал опцию `runner` в `.cargo/config`
|
||||||
$ cargo run
|
$ cargo run
|
||||||
{{#include ../../../ci/expected/init.run}}```
|
{{#include ../../../../ci/expected/init.run}}```
|
|
@ -19,12 +19,12 @@
|
||||||
К ресурсу `SHARED` можно получить доступ только из этих двух прерываний.
|
К ресурсу `SHARED` можно получить доступ только из этих двух прерываний.
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/resource.rs}}
|
{{#include ../../../../examples/resource.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo run --example resource
|
$ cargo run --example resource
|
||||||
{{#include ../../../ci/expected/resource.run}}
|
{{#include ../../../../ci/expected/resource.run}}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Приоритеты
|
## Приоритеты
|
||||||
|
@ -64,12 +64,12 @@ API критической секции, предоставляемое фрей
|
||||||
[`lock`]: ../../api/rtfm/trait.Mutex.html#method.lock
|
[`lock`]: ../../api/rtfm/trait.Mutex.html#method.lock
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/lock.rs}}
|
{{#include ../../../../examples/lock.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo run --example lock
|
$ cargo run --example lock
|
||||||
{{#include ../../../ci/expected/lock.run}}```
|
{{#include ../../../../ci/expected/lock.run}}```
|
||||||
|
|
||||||
## Поздние ресурсы
|
## Поздние ресурсы
|
||||||
|
|
||||||
|
@ -93,12 +93,12 @@ $ cargo run --example lock
|
||||||
[`Queue`]: ../../api/heapless/spsc/struct.Queue.html
|
[`Queue`]: ../../api/heapless/spsc/struct.Queue.html
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/late.rs}}
|
{{#include ../../../../examples/late.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo run --example late
|
$ cargo run --example late
|
||||||
{{#include ../../../ci/expected/late.run}}```
|
{{#include ../../../../ci/expected/late.run}}```
|
||||||
|
|
||||||
## `static`-ресурсы
|
## `static`-ресурсы
|
||||||
|
|
||||||
|
@ -114,9 +114,9 @@ $ cargo run --example late
|
||||||
задачах, запущенных на разных приоритетах.
|
задачах, запущенных на разных приоритетах.
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/static.rs}}
|
{{#include ../../../../examples/static.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo run --example static
|
$ cargo run --example static
|
||||||
{{#include ../../../ci/expected/static.run}}```
|
{{#include ../../../../ci/expected/static.run}}```
|
|
@ -18,9 +18,9 @@
|
||||||
[`alloc-singleton`]: https://crates.io/crates/alloc-singleton
|
[`alloc-singleton`]: https://crates.io/crates/alloc-singleton
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/singleton.rs}}
|
{{#include ../../../../examples/singleton.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo run --example singleton
|
$ cargo run --example singleton
|
||||||
{{#include ../../../ci/expected/singleton.run}}```
|
{{#include ../../../../ci/expected/singleton.run}}```
|
|
@ -19,12 +19,12 @@ RTFM также поддерживает *программные* задачи,
|
||||||
разных приоритетах. Трем задачам назначены 2 обработчика прерываний.
|
разных приоритетах. Трем задачам назначены 2 обработчика прерываний.
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/task.rs}}
|
{{#include ../../../../examples/task.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo run --example task
|
$ cargo run --example task
|
||||||
{{#include ../../../ci/expected/task.run}}```
|
{{#include ../../../../ci/expected/task.run}}```
|
||||||
|
|
||||||
## Передача сообщений
|
## Передача сообщений
|
||||||
|
|
||||||
|
@ -35,12 +35,12 @@ $ cargo run --example task
|
||||||
Пример ниже демонстрирует три задачи, две из которых ожидают сообщения.
|
Пример ниже демонстрирует три задачи, две из которых ожидают сообщения.
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/message.rs}}
|
{{#include ../../../../examples/message.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo run --example message
|
$ cargo run --example message
|
||||||
{{#include ../../../ci/expected/message.run}}```
|
{{#include ../../../../ci/expected/message.run}}```
|
||||||
|
|
||||||
## Ёмкость
|
## Ёмкость
|
||||||
|
|
||||||
|
@ -55,9 +55,9 @@ $ cargo run --example message
|
||||||
не определена, тогда второй вызов `spawn.foo` в `UART0` вызовет ошибку.
|
не определена, тогда второй вызов `spawn.foo` в `UART0` вызовет ошибку.
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/capacity.rs}}
|
{{#include ../../../../examples/capacity.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo run --example capacity
|
$ cargo run --example capacity
|
||||||
{{#include ../../../ci/expected/capacity.run}}```
|
{{#include ../../../../ci/expected/capacity.run}}```
|
|
@ -30,13 +30,13 @@
|
||||||
> тактов Cortex-M не реализована в `qemu-system-arm`.
|
> тактов Cortex-M не реализована в `qemu-system-arm`.
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/schedule.rs}}
|
{{#include ../../../../examples/schedule.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
Запуск программы на реальном оборудовании производит следующий вывод в консоли:
|
Запуск программы на реальном оборудовании производит следующий вывод в консоли:
|
||||||
|
|
||||||
``` text
|
``` text
|
||||||
{{#include ../../../ci/expected/schedule.run}}
|
{{#include ../../../../ci/expected/schedule.run}}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Периодические задачи
|
## Периодические задачи
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
быть использованы для реализации периодических задач, как показано в примере ниже.
|
быть использованы для реализации периодических задач, как показано в примере ниже.
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/periodic.rs}}
|
{{#include ../../../../examples/periodic.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
Это вывод, произведенный примером. Заметьте, что есть смещение / колебание нуля
|
Это вывод, произведенный примером. Заметьте, что есть смещение / колебание нуля
|
||||||
|
@ -54,7 +54,7 @@
|
||||||
`Instant::now` вместо `scheduled` имело бы влияние на смещение / колебание.
|
`Instant::now` вместо `scheduled` имело бы влияние на смещение / колебание.
|
||||||
|
|
||||||
``` text
|
``` text
|
||||||
{{#include ../../../ci/expected/periodic.run}}
|
{{#include ../../../../ci/expected/periodic.run}}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Базовое время
|
## Базовое время
|
||||||
|
@ -80,11 +80,11 @@
|
||||||
Пример ниже демонстрирует разное значение *базового времени*.
|
Пример ниже демонстрирует разное значение *базового времени*.
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/baseline.rs}}
|
{{#include ../../../../examples/baseline.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
Запуск программы на реальном оборудовании произведет следующий вывод в консоли:
|
Запуск программы на реальном оборудовании произведет следующий вывод в консоли:
|
||||||
|
|
||||||
``` text
|
``` text
|
||||||
{{#include ../../../ci/expected/baseline.run}}
|
{{#include ../../../../ci/expected/baseline.run}}
|
||||||
```
|
```
|
|
@ -8,12 +8,12 @@
|
||||||
ресурсами, который можно вызывать из различных задач. Вот такой пример:
|
ресурсами, который можно вызывать из различных задач. Вот такой пример:
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/generics.rs}}
|
{{#include ../../../../examples/generics.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo run --example generics
|
$ cargo run --example generics
|
||||||
{{#include ../../../ci/expected/generics.run}}```
|
{{#include ../../../../ci/expected/generics.run}}```
|
||||||
|
|
||||||
Это также позволяет Вам изменять статические приоритеты задач без
|
Это также позволяет Вам изменять статические приоритеты задач без
|
||||||
переписывания кода. Если Вы единообразно используете `lock`-и для доступа
|
переписывания кода. Если Вы единообразно используете `lock`-и для доступа
|
||||||
|
@ -42,22 +42,22 @@ RTFM v0.4.x была возможность взаимодействия с др
|
||||||
В примере ниже показано как разместить высокоприоритетную задачу `bar` в ОЗУ.
|
В примере ниже показано как разместить высокоприоритетную задачу `bar` в ОЗУ.
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/ramfunc.rs}}
|
{{#include ../../../../examples/ramfunc.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
Запуск этой программы произведет ожидаемый вывод.
|
Запуск этой программы произведет ожидаемый вывод.
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo run --example ramfunc
|
$ cargo run --example ramfunc
|
||||||
{{#include ../../../ci/expected/ramfunc.run}}```
|
{{#include ../../../../ci/expected/ramfunc.run}}```
|
||||||
|
|
||||||
Можно посмотреть на вывод `cargo-nm`, чтобы убедиться, что `bar` расположен в ОЗУ
|
Можно посмотреть на вывод `cargo-nm`, чтобы убедиться, что `bar` расположен в ОЗУ
|
||||||
(`0x2000_0000`), тогда как `foo` расположен во Flash (`0x0000_0000`).
|
(`0x2000_0000`), тогда как `foo` расположен во Flash (`0x0000_0000`).
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo nm --example ramfunc --release | grep ' foo::'
|
$ cargo nm --example ramfunc --release | grep ' foo::'
|
||||||
{{#include ../../../ci/expected/ramfunc.grep.foo}}```
|
{{#include ../../../../ci/expected/ramfunc.grep.foo}}```
|
||||||
|
|
||||||
``` console
|
``` console
|
||||||
$ cargo nm --example ramfunc --release | grep ' bar::'
|
$ cargo nm --example ramfunc --release | grep ' bar::'
|
||||||
{{#include ../../../ci/expected/ramfunc.grep.bar}}```
|
{{#include ../../../../ci/expected/ramfunc.grep.bar}}```
|
|
@ -13,7 +13,7 @@
|
||||||
В примере ниже сгенерированы разные типы с помощью атрибута `app`.
|
В примере ниже сгенерированы разные типы с помощью атрибута `app`.
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/types.rs}}
|
{{#include ../../../../examples/types.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
## `Send`
|
## `Send`
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
В примере ниже показано, где можно использовать типы, не реализующие `Send`.
|
В примере ниже показано, где можно использовать типы, не реализующие `Send`.
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/not-send.rs}}
|
{{#include ../../../../examples/not-send.rs}}
|
||||||
```
|
```
|
||||||
|
|
||||||
## `Sync`
|
## `Sync`
|
||||||
|
@ -55,5 +55,5 @@
|
||||||
В примере ниже показано, где можно использовать типы, не реализующие `Sync`.
|
В примере ниже показано, где можно использовать типы, не реализующие `Sync`.
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
{{#include ../../../examples/not-sync.rs}}
|
{{#include ../../../../examples/not-sync.rs}}
|
||||||
```
|
```
|
|
@ -7,6 +7,6 @@
|
||||||
Эта книга содержит документацию уровня пользователя фреймворком Real Time For the Masses
|
Эта книга содержит документацию уровня пользователя фреймворком Real Time For the Masses
|
||||||
(RTFM). Описание API можно найти [здесь](../api/rtfm/index.html).
|
(RTFM). Описание API можно найти [здесь](../api/rtfm/index.html).
|
||||||
|
|
||||||
{{#include README_RU.md:5:54}}
|
{{#include ../..ADME_RU.md:5:54}}
|
||||||
|
|
||||||
{{#include README_RU.md:60:}}
|
{{#include ../..ADME_RU.md:60:}}
|
14
ci/script.sh
14
ci/script.sh
|
@ -23,15 +23,19 @@ main() {
|
||||||
else
|
else
|
||||||
cargo doc
|
cargo doc
|
||||||
fi
|
fi
|
||||||
( cd book && mdbook build )
|
( cd book/en && mdbook build )
|
||||||
( cd ru && mdbook build )
|
( cd book/ru && mdbook build )
|
||||||
|
|
||||||
local td=$(mktemp -d)
|
local td=$(mktemp -d)
|
||||||
cp -r target/doc $td/api
|
cp -r target/doc $td/api
|
||||||
cp -r book/book $td/
|
mkdir $td/book
|
||||||
cp LICENSE-* $td/book/
|
cp -r book/en/book $td/book/en
|
||||||
|
cp -r book/ru/book $td/book/ru
|
||||||
|
cp LICENSE-* $td/book/en
|
||||||
|
cp LICENSE-* $td/book/ru
|
||||||
|
|
||||||
linkchecker $td/book/
|
linkchecker $td/book/en/
|
||||||
|
linkchecker $td/book/ru/
|
||||||
linkchecker $td/api/rtfm/
|
linkchecker $td/api/rtfm/
|
||||||
linkchecker $td/api/cortex_m_rtfm_macros/
|
linkchecker $td/api/cortex_m_rtfm_macros/
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
//!
|
//!
|
||||||
//! The user level documentation can be found [here].
|
//! The user level documentation can be found [here].
|
||||||
//!
|
//!
|
||||||
//! [here]: https://japaric.github.io/cortex-m-rtfm/book/
|
//! [here]: https://japaric.github.io/cortex-m-rtfm/book/en/
|
||||||
//!
|
//!
|
||||||
//! Don't forget to check the documentation of the [`#[app]`] attribute, which is the main component
|
//! Don't forget to check the documentation of the [`#[app]`] attribute, which is the main component
|
||||||
//! of the framework.
|
//! of the framework.
|
||||||
|
|
Loading…
Reference in a new issue