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

6 阅读1分钟

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

四、接上调试器

link.jpeg

编译并烧录

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 闪烁。

O1CN01St9p131GLb40V8p7Y_!!2407100606.jpg

参考资料

安装 Rust

安装 arm-none-eabi-gcc

我用的开发板

Discovery

stm32f1xx-hal

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

cargo embed 配置参考