2025-07-15 5:00 AM - last edited on 2025-07-15 5:17 AM by Andrew Neil
Recently I'm trying to setup CLion and STM32CubeMX as I want to switch to a new IDE (By the way, the fact that STM32CubeIDE still doesn't have features like auto-triggered content asist, and that its poor, buggy GUI has bad compatibility with high DPI screen are just annoying). However, when I successfully generate the project in CubeMX and open it in CLion, CLion refuses to compile the project no matter what. I tried the bundled MinGW, CubeCLT1.18 and the older 1.16, and also CLion 2025.1, 2025.1.2, 2025.1.3. All didn't work. Up till this point I've been using CubeMX 6.15, and so I tried to install and use the older version (6.14.0). Everything suddenly works then. The project compiles without problem. Therefore, I suspect that there are some problems in the newest release of CubeMX (6.15) that are generating faulty CMake files.
Here are some screenshots of what happened. I used the same version of CLion and CubeCLT in the same configuration on two projects generated by CubeMX6.15 and 6.14. One compiled and the other didn't. The project created with CubeMX 6.15 cannot build at all and prompts that the compiler is broken.
PS: I've switched back to 6.14.1 for some days and everything is working alright.
Solved! Go to Solution.
2025-07-21 9:10 AM
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
Thanks.
Mahmoud
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-07-15 5:34 AM
Hello @Kairui
First let me thank you for posting and welcome to the ST Community.
Your request is under investigation, and I will get back to you ASAP.
Thanks.
Mahmoud
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-07-16 5:48 AM
I encountered the same issue when using CLion with STM32CubeMX version 6.15, but there was no problem with version 6.14.
[2/34] Building ASM object CMakeFiles/RobotController.dir/startup_stm32h723xx.s.o
FAILED: CMakeFiles/RobotController.dir/startup_stm32h723xx.s.o
/usr/bin/cc -DDEBUG -DSTM32H723xx -DSTM32_THREAD_SAFE_STRATEGY=2 -DUSE_HAL_DRIVER -DUSE_PWR_LDO_SUPPLY -I/home/sw/Downloads/RobotController-master/cmake/stm32cubemx/../../Core/Inc -I/home/sw/Downloads/RobotController-master/cmake/stm32cubemx/../../Drivers/STM32H7xx_HAL_Driver/Inc -I/home/sw/Downloads/RobotController-master/cmake/stm32cubemx/../../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I/home/sw/Downloads/RobotController-master/cmake/stm32cubemx/../../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I/home/sw/Downloads/RobotController-master/cmake/stm32cubemx/../../Drivers/CMSIS/Include -g -MD -MT CMakeFiles/RobotController.dir/startup_stm32h723xx.s.o -MF CMakeFiles/RobotController.dir/startup_stm32h723xx.s.o.d -o CMakeFiles/RobotController.dir/startup_stm32h723xx.s.o -c /home/sw/Downloads/RobotController-master/startup_stm32h723xx.s
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s: Assembler messages:
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:27: 错误: unknown pseudo-op: `.syntax'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:28: 错误: unknown pseudo-op: `.cpu'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:29: 错误: unknown pseudo-op: `.fpu'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:30: 错误: unknown pseudo-op: `.thumb'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:61: 错误: no such instruction: `ldr sp,=_estack'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:64: 错误: no such instruction: `bl ExitRun0Mode'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:66: 错误: no such instruction: `bl SystemInit'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:69: 错误: no such instruction: `ldr r0,=_sdata'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:70: 错误: no such instruction: `ldr r1,=_edata'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:71: 错误: no such instruction: `ldr r2,=_sidata'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:72: 警告: `r3' is not valid here (expected `(%rsi)')
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:72: 错误: expecting operand after ','; got nothing
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:73: 错误: no such instruction: `b LoopCopyDataInit'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:76: 错误: no such instruction: `ldr r4,[r2,r3]'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:77: 错误: missing ']'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:77: 错误: too many memory references for `str'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:78: 错误: expecting operand after ','; got nothing
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:81: 错误: too many memory references for `add'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:82: 错误: operand size mismatch for `cmp'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:83: 错误: no such instruction: `bcc CopyDataInit'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:85: 错误: no such instruction: `ldr r2,=_sbss'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:86: 错误: no such instruction: `ldr r4,=_ebss'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:87: 警告: `r3' is not valid here (expected `(%rsi)')
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:87: 错误: expecting operand after ','; got nothing
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:88: 错误: no such instruction: `b LoopFillZerobss'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:91: 错误: number of operands mismatch for `str'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:92: 错误: expecting operand after ','; got nothing
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:95: 错误: operand size mismatch for `cmp'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:96: 错误: no such instruction: `bcc FillZerobss'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:99: 错误: no such instruction: `bl __libc_init_array'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:101: 错误: no such instruction: `bl main'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:102: 错误: no such instruction: `bx lr'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:115: 错误: no such instruction: `b Infinite_Loop'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:322: 错误: unknown pseudo-op: `.thumb_set'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:325: 错误: unknown pseudo-op: `.thumb_set'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:328: 错误: unknown pseudo-op: `.thumb_set'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:331: 错误: unknown pseudo-op: `.thumb_set'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:334: 错误: unknown pseudo-op: `.thumb_set'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:337: 错误: unknown pseudo-op: `.thumb_set'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:340: 错误: unknown pseudo-op: `.thumb_set'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:343: 错误: unknown pseudo-op: `.thumb_set'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:346: 错误: unknown pseudo-op: `.thumb_set'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:349: 错误: unknown pseudo-op: `.thumb_set'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:352: 错误: unknown pseudo-op: `.thumb_set'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:355: 错误: unknown pseudo-op: `.thumb_set'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:358: 错误: unknown pseudo-op: `.thumb_set'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:361: 错误: unknown pseudo-op: `.thumb_set'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:364: 错误: unknown pseudo-op: `.thumb_set'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:367: 错误: unknown pseudo-op: `.thumb_set'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:370: 错误: unknown pseudo-op: `.thumb_set'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:373: 错误: unknown pseudo-op: `.thumb_set'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:376: 错误: unknown pseudo-op: `.thumb_set'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:379: 错误: unknown pseudo-op: `.thumb_set'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:382: 错误: unknown pseudo-op: `.thumb_set'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:385: 错误: unknown pseudo-op: `.thumb_set'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:388: 错误: unknown pseudo-op: `.thumb_set'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:391: 错误: unknown pseudo-op: `.thumb_set'
/home/sw/Downloads/RobotController-master/startup_stm32h723xx.s:394: 错误: unknown pseudo-op: `.thumb_set'
2025-07-16 7:18 AM
Hello @sunwen ,
For more investigation, I suggest please that you provide your Ioc.File.
Thanks.
Mahmoud
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-07-16 9:28 AM
2025-07-21 9:10 AM
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
Thanks.
Mahmoud
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-07-23 11:41 PM
Thank you so much for the explanation! That resolved my issue and the project compiles now. I've posted about this on JetBrain's CLion forum. I hope that they can perhaps make some updates to their documentation for loading CubeMX projects.
2025-07-25 4:14 AM
Hello,
I'm a CLion developer.
You don’t need to specify any toolchains using the -D switch. Everything is already configured via CMakePresets.json. These presets are automatically imported into CLion as CMake profiles—you can see them in the screenshot. Simply delete the default "Debug" profile and enable the "Debug - Debug" one instead. This process is documented here:
https://www.jetbrains.com/help/clion/embedded-stm32.html#new-project
Starting with version 2025.2 (currently available as a Beta), this setup will be done automatically.
If you have any questions related to CLion and STM32, feel free to reach out to me directly.
2025-07-26 9:51 AM
Wow that's interesting to hear. Thank you so much! (wasn't really expecting a CLion developer to appear under my post) I didn't quite catch that detail in the documentation when I was troubleshooting, but I really look forward to the upcoming 2025.2.
2025-07-27 3:18 AM
You are welcome
Feel free do download 2025.2 Release Candidate and try it right away.
https://www.jetbrains.com/clion/nextversion/