Add boards to library

Hello!

Is it possible to share custom board json files from the boards folder in library?
I tried to keep boards folder in library, but seems it does not work.

This is not possible, per Custom Embedded Boards — PlatformIO latest documentation your only options are the boards directory of the project folder (or overwritten by boards_dir), boards/ dir in the .platformio core folder, or directly put it into the platform (~/.platformio/platforms/ststm32/boards/, e.g.)

Thank you for the reply.

Is there any other way to share board files without modifying system folder or creating custom platform?

Other than the options above, I know of none.

Is it possible to inherit platform without copying all code, corresponding to the that platform?
Just add extra boards and dependency to their SDKs?

No, a platform has to be forked in full, there’s no “Inherit from this platform and only add this tiny bit of code on top” mechanism.

However, you could make use of the advanced scripting capabilities available to you in a library (scripts — PlatformIO latest documentation) and use python code to copy the baord JSON file need into the ~/.platformio/boards folder on library install.

It is idea. I will try this way.
Thank you.

One more question, this will affect all projects for current user, but some projects can use different version of my library, and last installed project will override boards in this case.

May be there is some more safe place, which will affect only current project? For example, in build dir?

I’m using PLATFORMIO_LIB_EXTRA_DIRS env var to use local copy of library during development.

Seems this scripts are executed only in case of the manipulating library via pkg, and not suitable for local development. :frowning: