beLow - Technical documentation
  • Compatibility
  • Installation guide
    • Installation modes
    • Installation instructions
      • Linux
        • Requirements
        • Installation
      • Windows
        • Requirements
        • Installation
  • Getting started
    • Start beLow
    • Sign up/log in
    • Setup a new project
    • Run an analysis
    • Run an optimization
  • Compatibility guide
    • Compatibility generalities
    • Compatibility specifics
    • CMake
    • Makefiles on Windows
    • STM32CubeIDE on Windows
    • IAR Embedded Workbench for ARM
    • Bazel
    • Custom Docker image
  • FAQ / Troubleshooting
    • FAQ
    • Troubleshooting
Powered by GitBook
On this page
  1. Compatibility guide

STM32CubeIDE on Windows

PreviousMakefiles on WindowsNextIAR Embedded Workbench for ARM

Last updated 1 month ago

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

STM32CubeIDE projects are generating Makefiles that can then be used using the strategy defined in , with a few extra configuration steps.

STM32CubeIDE projects works the following way to compile a project:

  • 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.

This method conflicts with the method used by below-make-intercept to generate a compilation database. Because of this, the below-make-intercept must be run after PATH variable instrumentation, which must be replicated.

To do that, the user must:

  • Generate the Makefiles (using STM32CubeIDE directly, by running at least one build).

  • Find the paths used by STM32CubeIDE for:

    • The make command

    • The compiler invokations

  • Inject these paths

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

This section details how to do that, taking the STM32CubeIDE example project 53L1A2_MultiSensorRanging, targeting NUCLEO-F401RE (Cortex-M4), on Windows.

The project is possible to setup quickly by clicking on File -> New -> STM32 Project.

There, on tab Example selector, select project 53L1A2_MultiSensorRanging for NUCLEO-F401RE.

On the newly imported project, set Release target active.

Then, build the project. This will generate the build files, hence the Makefiles. Then, clean the project to be in a clean state.

Let's now build the project from a terminal instead of STM32CubeIDE. Open Release directory in the system explorer, and then open a PowerShell terminal from Release directory.

Now, the objective is to make the command make all work in this terminal. To do that, we must setup the environment so make command and arm-none-eabi-gcc are recognized.

To find the required environment, in STM32CubeIDE, go to project properties, in C/C++ Build -> Environment and check the content of the PATH variable, so you can identify where the commands are. In general, both are in different directories. On a classical installation of STM32CubeIDE, the directory containing the make command is something like:

C:\ST\STM32CubeIDE_1.18.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.make.win32_2.2.0.202409170845\tools\bin

The directory containing the arm-none-eabi-gcc command is something like:

C:\ST\STM32CubeIDE_1.18.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.win32_1.0.0.202411081344\tools\bin

In the PowerShell terminal, we may now inject these paths and build the project.

$env:PATH="C:\ST\STM32CubeIDE_1.18.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.make.win32_2.2.0.202409170845\tools\bin;C:\ST\STM32CubeIDE_1.18.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.win32_1.0.0.202411081344\tools\bin;$env:PATH"
make all

The best thing to do here is to create a PowerShell script with the following content:

generate-cdb.ps1
$env:PATH="C:\ST\STM32CubeIDE_1.18.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.make.win32_2.2.0.202409170845\tools\bin;C:\ST\STM32CubeIDE_1.18.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.win32_1.0.0.202411081344\tools\bin;$env:PATH"
make clean
below-make-intercept "make all" | Out-File -Encoding ASCII -FilePath .\compile_commands.json

Now, calling this script directly in the Configure script in beLow will generate the required compilation database.

If you don't wish to modify your global environment, you may also create a clean and a build script.

clean.ps1
$env:PATH="C:\ST\STM32CubeIDE_1.18.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.make.win32_2.2.0.202409170845\tools\bin;C:\ST\STM32CubeIDE_1.18.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.win32_1.0.0.202411081344\tools\bin;$env:PATH"
make clean
build.ps1
$env:PATH="C:\ST\STM32CubeIDE_1.18.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.make.win32_2.2.0.202409170845\tools\bin;C:\ST\STM32CubeIDE_1.18.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.win32_1.0.0.202411081344\tools\bin;$env:PATH"
make all

Therefore, the typical commands setup in beLow would be the following ones.

For Configure section, enter:

  • Script content:

.\generate-cdb.ps1
  • Script execution path: In the target directory

  • Shell: Pwsh

For Clean section, enter:

  • Script content:

.\clean.ps1
  • Script execution path: In the target directory

  • Shell: Pwsh

For Build section, enter:

  • Script content:

.\build.ps1
  • Script execution path: In the target directory

  • Shell: Pwsh

The project compiles! Now, from the same terminal, we can generate a compilation database by using below-make-intercept tool, as descripted in .

Makefiles compatibility section
the previous section
Project selection in STM32CubeIDE
Set Release target active
Open Release folder
Open a terminal