Advanced build tree


First of all thanks for making platformio available as an open source tool for embedded developers. It certainly provides some characteristics meant to ease up the development and maintenance of embedded applications.

I shortly discovered the platform and migrated some of my simpler projects to it (e.g. Arduino based, Atmel based, ESP based etc.). However, I have an issue or maybe misunderstanding about the full capabilities of the platform regarding the source tree of a more advanced project with external libs built from source etc. At the moment I have the feeling that albeit great out of the box, platformio is quite restrictive in this area and I feel it is may be quite a shame if this is indeed the case (so I apologize in advance if the error is on my side of the understanding).

So, to break it down let’s say I have a project combining some external deps fetchable from git or any other codehubs, and a particular source code tree structure separating some services and protocols from the core firmware and HAL. As an example take the following code structure:


How can one include all the libs down protocols, common, test and libs as project dependencies in addition to the external dependencies. One thing I tried is to use lib_dir pointing at libs/ and lib_extra_dir to the other lib directories with the deep+ ldf_mode option. It didn’t work out unfortunately.

I also couldn’t find any documentation / examples pointing out to these advanced use cases for builds, so I am wondering if I am barking at the wrong tree and indeed platformio can support this in its current version that I am using, i.e. 3.4.0.


Please read README in lib folder. Or see a copy platform-atmelavr/examples/arduino-blink/lib at master · platformio/platform-atmelavr · GitHub

Thanks for the reply! I went through the documentation on the library management a couple of times already.

In the end this topic boils down to one single question:
Is platformio able to build libraries spread around in a big project ?

Simple answer I have after reading documentation:
No. Platformio looks into the so called lib root directory for libs to build and then does a recursive global search there for files that it needs to build based on the includes it finds in the firmware sources.

One can solve the use case I described by forcing this directory structure onto an existing project, which I did for now.

I guess this is not a use case platformio was targetting ? Would there be an interest in having a list of such lib paths to look into for a future version ?

You can list custom storages with Redirecting...

That seems to be a dead link (in Apr 2019), but this is the replacement I believe:

1 Like