Pre-emptive Multi-Tasking on Arm Cortex-M Posted on 2025-09-28 Contents Background I write a lot of embedded software in Rust these days - sometimes for fun, and sometimes as training material, and sometimes for customers building safety-critical systems. This last group are usually already writing safety-critical software in C, and wish to switch to writing Rust. When you are writing safety-critical software in C, you are usually using some kind of Real-Time Operating System (RTOS) - something that lets you execute multiple tasks concurrently, and that provides queues and timer services so those tasks can message each other and wait for time to elapse. Not always, obviously, but I see it quite often. C-language RTOSes One option for people using an RTOS and wanting to switch to Rust, is to run Rust code on top of their an existing RTOS. A incomplete alphabetical list might include: And we're barely scratching the surface here. Some of these are full 'operating systems', that provide all the libraries you could want (filesystems, hardware drivers, networking, etc). Some are more basic 'kernels' that let you add whatever libraries you want on top. Some are rated for safety-critical usage and some are not. Some are open source, some are commercial, some offer both options. There's a lot of variation, basically. Because Rust can import and export C compatible functions, it's usually straightforward to write tasks in Rust and run them on top of any existing C-language RTOS. Ferrous Systems have examples for ThreadX and examples for FreeRTOS which you can take a look at. So this is a fine option, and one you should consider if you already have an RTOS you like. Rust-language RTOSes Of course, there are now a bunch of RTOSes that don't just let you run Rust programs, but are themselves written in Rust. Again, an incomplete, alphabetical list might include: Again, they vary in scope and intended usage. Special mention to embassy, which isn't an RTOS in the classical sense ...
First seen: 2025-09-30 22:39
Last seen: 2025-10-04 00:55