Porting project generated with STM32CubeMX to CMake. The idea is to setup
, build
and flash
the program using only three commands
. Tested on NUCLEO-L476RG.
Good reference on how to writing CMake for cross-platform development can be found here.
- Arm GNU Toolchain
- STM32CubeProgrammer
- CMake
- Ninja
Tools must be in PATH. Or build ready to use Docker image from Dockerfile.
Setup project by calling:
cmake -DCMAKE_TOOLCHAIN_FILE=cmake/arm-none-eabi-gcc.cmake -DCMAKE_BUILD_TYPE=Release -S . -B build -G Ninja
Build project:
ninja -C build
Flash the program:
ninja -C build program
Make sure that Cppcheck 2.13.0
is installed and in PATH, then to check code with Cppcheck call:
ninja -C build cppcheck-check