lilos
: A minimal async RTOSThis is a wee RTOS written to support the async
style of programming in Rust.
It's a research project, a playground, and a proof of concept.
(lilos
1 was a wee RTOS written to
support multithreaded message-passing programs on AVR; this is technically
lilos
2 but who's counting.)
lilos
is unusual for an RTOS:
async
-based cooperative multitaskingConcrete example: code to blink an LED on the STM32F407's pin D13. (Note that a
real application also needs a main
, this just shows the one task.)
```rust use core::time::Duration; use os::exec::sleep_for; use stm32f4xx::stm32f407::GPIOD;
async fn blinkytask(gpiod: &GPIOD) -> ! { let period = Duration::frommillis(500); loop { gpiod.bsrr.write(|w| w.bs13().setbit()); sleepfor(period).await; gpiod.bsrr.write(|w| w.br13().setbit()); sleepfor(period).await; } } ```
For complete worked examples, see the examples
directory, particularly:
examples/minimal.rs
is the simplest LED blinky program.examples/blinky.rs
is a fancier blinky program.examples/uart_echo.rs
does UART I/O across tasks with a queue.If you'd like to read about this at length, see the technical report.
If you have questions, or you use it for something, I'd love to find out! Send me an email.
I'm experimenting with using the MPL-2 for subversive reasons. I'm open to relicensing this code if MPL-2 doesn't work for your organization, we'll just need to discuss your labor practices. ;-)