platformio-core icon indicating copy to clipboard operation
platformio-core copied to clipboard

Add support for rust

Open abelykh0 opened this issue 4 years ago • 7 comments

Add support for rust and cortex-m-rtic https://github.com/rtic-rs/cortex-m-rtic

abelykh0 avatar Aug 26 '19 03:08 abelykh0

Related links:

  • https://community.platformio.org/t/how-would-i-implement-a-rust-compiler-that-links-with-any-framework/14113
  • https://github.com/dzervas/platformio-arduino-rust

ivankravets avatar Jun 05 '20 09:06 ivankravets

I've created a POC on the above linked repo, take a look. Shouldn't be too hard to use my example for another MCU

dzervas avatar Jun 25 '20 22:06 dzervas

better rust support in pio would be really appreciable!

perhaps it could also make some sense to combine this improvements with better rt-thread support, because this particular RTOS and its middleware packages also utilize the python based SCons build system, and there are also some rust integration attempts available for it (rttrust), which look very similar to the solutions suggested here.

mash-graz avatar Feb 13 '21 10:02 mash-graz

I'd also like to see multi-compiler (and testing framework) support, there's a definite growing trend of using Rust in embedded, it's even starting to standardise its own CMSIS-like approach which chimes well with Platform IO's goals. It has also recently been proposed as the Linux kernel's second official language (with Rust growing even faster in the systems programming space). There's something to be said for being able to have a single language for writing safe code at all these various levels, especially in the IoT space where development can often be full stack. It would bridge that final gap in providing a unified solution across the embedded space (and maybe even a bit more).

CoderScribe avatar Apr 17 '21 18:04 CoderScribe

What is the path toward this goal? How we can contribute?

HKalbasi avatar Apr 19 '21 12:04 HKalbasi

Shameless plug: here's my effort. Currently used to drive this Rust binary crate project with PlatformIO.

ivmarkov avatar Jun 20 '21 18:06 ivmarkov

@HKalbasi You can contribute by creating Rust bindings for all of the C++ code. Maybe https://cxx.rs can help. There's a blog post of what I've done (more or less): https://whynot.fail/coding/rusty-arduino-bindings/

It's a huge undertaking, mostly due to the complexity of the C++ code and its build system (it's really, REALLY hard for me to follow which code is actually called with all of the conditional compilation flags)

What could be done is to start a dedicated project for each architecture/MCU with (at least partially) manually written bindings.

dzervas avatar Jun 29 '21 12:06 dzervas