Writing Rust bindings for ThreadX
summary
Creates a CMake-driven -sys crate that downloads, configures and compiles ThreadX, captures compiler flags via a custom compiler wrapper, and calls bingen-generated unsafe bindings to match the configured C headers; hand-writes a tiny set of macro-derived constants. Wraps that with threadx-rs safe API enforcing ownership (static allocation, typed queues, block pools) and proves it with a working STM32 blue pill demo (~19 KB flash image using event flags and message queues) and a noted trouble spot: timer callbacks lack context pointer.
AI-written summary · about
chapters (12)
- 0:00Introduction and background
- 2:52Embedded rust and ThreadX
- 4:39Project goals and philosophy
- 7:33Why choose ThreadX
- 9:54Developing a rust wrapper
- 11:58Embedded rust application setup
- 13:51Building the threadx-sys crate
- 16:16Handling loose ends
- 17:14Creating a safe rust API
- 20:26Future work and improvement
- 22:21Live demonstrations
- 25:53Q&A and closing remarks
related talks
04mUsing the Rust Standard Library on High-End MCUs
28mInterfacing Rust with Xen
12mPorting The ThreadX RTOS To RISC V
41mRust Meets Zephyr: Building Safer Embedded Applications
08mLightning Talk: C++ and Rust Bindings - Mixing It Best With CMake
25mRust and C++
01h 11mDuck-Tape Chronicles - Rust C++ Interop
01h 02mRewriting of a small component from C to Rust
