A good software structure

Hello everybudy

I am working on a projekt with the ESP32 DevKit v1. To develope the programmcode for this one i am using the Arduino IDE.

I would really like to have a nice software structure. A Hardware abstraction layer (HAL) which includes a chip support library (CSL) and a board support library (BSL).

My Problem now is, that i have to save all my libraries in the sketch library folder. And in this folder i have to have another folder, which has the exact same name as the headerfile of the library (libraries → xylib → xylib.h).
This is an unsatisfing solution. I mean at least i would like to have a folder called CSL and one called BSL in which i would have my libraries but this does not work.
I tried to do it like this <CSL/xylib.h> and like this “CSL/xylib.h” and on many other variants.

Maybe someone has an idea how to solve this problem or Maybe there is no solution.

And maybe there is also a solution with static libraries which would be my favourite one if this is even possible.

Does someone have an answer for this?

Thank you very much and sorry for my bad english :wink:
(would also read answers in german :slight_smile: )

The library which matched a previous #include directive will be given preference. So if each library has a unique header file, you can do this:

#include <CSL.h>
#include <xylib.h>  // this will match to CSL/xylib.h

and this:

#include <BSL.h>
#include <xylib.h>  // this will match to BSL/xylib.h

If you don’t already have a unique filename, you could add one.

dmaurer:
And maybe there is also a solution with static libraries which would be my favourite one if this is even possible.

You can take a look at the documentation for the “precompiled” and “ldflags” fields of library.properties to see if it will be of any help to you:
https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5:-Library-specification#libraryproperties-file-format

Best approach is to not use the Arduino IDE at all. Visual Studio with VisualMicros or VisualGDB is a much better solution.