Installation
Start
Installation
Section titled “Installation”Requirements
Section titled “Requirements”- Rust 1.88 or newer (edition 2024). Check with
rustc --version. - A firmware already using embassy, or a host binary using
embassy-executor’s std support. The supervisor tracks these crate versions:
embassy-executor0.10,embassy-sync0.8,embassy-time0.5. Because embassy is pre-1.0, your application must resolve to compatible minor versions. If you use a git or patched embassy, make sure the supervisor resolves to the same revision through your[patch]section. - No allocator needed. No
unsafein the library (#![forbid(unsafe_code)]); two optional features can emit small, documentedunsafehelpers into your crate, and both are opt-in.
Add the crate
Section titled “Add the crate”cargo add embassy-supervisorThe macros feature is on by default. It provides the supervisor_graph!
declaration macro, re-exported from the crate root. Everything else the
supervisor can do is opt-in:
[dependencies]embassy-supervisor = "0.8"
[features]# an example application feature that turns on supervisor capabilitiesdefault = ["supervised"]supervised = [ "embassy-supervisor/readiness", "embassy-supervisor/liveness-monitor", "embassy-supervisor/control", "embassy-supervisor/pool",]Pick features by what your graph actually uses. Both control and pool add
code to the supervisor’s driver loop that runs whether or not a graph uses
it, so a graph with no runtime control and no pools should not carry either.
A wrong choice is loud: declaring a pool without the feature, or calling a
control verb without it, produces an error that names the feature.
The full list with defaults is in the feature reference.
Logging backends
Section titled “Logging backends”The supervisor logs lifecycle events through an optional backend:
defmtfor on-target logging (the usual choice with embassy and RTT),logfor hosted or std consumers.
With neither enabled the log calls compile to nothing. If you want stale reports and bring-up lines visible anywhere, enable one.
Release profile
Section titled “Release profile”For smaller, better optimized firmware, set this profile in the workspace
root’s Cargo.toml:
[profile.release]debug = 2lto = "fat"opt-level = "s"codegen-units = 1lto = "fat"runs link-time optimization across the whole dependency tree, letting the compiler inline and eliminate code across crate boundaries.codegen-units = 1compiles each crate as one unit instead of parallel chunks, enabling more thorough optimization at the cost of compile time.opt-level = "s"optimizes for size rather than speed, the usual embedded budget.debug = 2keeps full debug symbols in the ELF for probe-rs and GDB. It does not change codegen, and debug sections are not flashed to the device.
Verify the toolchain
Section titled “Verify the toolchain”rustup target add thumbv7em-none-eabihf # or your MCU's targetcargo buildThe library itself is HAL-free, so it builds for any target embassy builds
for, including x86_64-unknown-linux-gnu for host tests.
Your first graph takes the crate from installed to running.