- Notifications
You must be signed in to change notification settings - Fork 71
Description
A lot of customers are requiring new projects to use "memory safe" languages, such as Rust. This includes embedded projects.
The "FreeRTOS-Rust" crate looked, on the surface, the best chance for the team I work with to implement the designs we have based on using FreeRTOS in Rust. We have run into several issues, however, the first one being that the FreeRTOS-rust crate on crates.io
(https://crates.io/crates/freertos-rust) is now over 5 years behind what's on GitHub. Another problem is that my team is not yet Rust literate enough to read between the lines and figure out how some of the wrappers for the FreeRTOS functions can be successfully used in practice.
The examples in this repository are too limited; they only exercise 3 interfaces. The moral equivalent of a "Blinky" application is a proof of concept, but not enough to provide information about how the RTOS primitives are used in real code. Something more like the "Device Independent Demo" (https://www.freertos.org/Documentation/02-Kernel/03-Supported-devices/04-Demos/Device-independent-demo/Hardware-independent-RTOS-example) is needed to show how a real embedded application in Rust on FreeRTOS can be done.
An example with multiple tasks using FreeRTOS queues, semaphores, software timers, event groups, mutexes, etc., would go a long way toward aiding the adoption of Rust in the embedded space.
Another possibility is a test suite that includes code that exercises each of the FreeRTOS features as wrapped by FreeRTOS-rust, since that can also be referenced by people unfamiliar with how to interpret things like functions that return Result<(), FreeRtosError>
. I spent over 6 hours trying to extend the Windows example main()
to have 2 tasks, one that used the delay in the loop and released a counting semaphore (via the Semaphore .give
interface) every 10 iterations, the other task blocking on the same Semaphore (via the .take()
method) with a timeout. I was doing this to familiarize myself with FreeRTOS-rust, but I never was able to make the compiler accept the code. I did many searches on the web, found nothing.