Need Help Configuring CLion for STM32 Development on macOS
Hi everyone,
I’m new to STM32 development and need some assistance in configuring CLion to work with STM32 microcontrollers.
Here’s my current setup:
STM32CubeMX: Version 6.13.0 (latest at the time of writing)
STM32CubeCLT: Version 1.17.0 (installed specifically to use the ARM toolchains it provides)
CLion: Version 2024.3.1.1 (latest at the time of writing)
macOS: Sequoia (on MacBook Pro M3), Version 15.2 (latest at the time of writing)
Problem 1: STM32CubeMX Error
When I try to create a new project in CLion using STM32CubeMX (New Project -> STM32CubeMX) and click Create, I encounter the following error:
The Eclipse executable launcher was unable to locate its companion shared library.
I’ve ensured that all my tools are installed and up to date, but I don’t understand what might be causing this issue or how I can resolve it. Any help would be appreciated!
Problem 2: ARM Toolchain Configuration and Build Failure
I specifically installed STM32CubeCLT to use the ARM toolchains provided by STMicroelectronics. I configured the following build settings in CLion:
CMake: /opt/ST/STM32CubeCLT_1.17.0/CMake/bin/cmake (Version 3.28.1)
Build Tool: /opt/ST/STM32CubeCLT_1.17.0/Ninja/bin/ninja
C Compiler: /opt/ST/STM32CubeCLT_1.17.0/GNU-tools-for-STM32/bin/arm-none-eabi-gcc
C++ Compiler: /opt/ST/STM32CubeCLT_1.17.0/GNU-tools-for-STM32/bin/arm-none-eabi-g++
Debugger: /opt/ST/STM32CubeCLT_1.17.0/STLink-gdb-server/bin/ST-LINK_gdbserver
Unfortunately, in the CLion toolchain settings, I receive the following errors:
C++ Compiler Test: Displays a warning: “Test CMake run finished with errors.”
I receive the following error trace:
-- The C compiler identification is GNU 12.3.1
-- The CXX compiler identification is GNU 12.3.1
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - no
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /opt/ST/STM32CubeCLT_1.17.0/GNU-tools-for-STM32/bin/arm-none-eabi-gcc
-- Check for working C compiler: /opt/ST/STM32CubeCLT_1.17.0/GNU-tools-for-STM32/bin/arm-none-eabi-gcc - broken
CMake Error at /opt/ST/STM32CubeCLT_1.17.0/CMake/share/cmake-3.28/Modules/CMakeTestCCompiler.cmake:67 (message):
The C compiler
"/opt/ST/STM32CubeCLT_1.17.0/GNU-tools-for-STM32/bin/arm-none-eabi-gcc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: '/private/var/folders/qk/kpk9_nkj34987dyl3hj74l2w0000gn/T/cmake_check_environment/_build13433262515835532785/CMakeFiles/CMakeScratch/TryCompile-ICGS0P'
Run Build Command(s): /opt/ST/STM32CubeCLT_1.17.0/Ninja/bin/ninja -v cmTC_20766
[1/2] /opt/ST/STM32CubeCLT_1.17.0/GNU-tools-for-STM32/bin/arm-none-eabi-gcc -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.2.sdk -fdiagnostics-color=always -o CMakeFiles/cmTC_20766.dir/testCCompiler.c.o -c /private/var/folders/qk/kpk9_nkj34987dyl3hj74l2w0000gn/T/cmake_check_environment/_build13433262515835532785/CMakeFiles/CMakeScratch/TryCompile-ICGS0P/testCCompiler.c
FAILED: CMakeFiles/cmTC_20766.dir/testCCompiler.c.o
/opt/ST/STM32CubeCLT_1.17.0/GNU-tools-for-STM32/bin/arm-none-eabi-gcc -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.2.sdk -fdiagnostics-color=always -o CMakeFiles/cmTC_20766.dir/testCCompiler.c.o -c /private/var/folders/qk/kpk9_nkj34987dyl3hj74l2w0000gn/T/cmake_check_environment/_build13433262515835532785/CMakeFiles/CMakeScratch/TryCompile-ICGS0P/testCCompiler.c
arm-none-eabi-gcc: error: unrecognized command-line option '-arch'; did you mean '-march='?
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
-- Configuring incomplete, errors occurred!
Error code: 1
Could anyone help me properly configure the ARM toolchain or guide me on how to resolve this error? Any advice or suggestions would be greatly appreciated!
Thank you in advance!
Please sign in to leave a comment.