flipperzero-firmware icon indicating copy to clipboard operation
flipperzero-firmware copied to clipboard

Support for writing applications in Rust 🦀

Open dcoles opened this issue 3 years ago • 3 comments

As an application developer, I want to be able to write applications for the Flipper Zero in Rust.

Initially it's going to be easiest to support [#no-std] applications, but the long-term goal would be to also support the Rust standard library.

Roadmap

  • [x] Allow linking #[no-std] libraries to external applications: #1781
  • [x] Low-level bindings for Furi/services: flipperzero-sys
  • [x] High level (a.k.a "safe") bindings for Furi/services: flipperzero
  • [ ] alloc support
  • [ ] Evaluate supporting the Rust standard library
  • [ ] Developer documentation

Anything else?

Rust for Flipper Zero now has its own GitHub project: dcoles/flipperzero-rs

dcoles avatar Sep 25 '22 17:09 dcoles

At this point we don't plan to support rust.

But we are going to accept PRs with some conditions:

  • Rust runtime and standard library is not a part of firmware, it must be in elf itself
  • General improvements to elf loader is ok, as long as they don't blowup internal flash usage

skotopes avatar Sep 25 '22 17:09 skotopes

@skotopes Hi! Thanks for the information. I wanted to make sure there was an feature request, since I'm sure there will be others interested.

Rust tends to statically link the runtime/standard library, so there's no need to add support into the firmware. Which is fine if this is just for external applications on the SD card.

Since we don't want to officially support Rust, I'll create a new GitHub project for Rust bindings to the Flipper Zero and push that to crates.io. Developers of external applications can add this as a dependency to make it easier to call Furi and services API.

dcoles avatar Sep 26 '22 00:09 dcoles

Created dcoles/flipperzero-rs and published initial flipperzero and flipperzero-sys crates.

dcoles avatar Sep 26 '22 02:09 dcoles

I think we can safely close this now that there's flipperzero-rs/flipper-zero.

While std support is probably possible, I'm not sure it's worth the trouble at present (the Flipper Zero SDK is distinct enough from a Unix-style platform that it would require a full port).

dcoles avatar Feb 27 '23 06:02 dcoles

@dcoles Good job guys, really awesome to see such achievements.

skotopes avatar Feb 27 '23 06:02 skotopes

@skotopes Thanks! The SDK support has certainly made life a lot easier. The main challenge now is making the Clang-based bindgen play nicely with the toolchain. Once that's reasonably stable, then we can make the flipperzero-sys crate support multiple SDK versions so folks don't have to wait for me to regenerate the bindings.

dcoles avatar Feb 27 '23 06:02 dcoles