
Migrate a Driver From embedded-hal 0.2 to 1.0
Port a driver from embedded-hal 0.2 to 1.0 with exact trait changes for I2C, SPI, GPIO and delays, plus the embedded-hal-compat bridge for mixed crates.
Tag
36 posts

Port a driver from embedded-hal 0.2 to 1.0 with exact trait changes for I2C, SPI, GPIO and delays, plus the embedded-hal-compat bridge for mixed crates.

Build a TMP102 temperature driver generic over the embedded-hal 1.0 I2c trait, with typed errors, a release method and host unit tests using embedded-hal-mock.

Learn the layers of embedded Rust crates, from cortex-m and the PAC through the HAL to a board support crate, with one pin toggle written at each level.

Set probe-rs run as the Cargo runner, add defmt and defmt-rtt, and read log lines from a running Cortex-M board in your terminal with panic-probe.

Build a bare-metal Rust blinky for an STM32F411 Nucleo board with stm32f4xx-hal, from Cargo.toml and memory.x to the toggle loop and the flash command.

Read and write files in Rust safely with std::fs and BufReader, understanding why unbuffered reads are slow and how Result propagation replaces manual checks.

no_std removes Rust's standard library and keeps core. See what disappears (heap, threads, files, println), what stays, and how alloc fits back in.

Run code in the child between fork and exec with CommandExt::pre_exec, learn which calls are async-signal-safe, and see how errors propagate to spawn.

Run the Rust doctests of the kernel crate and write your own kunit_tests suite on Linux 6.18, with kunit.py, KTAP output and the limits of each test kind.

Stop passing raw i32 descriptors around. Use OwnedFd to close on drop and BorrowedFd to lend a descriptor safely, with the AsFd trait, since Rust 1.63.

Compare one Linux 6.18 module in C and Rust for safety, error handling, build cost and API coverage, then pick the language for your next kernel module.

Write, build and load a first Rust kernel module in a Linux 6.18 tree: the module! macro, init and Drop, KVec, Kconfig and Makefile entries and dmesg output.