/stm32-cmake-static-analysis-docker-and-ci

Porting project generated with STM32CubeMX to CMake. Docker image with toolchain and tooling. With GitHub Actions CI.

Primary LanguageC

STM32 + CMake + Docker + CI

.github/workflows/ci-pipeline.yml

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.

Requirements

Tools must be in PATH. Or build ready to use Docker image from Dockerfile.

Setup, building and programming

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

Static analysis

Make sure that Cppcheck 2.13.0 is installed and in PATH, then to check code with Cppcheck call:

ninja -C build cppcheck-check