This repository demonstrates how to compile and execute Rust-written tasks on the Eclipse ThreadX Real-Time Operating System (RTOS). The primary target platform for this project is the Arm Cortex-R5 processor, showcasing the integration of Rust with ThreadX for high-performance real-time applications.
Visit the Arm GNU Toolchain
page and choose the AArch32 bare-metal target (arm-none-eabi) toolchain variant compatible with your development environment.
Install Rust via rustup (Recommended)
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shThen, enable bare-metal target for CPUs in the Armv7-R architecture family.
$ rustup target add armv7r-none-eabihfRun make to build both ThreadX and Rust code from source.
Run make run to launch Rust-written tasks on ThreadX via QEMU.
Building does not require libclang; the threadx-sys crate ships pre-generated FFI bindings.
After upgrading ThreadX or modifying its headers, regenerate the bindings with:
$ make bindgenThis requires libclang to be installed.
The updated bindings are written to threadx-sys/src/bindings.rs and should be committed.
The project uses cargo xtask for build automation:
$ cargo xtask run # Build release binary and run on QEMU (interactive)
$ cargo xtask smoke # Marker-driven boot and runtime validation
$ cargo xtask size # Binary size breakdown (text/data/bss per object)
$ cargo xtask help # Show all commands and optionsMakefile shortcuts are available for common operations:
$ make smoke # Equivalent to cargo xtask smoke
$ make size # Equivalent to cargo xtask sizeEnvironment variables:
QEMU_TIMEOUT- QEMU timeout in seconds (default: 30)QEMU_VERBOSE- Show full UART output during smoke testsSMOKE_QUICK- Skip slow markers for faster iteration
The smoke test validates deterministic markers emitted during boot and runtime:
Running ThreadX → PRIMITIVES_OK → APP_READY → TICK_OK → PIPE_OK → MTX_OK
This project is available under a permissive MIT-style license. Use of this source code is governed by a MIT license that can be found in the LICENSE file.