Skip to content

STM32 Microcontroller project integration with Qt Creator.

Notifications You must be signed in to change notification settings

navinreddy23/STM32F446_CMake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

STM32F446_CMake with Qt Creator

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

Build instruction - Command line

create a build directory from the root of this repository and execite the build commmands.

Makefile build - Command line

Generate makefile using: cmake ..

Compile and generate ELF, HEX, and BIN using: make

Ninja build - Command line

Generate ninja build using: cmake -GNinja .. Compile and generate binaries using: ninja

Using Qt Creator to Build and Debug the project.

Step 1:

This project uses CMakeLists, therefore the project can be directly imported into Qt Creator using File -> New FIle or Project -> Git Clone.

alt text

Step 2: Clone this repository and select the QtCompatible branch.

alt text

Step 3: Select the OpenOCD Run and Debugging Kit and click Configure Project.

The configuration for OpenOCD is described in later steps.

alt text

Step 4: The project automatically loads (if CMake is set to Run automatically on changes).

There can be errors due to the toolchain path. In that case, set the toolchain path in the top level CMakeLists.txt manually.

alt text

Step 5: Press Ctrl-B to build the project.

If the build is successful, the binary size is displayed under Compile Output view.

alt text

Step 6: Press Ctrl-R to flash the binary and debug it.

If no breakpoints are set, you should see the main board LED blinking on the NUCLEO-F446RE board.

alt text

OpenOCD Kit Configuration

Step 0: Add Bare-Metal plugin

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.

alt text

Step 1: Add OpenOCD config.

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

alt text

Step 2: Add OpenOCD configuration to the BareMetal list.

alt text

Step 3: Configure the Debugger

alt text

Configure GDB Extended

alt text

Step 4: Add ARM GCC and G++ compiler to the manual configurations.

alt text

Step 5: Add ARM-GDB Python compiler to the manual configuration.

alt text

Step 6: Finally add the OpenOCD Kit and make necessary changes.

alt text

About

STM32 Microcontroller project integration with Qt Creator.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published