Hacker News new | ask | show | jobs
by kirillkh 3151 days ago
Can any of these be programmed with Rust?
2 comments

Yes! Theoretically anything that Rust has support for (https://forge.rust-lang.org/platform-support.html) but I think most work has been put into ARM Cortex-M support recently. Especially Jorge Aparicio has worked to make embedded programming in Rust a joy (see https://japaric.github.io/discovery/ for an introduction). If you use STM32F MCUs you will probably have the lowest friction. I've heard of other people using the NXP Kinetis lineup as well. Do mind though that there are not many peripheral libraries yet. Currently I myself am fighting with getting USB to work. Of course you could still use the vendor provided C libraries and link against them if you don't want to go for 100% Rust.

The best part: You can use many of Rust's high level zero-cost abstractions. Just take a look at this example code which compiles to very efficient assembly: https://github.com/japaric/discovery/blob/116fe76491d661b5ee...

Seriously curious about this. If not these ones, what other microcontrollers have decent or better rust support? Is there a list somewhere? I'm keen to have more practical uses for my rust skills so I can enjoy using rust without having to find excuses to use it where I would be more productive with other languages.
Your sibling has some good links, but a decent way to think about it is, from hard to easy:

* does it have an LLVM backend?

* is it listed on the forge page?

* is it listed as having std support?

The farther you go down this list, the simpler it gets to use Rust for it.

Latest work has been on ARM boards and a ton of work on AVR, which brings 8/16 but support.