This repository is created to experiment with CMake and STM32F4 microcontroller. This project describes the steps needed to integrate a microcontroller project with Qt Creator.
If Qt Creator is your favourite IDE for editing the code, why not use it for debugging!
STM32Cube Package is used for generating the HAL and CMSIS libraries: https://www.st.com/en/embedded-software/stm32cube-mcu-mpu-packages.html
create a build directory from the root of this repository and execite the build commmands.
Generate makefile using:
cmake ..
Compile and generate ELF, HEX, and BIN using:
make
Generate ninja build using:
cmake -GNinja ..
Compile and generate binaries using:
ninja
This project uses CMakeLists, therefore the project can be directly imported into Qt Creator using File -> New FIle or Project -> Git Clone.
The configuration for OpenOCD is described in later steps.
There can be errors due to the toolchain path. In that case, set the toolchain path in the top level CMakeLists.txt manually.
If the build is successful, the binary size is displayed under Compile Output view.
If no breakpoints are set, you should see the main board LED blinking on the NUCLEO-F446RE board.
If the bare-metal plugin was not installed, then it needs to be installed first. Go to Help -> About Plugins -> Device Support. Check and install BareMetal plugin. Requires restart of Qt Creator to get it working.
Click on Add button and make necessary configurations for your device. In this project ST-LINK V2-1 is used with STM32F4x Microcontroller.
The OpenOCD configuration is openocd -f /usr/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/share/openocd/scripts/target/stm32f4x.cfg
.
The additional arguments field contains: -f /usr/share/openocd/scripts/target/stm32f4x.cfg