Closed johnthagen closed 5 months ago
Hey @johnthagen, it sounds like it might be a bit late, but if you are looking for commercial support, or filling in gaps in the ecosystem for your project, my company Ferrous Systems is happy to discuss. Feel free to send me an email if you'd like to discuss further.
Either way, thank you for providing the report of what you found lacking, we (the embedded-wg) also have just started a resource to track issues like this in our Not Yet Awesome Embedded Rust list, it would be great if you could add these items there, or I can move them later this week when I have a chance.
I'm currently working on the front of the lack of CAN support. The current blocker is determining an interface that can be implemented by all.
Thanks again for the report @johnthagen, closing this as part of the 2024 triage effort.
Overview
This post is a summary of the our evaluation of using Rust for an embedded project, and the gaps we hit and why we ultimately decided to use a subset of C++14 instead. This is from a team that wanted to use Rust, but ultimately couldn't justify it in its current state.
Goal
We needed to build an embedded application that utilized CAN, UART, and GPIO. We wanted to use a common, popular embedded platform so we decided to start with the STM32F3DISCOVERY, later also using the STM32F4DISCOVERY.
The Good Parts
The Discovery Book - so great!
Rust itself, for its safety and correctness
The community!
Embedded on stable Rust (big win)
Smaller feature, but
iprintln!
is much easier to use on Rust than trying to get ITM working on C or C++Gaps
There is no CAN support in embedded HAL. This was a show-stopper.
Edit: The community has already answered this one! At the time, we couldn't use (or couldn't find the right resource for) dynamically sized heap containers like
Vec<T>
(heapless
is fixed size only). This was a clear drawback compared to C++11/14 in thegcc-arm-embedded
toolchain.Quality of less-popular chip support. The STM32F3DISCOVERY we were fairly confident in the support for, given the nice Discovery Book and that the crates were being maintained well. But we were a little concerned if we needed to move outside of that particular chip (to an F4, F1, different pinout) about the quality of the other HAL implementations. We sometimes found multiple crates doing the same thing (e.g. https://github.com/rqou/stm32-unified-crate/issues/1). This was a more qualitative assessment (and was done several months ago).
External Gaps
These gaps I view as more outside the scope of the Rust community directly, but I wanted to mention them because they did affect our decision making.
intellij-rust
/ CLion. For C and C++, we could single step debug our STM32 code from within CLion and get all of the nice IDE features and debugger windows you would expect. CLion already supports debugging of desktop Rust (x86) applications. No doubt JetBrains will eventually support this in CLion with their latest push to support STM32 for C/C++, but at the time this was a drawback. The Discovery Book did have an excellent guide for Rust debugging from the command line, so that definitely mitigated this drawback some.