I’m working on an embedded project that runs on an Infineon TriCore MCU. The certified TriCore‑GCC and its binary libraries are Windows‑only, but I do most work on Linux.
To get quick syntax checks and unit‑tests locally I compile application‑only sources with the host GCC using CMock to generate mocks so the test build doesn’t need the vendor libraries.
This gives me a compile_commands.json, but every entry looks like this (shortened):
{
"file": "core1/src/main.c",
"directory": ".../build/tests/core1",
"command": "/usr/bin/cc -DTESTING \
-Icore1/src \
-Itests/mocks <‑‑ generated mocks
-Itests/mocks/core1/libs/
-Itests/mocks/..."
}
clangd indexes the mock headers instead of the actual library headers. Jump‑to‑definition ends up in mock/xy.h instead of core1/xy.h.
Right now the only option I see is having a top-level .clangd file that defines the includes for each core using path matching, but this wouldn't allow clangd to index the code base if I am not mistaken.
Maybe someone has a better idea.
Thanks for the input!