Resolving stdio.h and FPU Instruction Errors in STM32F103 Project with clangd and Neovim
@Middleware & OS
I have an STM32F103 project initialized with STM32CubeMX. For editing, I use Neovim, and I compile the code with arm-none-eabi-gcc using an auto-generated Makefile.
I've installed clangd LSP and Bear to generate the compile_commands.json file. Everything works fine except for two errors:
1.
stdio.h
file not found.
2. Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT
).
In the core_cm3.h file, __FPU_USED
is disabled, which aligns with clang's indication:
I couldn't find any line in my Makefile flags that enables the FPU for compilation. Here are the relevant sections:
I commented out $(FPU)
and $(FLOAT-ABI)
, but the error persists. The project compiles without issues since GCC doesn't complain, but these errors are annoying.
Is there a way to fix these errors? Or are there any GCC-based LSPs to use instead of clangd?
I've noticed that ccls is on Neovim's LSP list, but I couldn't install it successfully.2 Replies
@Sterling For
stdio.h
not found, add the ARM toolchain include path to compile_commands.json
:
For FPU instructions, ensure the target CPU is specified:
Update your Makefile:
Alternatively, try installing ccls as an LSP:
Then configure Neovim to use ccls.Hmmm, nicee. 🙂
So I will simply update
compile_commands.json
and the Makefile. If issues persist, I'll try ccls. Thanks @Dtynin