Developing a custom board package with libraries not detected.

For the past few weeks I have been working on developing a custom board package for an internal project which allows people to compile and upload code to a development board using the Arduino IDE.

For a few days I could not work out why my custom board package was not detecting the libraries that I needed for my test sketches.

I eventually found out by trial and error that for the Arduino IDE to detect the libraries in your sketches folder (at least on Windows) I needed to have the following in the gcc compiler command I was using under my platforms.txt file.


So it looks something like:

recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} {compiler.c.extra_flags} {includes} {build.extra_flags} "{source_file}" -o "{object_file}"

I could not work out why this is the case, I searched far and wide, I even searched through the Arduino IDE source code as much as I could. I am not so much looking for an answer, as I have not fixed my problem, but I wanted to post this in the forums so that others who might have this problem would find a solution.

If this is an inappropriate place to post this please feel free to remove it. Cheers.

did you use some existing Board Package as starting point?

The Arduino IDE (actually the arduino-builder tool) does dependency resolution on the sketch, determines which -I flags need to be passed to the compiler, and then defines the {includes} property with those flags. Enable File > Preferences > Show verbose compilation during: compilation in the Arduino IDE, run a compilation, and then examine the contents of the black console window at the bottom of the Arduino IDE window. There, you will see the commandgs generated from the recipes defined in platform.txt and understand how {includes} works.

You can find the official documentation of {includes} in the Arduino hardware specification:

I created a dummy board package that is intended to make it easy to study how the various properties in platform.txt, etc. are used. You might find it helpful to answer this sort of question: