The Recent STM32CubeMX 6.15 Update Causes Compile Failure in CLion (Solution Included): Update in Documentation is Advised

Completed

Recently, I was trying to use STM32CubeMX 6.15 with CLion, and things just couldn't compile (prompts compiler broken). I switched to 6.14 and things worked. I asked about this issue on ST Forum, and received a solution from their employee. Here's his response:

 

The root cause of the issue is related to how the toolchain file was specified in previous MX versions.

Previously, the toolchain file was defined in two locations: CMakePresets.cmake and CMakeLists.txt.

Starting with version 6.15, the specification in CMakeLists.txt has been removed, and it is now retained only in CMakePresets.cmake. This change was made to eliminate redundancy and to simplify switching between GCC and starm-clang .

To be able to build the 6.15 projects with Clion we need to specify the toolchain file in the Clion project:

- Go to menu File -> Settings -> Build, Execution, Deployment -> CMake

- In “CMake options” field , we need to add the toolchain file variable for GCC :

     -DCMAKE_TOOLCHAIN_FILE=./cmake/gcc-arm-none-eabi.cmake

Note: To use starm-clng instead of gcc, you need to add : -DCMAKE_TOOLCHAIN_FILE=./cmake/starm-clang.cmake

 

Original Post: https://community.st.com/t5/stm32cubemx-mcus/cmake-project-generated-by-stm32cubemx-6-15-build-fails-says/td-p/822414

The problem has been resolved, but it means that the official CLion documentation for CubeMX Projects no longer fits with the newest software ( https://www.jetbrains.com/help/clion/embedded-stm32.html ). Please review this and consider updating the documentation. Will really help the newcomers like me.

0

Please sign in to leave a comment.