Rust modernises development on Azure Sphere

  • January 18, 2023
  • Steve Rogerson

Rust can now be used to develop applications on Azure Sphere.

Rust and Azure Sphere are a good match, according to Akshatha Udayashankar, an embedded software engineer at Microsoft writing in a blog post.

Rust is a programming language that can improve safety of code with strict compile time safety checks alongside Azure Sphere’s secure identity, update, and end-to-end encrypted communication services for internet-connected devices. This should provide greater security to the user applications, said Udayashankar.

“Rust offers embedded developers a new level of performance and safety,” said Udayashankar. “It provides high-level ergonomics by bringing contemporary developer tools to systems programming and also low-level control. Low-level code is often prone to a variety of subtle bugs, which in most other languages can be caught only through extensive testing and careful code review by experienced developers.”

In Rust, the compiler refuses to compile code with these elusive bugs, including concurrency bugs. Rust tries to make safe code be fast code as well. Zero-cost abstractions ensure higher-level features compile to low-level code as fast as code is written manually.

The checks performed by the Rust compiler ensures stability through feature additions and refactoring. This contrasts with the legacy code in languages without these checks, which are riskier and require closer attention, reviewing and testing.

Rust in Azure Sphere is implemented following Rust’s crate system, where needed dependencies are built into the user app for Azure Sphere. “These dependencies interface with the same binary interfaces to the Azure Sphere OS that other applications interface with, for which we provide a long-term compatibility promise,” said Udayashankar. “Like other Azure Sphere apps, ones built in Rust today are expected to be fully functional in 2031, regardless of security patches, fixes and new features added to the Azure Sphere OS by then. Rust can be highly efficient, but by including many dependencies in the app itself, you may need to evaluate how a Rust implementation utilises memory