Using STM32CubeMX project wizard inside Code::Blocks

Sun, Aug 26, 2018

The STM32CubeMX tool allows to generate wide variety of projects for STM32 microcontrollers. Here we are introducing how to use it in conjunction with Code::Blocks IDE. To get connected the STM32CubeMX and Code::Blocks IDE we need to install plugin stm32cubemx.cbplugin file first and naturally the STM32CubeMX tool. The STM32CubeMX can accept additional software packs which widens potential project selection options. After all software components had been setup we are ready to create our first project.

Code::Blocks launch of new project wizard

Among possible project wizards select Stm32CubeMx one.

Code::Blocks Stm32CubeMx wizard selection

The wizard launches the Stm32CubeMx tool. Steps for project creation here are described only briefly. For additional question refer to STM32CubeMx manual.

STM32CubeMX launched

After clicking New project caption the microcontroller selection appears.

STM32CubeMX selection of desired microcontroller

When all requested project content setup work had been made we need to give title for our project and select the toolchain SW4STM32 for the project. Do not select other toolchain types while they are not recognized.

STM32CubeMX project settings

Now we are ready to generate some source code and project contents

STM32CubeMX generate project

When project generate is done select Close action in subsequent query.

Do not perform any additional action after project had been generated

Now the execution control is returned into Code::Blocks and continues with conversion from SW4STM32 project format to Code::Blocks project. Since compiler toolchain names in Eclipse and Code::Blocks has different names the compiler toolchain need to be chosen manually. Wrong selection can be adjusted any times later.

Select proper compiler toochain

We need also to select desired set of available build configurations

Avaialable build configurations

At this point the project import work is done and source files are visible in projects tree view. The import task also added some tool configuration options accessible through Build options …

Code::Blocks project imported from STM32CubeMX wizard

The project after build inside Code::Blocks given following results

Code::Blocks project build outcome

Now we can make manage the project further using STM32CubeMX or add additional files by hand

Further project management using STM32CubeMX