RTIC on the STM32F4xx Nucleo board
Rust
We assume Rust to be installed using rustup.
Additionally you need to install the thumbv7em-none-eabi target.
> rustup target add thumbv7em-none-eabi
You also need cargo-binutils.
For RTT tracing
We assume the following tools are in place:
For low level gdb based debugging
Linux tooling:
openocd-
arm-none-eabi-gdb, or gdb-multiarch
Editor
You may use any editor of choice. vscode supports Rust using the rust-analyzer plugin.
Exercises
-
src/main.rsDeveloping embedded applications in Rust is made simle by the RTIC framework. In this exercise you will familiarize yourself with the basics
initandidle, and see how you can trace the output to a terminal usingcargo-run.You will also learn about
panics and how they can be traced. -
examples/rtt_timing.rsHere you will learn about cycle accurate timing measurements:
-
Using instrumentation code (which introduces bloat and overhead).
-
Non intrusive measurements using the on-chip debug unit and
gdb. -
Code generation optimization.
-
Code inspection,
objdump, debugging and interactivedisassemble. -
Code trimming, RTIC is "A Zero-Cost Abstraction for Memory Safe Concurrency".
-
-
examples/timing_task.rsHere you learn about the Nested Vector Interrupt Controller (NVIC):
-
Tasks are bound to interrupt vectors.
-
Tasks can be pended either by code or by the environment (e.g. on arrival of serial data).
-
The
bkptcan be inserted in the code to trigger a breakpoint (useful to timing measurements). -
RTIC has zero-cost task dispatch overhead (well 2-clock cycles but will be fixed to zero).
-
-
examples/timing_resource.rsHere you will learn about resource handling in RTIC:
-
Implementation of critical sections through priority masking (NVIC-BASEPRI).
-
Direct access to non-preemptable resources.
-
Comparison to threaded counterpart.
-