Skip to content

Instantly share code, notes, and snippets.

@bodokaiser
Last active March 27, 2022 08:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bodokaiser/6096894ac5317cb0be80919d67ec617c to your computer and use it in GitHub Desktop.
Save bodokaiser/6096894ac5317cb0be80919d67ec617c to your computer and use it in GitHub Desktop.

How to flash the STM32 "blue pill" on macOS Mojave (arm64)

Valid as of March 27th 2022

OpenOCD debugger

Install the latest openocd version (the official version produces a segmentation fault)

brew install openocd --head

and append set CPUTAPID 0 to /opt/homebrew/share/openocd/scripts/board/stm32f103c8_blue_pill.cfg.

Run OpenOCD server

openocd -f interface/stlink.cfg -f board/stm32f103c8_blue_pill.cfg

Rust

Install the cross-compilation toolchan:

brew install gcc-arm-embedded

Install rustup (the homebrew version is from 2021)

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

and add cross-compilation target

rustup target add thumbv7m-none-eabi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment