Skip to content

Commit

Permalink
Embedded ci works
Browse files Browse the repository at this point in the history
  • Loading branch information
korken89 committed Mar 4, 2022
1 parent a765f3f commit 6ff139d
Show file tree
Hide file tree
Showing 133 changed files with 985 additions and 486 deletions.
23 changes: 16 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,11 @@ jobs:
components: llvm-tools-preview

# Use precompiled binutils
- name: cargo install cargo-binutils
uses: actions-rs/install@v0.1
with:
crate: cargo-binutils
version: latest
# - name: cargo install cargo-binutils
# uses: actions-rs/install@v0.1
# with:
# crate: cargo-binutils
# version: latest

- name: Cache Dependencies
uses: Swatinem/rust-cache@v1
Expand All @@ -172,12 +172,21 @@ jobs:
sudo apt update
sudo apt install -y qemu-system-arm
- name: Install embedded-ci-client
run: |
cargo install --git https://github.com/korken89/embedded-ci.git embedded-ci-client
- name: Fail on warnings
run: sed -i 's,//deny_warnings_placeholder_for_ci,#![deny(warnings)],' src/lib.rs macros/src/lib.rs

- name: Run-pass tests
run:
cargo xtask --target ${{ matrix.target }}
env:
EMBEDDED_CI_TOKEN: ${{ secrets.EMBEDDED_CI_TOKEN }}
EMBEDDED_CI_SERVER: ${{ secrets.EMBEDDED_CI_SERVER }}
run: |
cd examples-runner
cargo xtask --target ${{ matrix.target }} --runner embedded-ci
cargo xtask --target ${{ matrix.target }} --runner qemu
# Check the correctness of macros/ crate
checkmacros:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ For each category, *Added*, *Changed*, *Fixed* add new entries at the top!

### Added

- HIL tests (embedded-ci)
- Improve how CHANGELOG.md merges are handled
- If current $stable and master version matches, dev-book redirects to $stable book
- During deploy stage, merge master branch into current stable IFF cargo package version matches
Expand Down
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ lto = true
[workspace]
members = [
"macros",
"xtask",
]
exclude = [
"examples-runner",
]

# do not optimize proc-macro deps or build scripts
Expand Down
2 changes: 1 addition & 1 deletion book/en/src/by-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ $ cargo run --target thumbv7m-none-eabi --example locals
Yields this output:

``` console
{{#include ../../../ci/expected/locals.run}}
{{#include ../../../example-runner/ci/expected/locals.run}}
```
2 changes: 1 addition & 1 deletion book/en/src/by-example/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ 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.

``` rust
{{#include ../../../../examples/common.rs}}
{{#include ../../../../example-runner/src/bin/common.rs}}
```
8 changes: 4 additions & 4 deletions book/en/src/by-example/app_idle.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ are safe to access.
The example below shows that `idle` runs after `init`.

``` rust
{{#include ../../../../examples/idle.rs}}
{{#include ../../../../example-runner/src/bin/idle.rs}}
```

``` console
$ cargo run --target thumbv7m-none-eabi --example idle
{{#include ../../../../ci/expected/idle.run}}
{{#include ../../../../example-runner/ci/expected/idle.run}}
```

By default, the RTIC `idle` task does not try to optimize for any specific targets.
Expand All @@ -43,10 +43,10 @@ default [`nop()`][NOP] with [`wfi()`][WFI].
[NOP]: https://developer.arm.com/documentation/dui0662/b/The-Cortex-M0--Instruction-Set/Miscellaneous-instructions/NOP

``` rust
{{#include ../../../../examples/idle-wfi.rs}}
{{#include ../../../../example-runner/src/bin/idle-wfi.rs}}
```

``` console
$ cargo run --target thumbv7m-none-eabi --example idle-wfi
{{#include ../../../../ci/expected/idle-wfi.run}}
{{#include ../../../../example-runner/ci/expected/idle-wfi.run}}
```
4 changes: 2 additions & 2 deletions book/en/src/by-example/app_init.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ The `device` field is available when the `peripherals` argument is set to the de
In the rare case you want to implement an ultra-slim application you can explicitly set `peripherals` to `false`.

``` rust
{{#include ../../../../examples/init.rs}}
{{#include ../../../../example-runner/src/bin/init.rs}}
```

Running the example will print `init` to the console and then exit the QEMU process.

``` console
$ cargo run --target thumbv7m-none-eabi --example init
{{#include ../../../../ci/expected/init.run}}
{{#include ../../../../example-runner/ci/expected/init.run}}
```

> **NOTE**: You can choose target device by passing a target
Expand Down
2 changes: 1 addition & 1 deletion book/en/src/by-example/app_minimal.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
This is the smallest possible RTIC application:

