Library requiring config in project directory

I’m creating a library of FreeRTOS that is platform independant. This means that the portable files and FreeRTOSConfig.h need to be ‘passed into’ the library on compliation. As a stop gap I’ve put the path to the correct portable files in the library.json but I’m still unsure about how to ‘pass in’ FreeRTOSConfig.h from the project directory.

Is this possible without making it messy?

I’ve read through the documentation but I couldn’t see a tidy way of doing this.

Check out GitHub - stm32duino/STM32FreeRTOS: Real Time Operating System implemented for STM32, especially this and this.

Hi maxgerhardt, I’m looking to make it not specific. What you’ve suggested has made it specific to STM32 and also using arduino libraries.
The idea behind this is that I can simply specify the chip I’m using and the portables will be selected.
The FreeRTOSConfig is specific to each project and needs to be part of the project so it can be configured accordingly.
But thank you, I will have a further look into this regardless.

Yes this is exactly what the code does by using the

#if __has_include("STM32FreeRTOSConfig.h")

block o_o? Just checks if the sketch provides this header file or not, and if not, includes the default settings. This should be what you need.

Apologies, I don’t think I’ve explained myself correctly. When I try to compile, when compiling the library itself I want it to pull in the FreeRTOSConfig at the project level. It is currently not doing so.

Having a look at the library.json of STM32FreeRTOS it doesn’t have anything special in it. I’m not sure how the LDF/Compiler is finding the correct files to include in the compilation.

The block of code you have posted is simply a #ifndef type thing I’m guessing.

Just to give you some extra background, I’m using the BluePill with libopencm3 and the FreeRTOS-Kernal

Mabe extra scripting will help you? Redirecting...

You can dynamically exclude files or generate build flags.

Not sure this is exactly what you need, but I had a similar problem. It seems that PlatformIO looks at the .h files at the project folders only when it’s compiling the project files. The solution I used was to add the following build flag in platformio.ini:

build_flags =
    -Iinclude

That way, PlatformIO includes the folder “include” when it’s compiling any file.

Then, just place the “STM32FreeRTOSConfig.h” file in the include folder of the project.