#arm #cortex-m #hal #stm32l0xx

no-std stm32l0xx-hal

Peripheral access API for STM32L0 series microcontrollers

10 releases

✓ Uses Rust 2018 edition

new 0.3.1 Sep 11, 2019
0.3.0 Sep 1, 2019
0.2.0 Aug 4, 2019
0.1.8 Aug 3, 2019
0.1.0 Apr 29, 2019

#15 in Embedded development

Download history 27/week @ 2019-05-29 14/week @ 2019-06-05 16/week @ 2019-06-12 29/week @ 2019-06-19 75/week @ 2019-06-26 57/week @ 2019-07-03 38/week @ 2019-07-10 3/week @ 2019-07-17 3/week @ 2019-07-24 56/week @ 2019-07-31 42/week @ 2019-08-07 24/week @ 2019-08-14 38/week @ 2019-08-21 40/week @ 2019-08-28 50/week @ 2019-09-04

156 downloads per month
Used in 1 crate

0BSD license



Build Status

stm32l0xx-hal is a Hardware Abstraction Layer (HAL) for the STMicro STM32L0xx family of microcontrollers.

This crate relies on Adam Greig's stm32l0 crate to provide appropriate register definitions and implements a partial set of the embedded-hal traits.

Based on the stm32l1xx-hal crate by Vitaly Domnikov and the stm32f4xx-hal crate by Daniel Egger.

Supported Configurations

  • stm32l0x1
  • stm32l0x2
  • stm32l0x3

Build Dependencies

  1. Rustup toolchain installer


Toolchain Configuration

$ rustup target add thumbv6m-none-eabi

Build Examples

$ cargo build --release --examples --features stm32l0x1,rt

Using as a Dependency

To use the stm32l0xx-hal crate as a dependency, add the following definition to your Cargo.toml:

version = "0.3.1"
features = ["stm32l0x1", "rt"]

Example Projects: HABEXpico

Dependecies for Flashing

  1. Download and install the arm-none-eabi toolchain

    https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads We recommend installing the precompiled binaries to '/usr/local/opt'. Add the bin folders (/bin & /arm-none-eabi/bin) to your environments variable 'PATH'.

  2. Install STLink Tool (>=v1.5.1)


  3. Install OpenOCD (OPTIONAL)

    NOTE: OpenOCD v0.10.0 does not fully support the stm32l0 family MCU. We recommend using gnu-mcu-eclipse/openocd instead:

    https://gnu-mcu-eclipse.github.io/openocd/install/ We recommend installing the precompiled binaries to '/usr/local/opt'. Add the bin folders (i.e. - /usr/local/opt/gnu-mcu-eclipse/openocd/0.10.0-12-20190422-2015/bin) to your environments variable 'PATH'.

  4. Install GDB Dashboard (OPTIONAL)



The following instructions outline how-to on flashing the 'serial' example code. This can be extended to any other example code.

Flashing with ST-Flash:

  1. Flash the microcontroller using the flash script
    $ ./flash.sh target/thumbv6m-none-eabi/release/examples/serial

Flashing with OpenOCD

  1. Flash the microcontroller using the openocd flash script
    $ ./openocd_flash.sh target/thumbv6m-none-eabi/release/examples/serial


Debugging with GDB

  1. Terminal 1 - OpenOCD Session:

    $ ./openocd_session.sh
  2. Terminal 2 - GDB Session:

    $ ./gdb_session.sh target/thumbv6m-none-eabi/release/examples/serial

Debugging with GDB Py and GDB Dashboard

  1. Terminal 1 - OpenOCD Session:

    $ ./openocd_session.sh
  2. Terminal 2 - GDB Py Session:

    $ ./gdb_session.sh target/thumbv6m-none-eabi/release/examples/serial -d

    Note: Users can redirect the dashboard output to separate terminal (i.e. - ttys001) using:

    >>> dashboard -output /dev/ttys001

Contibutor Notes

  • Revert local dependencies to external cargo and uncomment configurations before committing


0-Clause BSD License, see LICENSE-0BSD.txt for more details.


~512K SLoC