2024-11-18 10:14 AM
I just switched back to a different client project, one that is built in the STM32 VSCode extension. This was after working on a different project with STM32CubeIDE and updating it to the latest version (1.16.1).
Unfortunately, when I try to compile the VSCode-based project, it does not compile. The build task starts up but then reports the discovered compiler cannot build a simple test program.
Here is the contents of the terminal window:
Executing task: Build
build task started....
C:\ST\STM32CubeCLT_1.15.0\CMake\bin\cmake.EXE --build D:/DataRoot/Projects/Equla/_Vert2-Firmware/STM32/Vert2-STM32/build/debug/build --
[0/1] Re-running CMake...
-- Found multiple STM32CubeIDE installations. Using "C:/ST/STM32CubeIDE_1.11.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.0.100.202403111256/tools/bin".
-- The C compiler identification is GNU 12.3.1
-- The CXX compiler identification is GNU 12.3.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/ST/STM32CubeIDE_1.11.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.0.100.202403111256/tools/bin/arm-none-eabi-gcc.exe
-- Check for working C compiler: C:/ST/STM32CubeIDE_1.11.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.0.100.202403111256/tools/bin/arm-none-eabi-gcc.exe - broken
CMake Error at C:/ST/STM32CubeCLT_1.15.0/CMake/share/cmake-3.28/Modules/CMakeTestCCompiler.cmake:67 (message):
The C compiler
"C:/ST/STM32CubeIDE_1.11.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.0.100.202403111256/tools/bin/arm-none-eabi-gcc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: 'D:/DataRoot/Projects/Equla/_Vert2-Firmware/STM32/Vert2-STM32/build/debug/build/CMakeFiles/CMakeScratch/TryCompile-ihvrsw'
Run Build Command(s): C:/msys64/ucrt64/bin/ninja.exe -v cmTC_0427c
[1/2] C:\ST\STM32CubeIDE_1.11.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.0.100.202403111256\tools\bin\arm-none-eabi-gcc.exe -fdata-sections -ffunction-sections --specs=nano.specs -Wl,--gc-sections -o CMakeFiles/cmTC_0427c.dir/testCCompiler.c.obj -c D:/DataRoot/Projects/Equla/_Vert2-Firmware/STM32/Vert2-STM32/build/debug/build/CMakeFiles/CMakeScratch/TryCompile-ihvrsw/testCCompiler.c
[2/2] C:\WINDOWS\system32\cmd.exe /C "cd . && C:\ST\STM32CubeCLT_1.15.0\CMake\bin\cmake.exe -E rm -f libcmTC_0427c.a && C:\ST\STM32CubeIDE_1.11.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.win32_1.1.100.202309141235\tools\bin\arm-none-eabi-ar.exe qc libcmTC_0427c.a CMakeFiles/cmTC_0427c.dir/testCCompiler.c.obj && C:\ST\STM32CubeIDE_1.11.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.win32_1.1.100.202309141235\tools\bin\arm-none-eabi-ranlib.exe libcmTC_0427c.a && cd ."
FAILED: libcmTC_0427c.a
C:\WINDOWS\system32\cmd.exe /C "cd . && C:\ST\STM32CubeCLT_1.15.0\CMake\bin\cmake.exe -E rm -f libcmTC_0427c.a && C:\ST\STM32CubeIDE_1.11.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.win32_1.1.100.202309141235\tools\bin\arm-none-eabi-ar.exe qc libcmTC_0427c.a CMakeFiles/cmTC_0427c.dir/testCCompiler.c.obj && C:\ST\STM32CubeIDE_1.11.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.win32_1.1.100.202309141235\tools\bin\arm-none-eabi-ranlib.exe libcmTC_0427c.a && cd ."
The system cannot find the path specified.
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:3 (project)
-- Configuring incomplete, errors occurred!
ninja: error: rebuilding 'build.ninja': subcommand failed
FAILED: build.ninja
C:\ST\STM32CubeCLT_1.15.0\CMake\bin\cmake.exe --regenerate-during-build -SD:\DataRoot\Projects\Equla\_Vert2-Firmware\STM32\Vert2-STM32 -BD:\DataRoot\Projects\Equla\_Vert2-Firmware\STM32\Vert2-STM32\build\debug\build
build finished with error(s).
* The terminal process terminated with exit code: 1.
Sid
2024-12-16 08:04 AM
It looks like the issue is related to the compiler configuration in your VSCode project. The error message indicates that the compiler cannot compile a simple test program, which usually points to a misconfiguration or an incorrect path to the compiler tools.
Here are some steps to troubleshoot and resolve the issue:
Ensure that the path to the compiler tools is correctly set in your VSCode project settings. It seems like the project is trying to use a specific version of the GNU ARM toolchain from the STM32CubeIDE installation. Verify that the path is correct and that the tools are accessible.
Ensure that your CMake configuration is correctly set up to use the right compiler. You might need to specify the path to the compiler explicitly in your CMakeLists.txt
or in the CMake configuration files.
Ensure that the necessary environment variables are set correctly. You might need to add the path to the GNU ARM toolchain to your system's PATH environment variable.
Try cleaning the build directory and rebuilding the project from scratch. Sometimes, stale build files can cause issues.
The error message indicates that multiple STM32CubeIDE installations were found. Ensure that the correct version is being used and that there are no conflicts between different versions of the toolchain.
You can explicitly set the compiler path in your CMakeLists.txt
file:
set(CMAKE_C_COMPILER "C:/path/to/arm-none-eabi-gcc.exe")
set(CMAKE_CXX_COMPILER "C:/path/to/arm-none-eabi-g++.exe")
Ensure that the environment variables are set correctly. You can add the following to your .vscode/settings.json
file:
json
{
"cmake.environment": {
"PATH": "C:/path/to/gnu-tools-for-stm32/bin;${env:PATH}"
}
}
You can clean the build directory and rebuild the project by running the following commands in the terminal:
sh
rm -rf build
mkdir build
cd build
cmake ..
cmake --build .
Ensure that the path to the GNU ARM toolchain is included in your system's PATH environment variable. You can do this by adding the following line to your .bashrc
, .zshrc
, or .profile
file (depending on your shell):
export PATH="/path/to/gnu-tools-for-stm32/bin:$PATH"
By following these steps, you should be able to resolve the issue and successfully compile your VSCode-based STM32 project. If the problem persists, please provide more details about your project configuration and any additional error messages.