Sterling
DIIDevHeads IoT Integration Server
•Created by Sterling on 7/14/2024 in #firmware-and-baremetal
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.3 replies