``` rust
{{#include ../../../../examples/smallest.rs}}
{{#include ../../../../example-runner/src/bin/smallest.rs}}
```
4 changes: 2 additions & 2 deletions book/en/src/by-example/app_priorities.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ Task Priority
The following example showcases the priority based scheduling of tasks:

``` rust
{{#include ../../../../examples/preempt.rs}}
{{#include ../../../../example-runner/src/bin/preempt.rs}}
```

``` console
$ cargo run --target thumbv7m-none-eabi --example preempt
{{#include ../../../../ci/expected/preempt.run}}
{{#include ../../../../example-runner/ci/expected/preempt.run}}
```

Note that the task `bar` does *not* preempt task `baz` because its priority
Expand Down
4 changes: 2 additions & 2 deletions book/en/src/by-example/hardware_tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ The example below demonstrates the use of the `#[task(binds = InterruptName)]` a
hardware task bound to an interrupt handler.

``` rust
{{#include ../../../../examples/hardware.rs}}
{{#include ../../../../example-runner/src/bin/hardware.rs}}
```

``` console
$ cargo run --target thumbv7m-none-eabi --example hardware
{{#include ../../../../ci/expected/hardware.run}}
{{#include ../../../../example-runner/ci/expected/hardware.run}}
```
4 changes: 2 additions & 2 deletions book/en/src/by-example/message_passing.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ pending spawns of `foo`. Exceeding this capacity is an `Error`.
The number of arguments to a task is not limited:

``` rust
{{#include ../../../../examples/message_passing.rs}}
{{#include ../../../../example-runner/src/bin/message_passing.rs}}
```

``` console
$ cargo run --target thumbv7m-none-eabi --example message_passing
{{#include ../../../../ci/expected/message_passing.run}}
{{#include ../../../../example-runner/ci/expected/message_passing.run}}
```
8 changes: 4 additions & 4 deletions book/en/src/by-example/monotonic.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ This activates the monotonics making it possible to use them.
See the following example:

``` rust
{{#include ../../../../examples/schedule.rs}}
{{#include ../../../../example-runner/src/bin/schedule.rs}}
```

``` console
$ cargo run --target thumbv7m-none-eabi --example schedule
{{#include ../../../../ci/expected/schedule.run}}
{{#include ../../../../example-runner/ci/expected/schedule.run}}
```

## Canceling or rescheduling a scheduled task
Expand All @@ -51,10 +51,10 @@ If `cancel` or `reschedule_at`/`reschedule_after` returns an `Err` it means that
too late and that the task is already sent for execution. The following example shows this in action:

``` rust
{{#include ../../../../examples/cancel-reschedule.rs}}
{{#include ../../../../example-runner/src/bin/cancel-reschedule.rs}}
```

``` console
$ cargo run --target thumbv7m-none-eabi --example cancel-reschedule
{{#include ../../../../ci/expected/cancel-reschedule.run}}
{{#include ../../../../example-runner/ci/expected/cancel-reschedule.run}}
```
24 changes: 12 additions & 12 deletions book/en/src/by-example/resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ The example application shown below contains two tasks where each task has acces
`#[local]` resource, plus that the `idle` task has its own `#[local]` as well.

``` rust
{{#include ../../../../examples/locals.rs}}
{{#include ../../../../example-runner/src/bin/locals.rs}}
```

Running the example:

``` console
$ cargo run --target thumbv7m-none-eabi --example locals
{{#include ../../../../ci/expected/locals.run}}
{{#include ../../../../example-runner/ci/expected/locals.run}}
```

### Task local initialized resources
Expand All @@ -64,12 +64,12 @@ are not crossing any thread boundary.
In the example below the different uses and lifetimes are shown:

``` rust
{{#include ../../../../examples/declared_locals.rs}}
{{#include ../../../../example-runner/src/bin/declared_locals.rs}}
```

<!-- ``` console
$ cargo run --target thumbv7m-none-eabi --example declared_locals
{{#include ../../../../ci/expected/declared_locals.run}}
{{#include ../../../../example-runner/ci/expected/declared_locals.run}}
``` -->

## `#[shared]` resources and `lock`
Expand Down Expand Up @@ -97,12 +97,12 @@ resource for accessing the data. The highest priority handler, which do not acce
resource, is free to preempt the critical section created by the lowest priority handler.

``` rust
{{#include ../../../../examples/lock.rs}}
{{#include ../../../../example-runner/src/bin/lock.rs}}
```

``` console
$ cargo run --target thumbv7m-none-eabi --example lock
{{#include ../../../../ci/expected/lock.run}}
{{#include ../../../../example-runner/ci/expected/lock.run}}
```

Types of `#[shared]` resources have to be both [`Send`] and [`Sync`].
Expand All @@ -113,12 +113,12 @@ As an extension to `lock`, and to reduce rightward drift, locks can be taken as
following examples show this in use:

