Windows 系统 Rust 的嵌入式开发环境搭建之 probe-rs 版

分类:STM32     发布时间:2026-03-29     最后更新:2026-03-29     浏览数:19
本文详细阐述了在 Windows 系统下搭建基于 Rust 的嵌入式开发环境,并提供了完整的示例代码,希望对你有帮助。

stm32-demo

一、前置准备

备注
操作系统 Windows 11 25H2
编辑器 Zed
目标芯片 STM32F103C8T6
仿真器 CMSIS-DAP

开始之前请确保你的电脑已经安装了:Rustarm-none-eabi-gcc

1.1 安装 cargo-binutils

rustup component add llvm-tools
cargo install cargo-binutils

1.2 安装 cargo-embed

cargo install probe-rs-tools

1.3 安装 嵌入式编译工具链

rustup target add thumbv7m-none-eabi

二、拉取代码

git clone git@github.com:pcdeng/stm32-demo.git

四、接上调试器

编译并烧录

cargo embed

正常的话,会输出

    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.13s
      Profile default
       Target D:\projects\rust\stm32-demo\target\thumbv7m-none-eabi\debug\stm32demo
      Erasing ⠁   0% [--------------------]
      Erasing ✔ 100% [####################]  28.00 KiB @  11.04 KiB/s (took 3s)
  Programming ✔ 100% [####################]  28.00 KiB @   7.50 KiB/s (took 4s)                                                                                                             Finished in 6.28s
        Done processing config profile default

验证

如果一切正常 PC13指示灯,间隔 1s 闪烁。

参考资料

安装 Rust

安装 arm-none-eabi-gcc

我用的开发板

Discovery

stm32f1xx-hal

Rust嵌入式开发入门 强烈推荐,作者解说得非常详细。

cargo embed 配置参考

上一篇: 基于 GPUI 实现 WebScoket 服务端之服务篇 下一篇: 没有了