`stm32f1xx-hal` logo

`stm32f1xx-hal`

Free

[![crates.io](https://img.shields.io/crates/v/stm32f1xx-hal.svg)](https://crates.io/crates/stm32f1xx-hal)

FreeFree tier
Type
Open Source

About `stm32f1xx-hal`

A Rust embedded-hal implementation for the STM32F1 family of microcontrollers. Provides hardware abstraction layer (HAL) allowing Rust code to interact with STM32F1 peripherals such as GPIO, timers, USART, etc., using the embedded-hal traits. Includes a quick start guide, examples (e.g., blinky), and support for various STM32F1 MCUs (e.g., STM32F103 'Blue Pill'). Open source project hosted on GitHub under stm32-rs.

Key Features

Implements embedded-hal traits for STM32F1 microcontrollers
Supports STM32F1 family (e.g., STM32F103, Blue Pill)
Includes example code (blinky) for quick start
Provides memory.x and .cargo/config for project setup
Works with debug probes (STLink, OpenOCD) for programming and debugging

Pros & Cons

Pros
  • Open source and free (MIT/Apache 2.0 licensed)
  • Leverages Rust's memory safety and zero-cost abstractions
  • Standard interface via embedded-hal, promoting code reuse
  • Active community (stm32-rs) and regular updates
  • Comprehensive documentation and quick start guide
Cons
  • Requires external debug probe (e.g., STLink) for programming
  • Requires setup of cross-compilation toolchain (rustup target, OpenOCD, GDB)
  • Limited to STM32F1 family of microcontrollers
  • Steeper learning curve for developers new to embedded Rust

Best For

Embedded development with Rust on STM32F1 microcontrollersBlinking LEDs and basic GPIO controlBuilding embedded applications leveraging Rust's safety and reliability

FAQ

What microcontrollers are supported?
The STM32F1 family, including popular boards like the Blue Pill (STM32F103).
What dependencies are needed to get started?
OpenOCD, gdb-multiarch (or gdb-arm-none-eabi), and the Rust thumbv7m-none-eabi target installed via rustup.
Is this library free to use?
Yes, the project is open source under the MIT and Apache 2.0 licenses.