All News | Boards | Chips | Devices | Software | LinuxDevices.com Archive | About | Contact | Subscribe
Follow LinuxGizmos:
Twitter Facebook Pinterest RSS feed
*   get email updates   *

Rust Embedded Working Group Announces Embedded-HAL v1.0

Jan 12, 2024 — by Giorgio Mendoza 526 views

The Rust Embedded Working Group has announced a significant milestone with the release of embedded-hal version 1.0, marking a new chapter in the Rust embedded ecosystem. This release, alongside companion crates like embedded-hal-bus, embedded-hal-async, and embedded-hal-nb, represents a culmination of efforts since 2020 to stabilize and refine the embedded-hal traits.

Embedded-HAL is a Rust-based framework providing a collection of hardware abstraction layer (HAL) traits for embedded systems. These traits define standard interfaces for interacting with microcontroller peripherals like GPIO, UART, SPI, and I2C, enabling developers to write reusable, hardware-agnostic drivers and applications for various embedded devices.

— ADVERTISEMENT —


These are some of the key features of this update for the of Embedded-HAL v1.0:

Stable Traits for Microcontroller Peripherals: Embedded-hal v1.0 solidifies a range of traits for microcontroller peripherals including GPIO, UART, SPI, and I2C. This stability ensures that drivers for various devices, like sensors and network adapters, can be written generically to work across different microcontrollers.

Focus Shifted to Generic Driver Development: In prior versions, embedded-hal strived to balance standardizing HAL APIs for end-users and supporting generic driver development. With 1.0, the focus is predominantly on the latter, enhancing the value of these crates in the development of generic drivers.

Trait Simplification and Merging: To improve interoperability and resolve conflicts, some traits have been simplified or merged. Additionally, certain traits not conducive to generic driver development have been removed, with plans for future reintroduction.

Introduction of Async Traits in embedded-hal-async: The new embedded-hal-async crate brings async versions of the traits, compatible with Rust 1.75’s stable async traits feature. This allows for heap-free, dynamic dispatch-free async operations, ideal for bare-metal embedded systems.

SPI Bus Sharing with SpiDevice Trait: The SpiDevice trait now supports sharing a SPI bus among multiple devices. This facilitates communication with different devices on the same bus, streamlining development and reducing potential conflicts.

Enhanced Error Handling: Generic drivers can now inspect errors more effectively. All error types must implement an Error trait with a predefined set of error “kinds” and are required to support Debug for better error tracing.

Transition to embedded-io for Byte-Oriented I/O Streams: The embedded-io crates, still in development, are set to replace serial-specific traits in embedded-hal with more universal byte stream traits, promising a more streamlined approach to handling serial ports.


Embedded Rust logo
(click images to enlarge)

Further information

Developers are encouraged to explore the new features, check out the repository, and refer to the API documentation and migration guide for a seamless transition to this new version. The official announcement can be found here.

(advertise here)


Print Friendly, PDF & Email
PLEASE COMMENT BELOW

Please comment here...