``` rust
{{#include ../../../../examples/multilock.rs}}
{{#include ../../../../example-runner/src/bin/multilock.rs}}
```

``` console
$ cargo run --target thumbv7m-none-eabi --example multilock
{{#include ../../../../ci/expected/multilock.run}}
{{#include ../../../../example-runner/ci/expected/multilock.run}}
```

## Only shared (`&-`) access
Expand All @@ -143,12 +143,12 @@ In the example below a key (e.g. a cryptographic key) is loaded (or created) at
used from two tasks that run at different priorities without any kind of lock.

``` rust
{{#include ../../../../examples/only-shared-access.rs}}
{{#include ../../../../example-runner/src/bin/only-shared-access.rs}}
```

``` console
$ cargo run --target thumbv7m-none-eabi --example only-shared-access
{{#include ../../../../ci/expected/only-shared-access.run}}
{{#include ../../../../example-runner/ci/expected/only-shared-access.run}}
```

## Lock-free resource access of shared resources
Expand All @@ -165,10 +165,10 @@ tasks running at different priorities will result in a *compile-time* error -- n
API would be a data race in that case.

``` rust
{{#include ../../../../examples/lock-free.rs}}
{{#include ../../../../example-runner/src/bin/lock-free.rs}}
```

``` console
$ cargo run --target thumbv7m-none-eabi --example lock-free
{{#include ../../../../ci/expected/lock-free.run}}
{{#include ../../../../example-runner/ci/expected/lock-free.run}}
```
4 changes: 2 additions & 2 deletions book/en/src/by-example/software_tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ The framework will give a compilation error if there are not enough dispatchers
See the following example:

``` rust
{{#include ../../../../examples/spawn.rs}}
{{#include ../../../../example-runner/src/bin/spawn.rs}}
```

``` console
$ cargo run --target thumbv7m-none-eabi --example spawn
{{#include ../../../../ci/expected/spawn.run}}
{{#include ../../../../example-runner/ci/expected/spawn.run}}
```
4 changes: 2 additions & 2 deletions book/en/src/by-example/tips_destructureing.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ resources.
Here are two examples on how to split up the resource struct:

``` rust
{{#include ../../../../examples/destructure.rs}}
{{#include ../../../../example-runner/src/bin/destructure.rs}}
```

``` console
$ cargo run --target thumbv7m-none-eabi --example destructure
{{#include ../../../../ci/expected/destructure.run}}
{{#include ../../../../example-runner/ci/expected/destructure.run}}
```
8 changes: 4 additions & 4 deletions book/en/src/by-example/tips_from_ram.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,25 @@ improve performance in some cases.
The example below shows how to place the higher priority task, `bar`, in RAM.

``` rust
{{#include ../../../../examples/ramfunc.rs}}
{{#include ../../../../example-runner/src/bin/ramfunc.rs}}
```

Running this program produces the expected output.

``` console
$ cargo run --target thumbv7m-none-eabi --example ramfunc
{{#include ../../../../ci/expected/ramfunc.run}}
{{#include ../../../../example-runner/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`).

``` console
$ cargo nm --example ramfunc --release | grep ' foo::'
{{#include ../../../../ci/expected/ramfunc.run.grep.foo}}
{{#include ../../../../example-runner/ci/expected/ramfunc.run.grep.foo}}
```

``` console
$ cargo nm --example ramfunc --release | grep ' bar::'
{{#include ../../../../ci/expected/ramfunc.run.grep.bar}}
{{#include ../../../../example-runner/ci/expected/ramfunc.run.grep.bar}}
```
4 changes: 2 additions & 2 deletions book/en/src/by-example/tips_indirection.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ or one can use a statically allocated memory pool like [`heapless::Pool`].
Here's an example where `heapless::Pool` is used to "box" buffers of 128 bytes.

``` rust
{{#include ../../../../examples/pool.rs}}
{{#include ../../../../example-runner/src/bin/pool.rs}}
```

``` console
$ cargo run --target thumbv7m-none-eabi --example pool
{{#include ../../../../ci/expected/pool.run}}
{{#include ../../../../example-runner/ci/expected/pool.run}}
```
4 changes: 2 additions & 2 deletions book/en/src/by-example/tips_static_lifetimes.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ for lock-free access to the shared queue.
[`heapless::spsc::Queue`]: https://docs.rs/heapless/0.7.5/heapless/spsc/struct.Queue.html

``` rust
{{#include ../../../../examples/static.rs}}
{{#include ../../../../example-runner/src/bin/static.rs}}
```

Running this program produces the expected output.

``` console
$ cargo run --target thumbv7m-none-eabi --example static
{{#include ../../../../ci/expected/static.run}}
{{#include ../../../../example-runner/ci/expected/static.run}}
```

0 comments on commit 6ff139d

Please sign in to comment.