Quantcast
Channel: 懒得折腾
Viewing all articles
Browse latest Browse all 764

Rust on STM32F103 Blue Pill with Probe-run tooling

$
0
0

quick start

circuit4u

circuit4uDec 5, 2020·2 min read

Image for post

Rust embedded software tooling is always an interesting alternative to MCU vendor specific IDE software, such as those provided by TI, Microchip, STM32, Nordic, etc.

With the advent of probe-rs and subsequently probe-run software, Rust for embedded coding can take a different path from openocd + gdb, and it is getting more convenient.

There are already lots of cortex-m quick-start guides, especially of STM32F103 “Blue Pill”. Unfortunately, Rust library such as stm32f1xx_hal is changing fast. For example, the Timer now is initiated differently from the past.

Here is my latest try get it up and running:

  1. get hardware: STM32F103C8T6 module + ST-link (v2) debugger
  2. setup software: follow this link or stm32f1xx_hal (link) and use cargo install probe-run (link) instead of cargo install cargo-flash

3. git clone the source code from this repository: https://cgit.pinealservo.com/BluePill_Rust/blue_pill_base

change runner in .cargo/config to

runner = "probe-run --chip stm32f103c8"

4. In a terminal window, type

cargo run --bin blue_pill_base --release

That’s it. You should now see LED flashing and debugging message in the terminal window.

Useful References

STM32 Blue Pill pinout diagram (link)

Old way with openocd + gdb (link)

New way with probe-run (link)

Rust embedded GPIO model (link)

Rust software/hardware notes (link)


Viewing all articles
Browse latest Browse all 764

Trending Articles