Skip to content

Clang's C/C++ compile_commands.json generator for Arduino projects

License

Notifications You must be signed in to change notification settings

Softmotions/acdb

Repository files navigation

Clang's C/C++ compile commands .json generator for Arduino projects

This is a small utility program which generates a compile_commands.json file in your Arduino sketch directory. A compile_commands.json is used by cland language server give you a proper IDE code completion.

Now you can code Arduino projects in vim/neovim editor with CoC or neovim LSP.

Prerequisites

  • The latest arduino-cli tool in your path
  • CMake build tool
  • gcc/clang compiler

Installation

CoC users

Associate .ino files with coc-clangd language server in init.vim

let g:coc_filetype_map = {
  \ 'ino': 'cpp',
  \ }
git clone https://github.com/Softmotions/acdb

mkdir ./acdb/build && cd ./acdb/build

cmake .. -DCMAKE_INSTALL_PREFIX=~/.local

make install

Usage

acdb [options] [sketch directory

	-a, --arduino-cli=<>	Path to the arduino-cli binary.
	-b, --fqbn=<>		Fully Qualified Board Name, e.g.: arduino:avr:uno
	-V, --verbose		Print verbose output.
	-v, --version		Show program version.
	-h, --help		  Print usage help.
cd ./MySketch
acdb --fqbn=arduino:avr:nano:cpu=atmega328old

or

cat ./sketch.json 
{
  "cpu": {
    "fqbn": "arduino:avr:nano:cpu=atmega328old"
  }
}

acdb 

Troubleshooting

Refer to #1

Releases

No releases published

Packages

No packages published