Including private library with options

Hi all!

I am working with ststm32 / stm32cube project - and all is nice.

I am using the Stm32CubeMX tool from ST-Link to create initialization files, and include those files to ./src/stm32cubemx/

And i am using FreeRTOS to provided stuff, included now in ./src/FreeRTOS/

The project compiles fine when i have all placed under the ./src/ and adjust the include flags properly ( -I./src/FreeRTOS/include/ -I./src/FreeRTOS/portable/GCC/ARM_CM4F/ -I./src/FreeRTOS/CMSIS_RTOS/) and (-I./src/stm32cubemx/).

Now what i would love to see, is that i could place these “messy” files to ./lib/.

Now in my opinion it would be clean solution: craft ./lib/FreeRTOS/library.json (and ./lib/stm32cubemx/library.json) that would declare all these include directories - but based on my trial-n-error it does not work.

Should it work? Are there other ways to include “private & local” - libraries with some extra flags ("-I…")

And just to continue questioning futher: what is the best way to have the FreeRTOSConfig.h file (and portmacro.h) that are more kind of part of the project than the library (since they are config files) – and the library depends on them, so placing them in the ./src/ will not work?


It should work. Did you put library.json correctly? I’ve just updated README:

Thanks for your reply - you are correct, it does work, when i now retried – probably some configuration issue earlier.

If somebody else stumbples here for this information its simple as:

  1. lib_deps = MYPREFIX_FreeRTOS
  2. Create lib/MYPREFIX_FreeRTOS/library.json - that declares proper build flags (include dirs)
  3. FreeRTOS requires FreeRTOSConfig.h – i handled that in the way that i added “-I…/…/src/config” to the library.json build flags. This way its not inside the library, but in the project source.

Here is my library.json as an example:

        "name": "MYPREFIX_FreeRTOS",
        "keywords": "Freertos",
        "description": "FreeRTOS for the stm32cubemx",
        "downloadUrl": "",
            "name": "FreeRTOS",
            "email": ""
            "flags" : "-Isrc/include -Isrc/portable/GCC/ARM_CM4F/ -I../../src/config/"
        "dependencies": {   },
        "version": "1.0.0",
        "frameworks": "stm32cube",
        "platforms": "*"