2025-07-31 4:47 AM
Hi!
I have set up a project for the STM32H523RET6 using the following setup:
CubeMX: 6.15.0
STM32 vscode extension: 3.5.1
The project is configured to use starm-clang and starm-clang++ and the STARM_PICOLIBC toolchain
I have created a .cpp file () that i added to my build and updated my CMakeLists.txt with the following:
# Setup compiler settings
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON)
...
enable_language(C CXX ASM)
...
# Add sources to executable
target_sources(${CMAKE_PROJECT_NAME} PRIVATE
Core/Src/myclass.cpp
# Add user sources here
)
When building the project, it compiles fine, but clangd reports the following problem:
nsupported option '-mcpu=' for target 'x86_64-pc-windows-msvc'clang(drv_unsupported_opt_for_target)
Unsupported option '-mfpu=' for target 'x86_64-pc-windows-msvc'clang(drv_unsupported_opt_for_target)
Unsupported option '-mfloat-abi=' for target 'x86_64-pc-windows-msvc'clang(drv_unsupported_opt_for_target)
Is this a known issue?
For reference (or anyone having a similar issue) i managed to temporarily fix the issue by explicitly setting the target for clangd by changing the .clangd file from
CompileFlags:
Add:
- '-ferror-limit=0'
- '-Wno-implicit-int'
CompilationDatabase: build/Debug
Diagnostics:
Suppress:
- unused-includes
- unknown_typename
- unknown_typename_suggest
- typename_requires_specqual
to
CompileFlags:
Add:
- '-ferror-limit=0'
- '-Wno-implicit-int'
- '-target'
- 'thumbv8m.main-st-none-eabihf'
- '-mfpu=fpv4-sp-d16'
- '-fno-exceptions'
- '-fno-rtti'
CompilationDatabase: build/Debug
Diagnostics:
Suppress:
- unused-includes
- unknown_typename
- unknown_typename_suggest
- typename_requires_specqual
2025-07-31 5:07 AM
@jostlowe sounds weird.
I've very same usage than you (STM32CubeMX project, ST ARM clang compiler & picolib usage) and works like a charm.
Are you pointing to right compilation database serving clangd ?
Have a look to:
2025-07-31 5:12 AM
Thanks for the quick response :)
Checking that it point to the correct compilation database in the way you suggest i get the following:
I[14:07:40.019] Loaded compilation database from c:\my\path\project_folder\build\Debug\compile_commands.json
2025-07-31 7:56 AM
Ok ... and what if looking for 'clangd.exe' as part of filter of the very same output channel ?
Are you getting in real something like '<local path>\st-arm-clangd\19.1.2+st.3\bin\st-arm-clangd.exe' ?
Asking because you have to rely on ARM embedded LLVM utilities not PC ones.
2025-07-31 11:55 PM
C:\Users\<username>\AppData\Local\stm32cube\bundles\st-arm-clangd\19.1.2+st.3\bin\starm-clangd.exe
Did what you suggested: Seems to be using the right utilities?