5

I am on the quest of creating a compile_commands.json database from my IAR .ewp project. This would allow me to use intelligent LSP autocompletion (ccls) and proper semantic highlighting (vim-lsp-cxx-highlight) from my vim setup.

I understand that I could manually create a CMake file with the same setup as in the .ewp project file, but unfortunately all my co-workers use the IAR IDE. I would risk missing some important project setup changes made by my co-workers and me failing to update the .ewp. It'd be great if I could automatically parse the .ewp file to CMake, and hence create the commands database.

Anybody knows of a clever way of doing this? If not, how would I go creating a tool that does exactly that? It appears that by undefining the Clang compiler defines one could make ccls use of the IAR code-base at full strenght.

davidanderle
  • 638
  • 6
  • 12
  • Oh yes, me too... The thing is, the backend of IAR is extremelly powerful, but the IDE... I think it was put together solely by engineers, not product designers. It's control is not intuitive at all, and it looks awful. Been trying to move away from it for a while, but the truth is it can do sooo much – davidanderle Jul 03 '20 at 09:19
  • I'm developing under Simplicity studio and have the same complaint about that IDE. The software stack I'm using does too much magic (macro expansion etc.) and the IDE can't index all the symbols. I switched from the IAR compiler to the unsupported GNU compiler just for `make all -n` to generate the `compile_commands.json` with `compiledb`. I had to write a script manually to fix the `compile_commands.json` for various things but at least I got all the translation units with most of the include paths for the indexer in VSCode but it's not perfect and I am still resolving index errors – pterodragon Oct 14 '21 at 12:24

1 Answers1

2

Use -jsondb option in IAR

> iarbuild.exe example.ewp -jsondb debug -output compile_commands.json
Eric Sun
  • 777
  • 6
  • 20
  • 1
    Sick! When I wrote this post I contacted IAR about LSP and they said they will look into it. It appears that IAR 9.2 (EWARM) released on 04/11/2021 now supports it! The UI has now proper linting and autocompletion – davidanderle Nov 11 '21 at 10:37
  • 1
    Seems IAR is doing a low key support, even not informing the issue reporter:P Today I am searching for ways to use YCM for IAR project and google direct me to your post. However, I find YCM still not working with the IAR generated json, I have started [another post](https://stackoverflow.com/questions/69926640/use-youcompleteme-with-iar-project) on this – Eric Sun Nov 11 '21 at 14:12
  • I'll keep myself updated on that post as I've not managed to integrate it completely to ccls (although I've not put enough effort in it yet!) – davidanderle Nov 11 '21 at 14:17