- 先配置Rust开发STM32所需的环境,文章地址:
安装项目创建CLI工具
cargo install cargo-embassy
生成项目
cargo embassy init my_project --chip stm32f407vgtx
在Cargo.toml中[dependencies]添加:
embassy-stm32 = { version = "0.1.0", features = ["defmt", "stm32f407vg", "unstable-pac", "memory-x", "time-driver-any", "exti", "chrono"] }
Embed.toml文件
# This file was automatically generated.
[default.general]
chip = "STM32F407VGTx"
[default.reset]
halt_afterwards = false
[default.rtt]
enabled = true
[default.gdb]
enabled = false
运行
cargo run
如果在终端出现以下内容则表示运行成功: