Skip to content

Ready-to-use cmake project example for affordable stm32 board

Notifications You must be signed in to change notification settings

donghoonpark/blackpill-stm32-cmake

Repository files navigation

Black Pill CMake Example Project

No ST tool required. Glory to Opensource!

This repository is a guide to landing STM32 chip development. Let's get started stm32 project just like arduino.

Target Board

Hands on black pill board : STM32F401 (<4$)

Black Pill

You can use ST-Link v2 copy (<2$)

Environment setup

Highly recommend to use package manager to set-up environment.

Windows

With regard to windows, We'll use scoop.

  • Install scoop with the instruction
  • Add packages required
scoop bucket add extras
scoop install main/cmake main/openocd main/ninja extras/gcc-arm-none-eabi # if you have no git, install main/git as well

Ubuntu

Unfortunately, gcc-arm-none-eabi(embedded) is not available in apt package manager from focal. So we use nix package manager as alternative. If you have any other package manager you prefer, do not hesitate to use it :)

  • Install nix with the instruction
  • Add packages required
nix-env -iA nixpkgs.cmake nixpkgs.openocd nixpkgs.ninja nixpkgs.gcc-arm-embedded

Mac OS

Mac have all with brew. Cheers! 🍻

brew install cmake openocd ninja gcc-arm-embedded #if you have no git, add it

Build & Debug

VScode

You can use vscode with extensions (recommended!)

Just hit the F5 for launch. and, that's it.

Command line

If you hate vscode, just compile it as you always do with cmake.

git clone https://github.com/DongHoonPark/blackpill-stm32-cmake
cd blackpill-stm32-cmake
# If you use vscode & cmake plugin, the procedure below can be done in vscode
mkdir build 
cd build
cmake .. -G Ninja
cmake --build . --target stm32-blackpill

After then, you can use .elf file to utilize openocd debugger

About

Ready-to-use cmake project example for affordable stm32 board

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published