#hal #arm #cortex-m #abstraction-layer #stm32g4xx

无std aemics-stm32g4xx-hal

STM32G473的硬件抽象层 (HAL)

1个不稳定版本

0.1.0 2024年6月27日

#753 in 嵌入式开发

每月 24次下载
aemics_stm32g4xx_drivers 中使用

MIT/Apache

640KB
15K SLoC

STM32G4xx 硬件抽象层

该项目包含由PYglet和PYg Mud Puddle Board抽象层使用的硬件抽象层。它还可以独立使用,以编程STM32G4系列MCU。

HAL实现了embedded-hal crate,该crate概述了Rust HAL项目应遵循的通用API。

此HAL使用stm32g4设备支持crate与MCU的寄存器交互。

HAL基于stm32g4xx-hal crate,并更新到embedded-hal v1.0.0。

目前,唯一经过验证支持的设备是STM32G473。

设置

先决条件

1. WINDOWS:  C++ build tools for Visual Studio 2019.

安装rustup

go to https://www.rust-lang.org/tools/install
download and run installer.
select standard installation
check if installed by running rustc -V
	Should say "rustc 1.78.0" or greater.

Note: 	In case of an existing installation, try running: rustup update

设置工具

run rustup target add thumbv7em-none-eabihf
cargo install cargo-binutils 
rustup component add llvm-tools

设置stm32cubeprog

https://www.st.com/en/development-tools/stm32cubeprog.html
run installer, standard settings. Make a note of the installation folder.
Add the installation's 'bin' folder to your PATH environment variable.
Restart your pc

Note: 	At time of writing, the stm32cubeprogrammer installer does not support Wayland display driver.
	If this issue comes up, instead try using dfu-util.

使用方法

要将此HAL添加到您的项目,请将以下行添加到您的项目Cargo.toml文件中

[dependencies]
aemics-stm32g4xx-hal = { git = "https://gitlab.aemics.nl/aepym/30023200.git", features = ["rt","stm32g473"]}

还可以使用crates.io名称,到2024年6月27日设置为

[dependencies]
aemics-stm32g4xx-hal = "0.1.0" 

/examples/文件夹包含许多示例,这些示例设置简单的程序,例如闪烁测试程序或I2C通信,以便在入门时使用。

已知问题

  • USB实现仅在(优化)发布构建中工作。

版本历史

  • 2024年3月20日: 版本 0.0.0 项目的初始版本,仅实现embedded-hal v0.2.7。
  • 2024年6月27日: 0.1.0 实现了embedded-hal v1.0.0和v0.2.7。添加了USB支持

依赖关系

~51MB
~1.5M SLoC