Skip to main content
MaxC
Associate II
Solved

CMake error when building STM32 project outside STM32CubeIde

Hello everybody,

I'm trying to build an STM32 simple example based on CMake from the Windows shell but I got an error (I think because CMake doesn't find the GCC STM32CubeIde toolchain configuration).

If I run CMake from STM32CubeIde all works fine (I think because "the location of the toolchain is resolved by the "MCU Toolchain" project setting (via PATH)" as stated by the cubeide-gcc.cmake file).

I'm using STM32CubeIDe v 1.14.1

I started from the example shown in AN5952 doc.

I'm just wondering what is the additional option I have to set to build the example in Windows but outside the STM32CubeIde.

I attached a snapshot of the error. 

 

Thanks

This topic has been closed for replies.
MaxC
MaxCBest answer
Associate II

I added the path of STM32CubeIde Gnu and Make tools in the Windows PATH env variable. 

ex (for STM32CubeIde ver 1.14.1)

set PATH=C:\ST\STM32CubeIDE_1.14.1\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.win32_1.1.100.202309141235\tools\bin;%PATH%

set PATH=C:\ST\STM32CubeIDE_1.14.1\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.make.win32_2.1.101.202401061624\tools\bin;%PATH%

 

4 replies

MaxC
MaxCAuthor
Associate II

Ok, I found a solution.

Andrew Neil
Super User

For the benefit of others with the same problem who may find this, please describe your solution.

And Mark that as The Solution.

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
mattias norlander
ST Technical Moderator

Yes, you would need to setup the paths yourself. It is normally considered bad practice to have development tools contribute paths to the system PATH variable since that could mess with other existing build infrastructure on the customers PC. This is why we contain that "path management" within the CubeIDE environment.

In the VS Code based IDE, we cannot take that approach since we (ST) do not control the CMake extensions from Microsoft. Consequently we currently let the STM32CubeCLT package add paths for CMake and GCC (and some other tools) to the OS PATH variable.

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.