Generic just recipes for building, flashing,
erasing, and resetting STM32 firmware projects that use CMake presets and the
toolchain/programmer bundled with the STM32Cube VS Code
extension.
It's meant to be imported into an STM32 project's own
justfile - see Usage.
justinstalled and onPATH- The STM32Cube VS Code extension installed, which provides:
- the
gnu-tools-for-stm32GCC toolchain - the
STM32_Programmer_CLItool and an ST-LINK probe
- the
- A CMake project configured with presets (
CMakePresets.json) named e.g.Debug/Release
Import justfile from your project's own
justfile:
project := "my-firmware"
import "path/to/stm32-just/justfile"The project variable must name your CMake target/output (i.e. the build
produces build/<preset>/<project>.elf).
| Recipe | Description |
|---|---|
just configure [preset] |
Configure the CMake preset (default: Debug) |
just build [preset] |
Build the firmware, configuring first if needed |
just clean [preset] |
Delete a preset's build directory |
just rebuild [preset] |
Clean, then build |
just flash [preset] |
Build, flash over SWD, and reset the target |
just erase |
Mass-erase the flash |
just reset |
Reset the target |
just size [preset] |
Print ELF section sizes |
just bin [preset] |
Produce a raw .bin next to the ELF |
just hex [preset] |
Produce an Intel .hex next to the ELF |
preset defaults to Debug. Override the default globally with the
STM32_DEFAULT_PRESET environment variable, e.g.:
STM32_DEFAULT_PRESET=Release just flashor per invocation:
just flash Release