STM32CubeIDE on Windows

Though the methods on this page work on both Linux and Windows, on Linux you may rely on the integrated Bear process to generate the compilation database and therefore use your usual build process flawlessly.

STM32CubeIDE projects generate Makefiles that can then be used using the strategy defined in https://docs.wedolow.com/below-technical-documentation/compatibility-guide/makefiles-on-windows, with a few extra configuration steps.

1

How STM32CubeIDE builds a project

STM32CubeIDE compiles a project by performing the following sequence:

  • Generation of Makefiles

  • Instrumentation of the PATH variable to make use of the right tools (make command, compiler, linker, etc)

  • Execution of the make command

2

Why this affects below-make-intercept

The PATH instrumentation used by STM32CubeIDE conflicts with the method used by below-make-intercept to generate a compilation database. Therefore below-make-intercept must be run after PATH variable instrumentation — you must replicate that instrumentation in your terminal/script before invoking below-make-intercept.

3

Overview of the procedure

To generate a compilation database for an STM32CubeIDE project on Windows:

  • Generate the Makefiles by building the project at least once in STM32CubeIDE.

  • Find the tool paths STM32CubeIDE adds to PATH (make and compiler invocations).

  • Inject those paths into your terminal environment.

  • Call below-make-intercept on the make command.

This section details how to perform these steps using the example project 53L1A2_MultiSensorRanging (target: NUCLEO-F401RE, Cortex-M4).

Project import tip: File -> New -> STM32 Project, then in Example selector choose 53L1A2_MultiSensorRanging for NUCLEO-F401RE.

Project selection in STM32CubeIDE

Set the Release target active and build the project once (this generates the Makefiles). Then clean the project in STM32CubeIDE to start from a clean state.

Set Release target active

Open the Release directory in File Explorer and open a PowerShell terminal there.

Open Release folder
Open a terminal

The objective is to make make all work in this terminal. You must set up PATH so that make and arm-none-eabi-gcc are recognized.

In STM32CubeIDE: Project properties -> C/C++ Build -> Environment — inspect the PATH variable to identify the added directories. Typically:

  • Directory containing the make command (example):

example make path (Windows)
  • Directory containing the arm-none-eabi-gcc command (example):

example compiler path (Windows)

In the PowerShell terminal, inject these paths into PATH and build:

PowerShell — inject PATH and build

If PATH is set correctly, the project compiles.

From the same terminal you can generate a compilation database using below-make-intercept (see the previous section https://docs.wedolow.com/below-technical-documentation/compatibility-guide/makefiles-on-windows).

A convenient approach is to create a PowerShell script that both injects PATH and runs below-make-intercept.

generate-cdb.ps1

generate-cdb.ps1

You can also split clean and build into separate scripts so you do not modify the global environment.

clean.ps1

clean.ps1

build.ps1

build.ps1

Suggested beLow commands configuration

Configure

  • Script content:

  • Script execution path: In the target directory

  • Shell: Pwsh

Clean

  • Script content:

  • Script execution path: In the target directory

  • Shell: Pwsh

Build

  • Script content:

- Script execution path: In the target directory - Shell: Pwsh

Last updated 6 months ago