#arm #cortex-m #hal #stm32g4xx

no-std stm32g4xx-hal

Peripheral access API for STM32G4 series microcontrollers

2 releases

0.0.1 Apr 18, 2023
0.0.0 May 31, 2019

#198 in #hal

Download history 51/week @ 2023-06-07 57/week @ 2023-06-14 219/week @ 2023-06-21 70/week @ 2023-06-28 4/week @ 2023-07-05 11/week @ 2023-07-12 18/week @ 2023-07-19 49/week @ 2023-07-26 57/week @ 2023-08-02 53/week @ 2023-08-09 49/week @ 2023-08-16 93/week @ 2023-08-23 17/week @ 2023-08-30 41/week @ 2023-09-06 78/week @ 2023-09-13 64/week @ 2023-09-20

240 downloads per month


12K SLoC


🚧 Work in progress

stm32g4xx-hal contains a multi device hardware abstraction on top of the peripheral access API for the STMicro STM32G4 series microcontrollers. The selection of the MCU is done by feature gates, typically specified by board support crates.


This crate will eventually contain support for multiple microcontrollers in the stm32g4 family. Which specific microcontroller you want to build for has to be specified with a feature, for example stm32g431.

Currently supported configurations are:

  • stm32g431
  • stm32g441
  • stm32g491
  • stm32g473
  • stm32g483
  • stm32g474
  • stm32g484

Building an Example

If you are compiling the crate on its own for development or running examples, specify your microcontroller on the command line. For example:

cargo build --example blinky --features stm32g473

Running examples

Examples can be built and run using cargo run. It is necessary to provide any required features followed by the name of the chip.

cargo run --example usb_serial --features stm32g473 --features usb_fs --release -- --chip STM32G473RETx

A list of chips supported by probe-rs can be found by running

probe-run --list-chips

For furher information, see the documentation for probe-run.

Using as a Dependency

When using this crate as a dependency in your project, the microcontroller can be specified as part of the Cargo.toml definition.

stm32g4xx-hal = "0.0.0"


The documentation can be found at docs.rs.


Licensed under either of

at your option.


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


~1.5M SLoC