Adding extra_configs dynamically


I have a multienvironment project where each environment is responsible for one microcontroller. For this I have in src/ folder subfolders containing mains with setup() and main() function definitions. They are added in platformio.ini with src_filter.

I would like to introduce more modularity by writing in the subfolders kind of node.ini’s. They should be loaded dynamically with the help of an from top folders platformio.ini. platformio.ini should not have knowledge what node.ini’s can come. Everything what is responsible for one environment should stay in that node.ini (build and upload cmds)

For that I can imagine to load dynamically extra_configs or extending base envs. Is it possible to do something like this from extra_script? Is it possible to populate a new environment inside an

Example project structure:

With regards
Ivan Belyaev

The option is wildcard capable. extra_configs = src/*/node.ini will include all node.ini in the subfolders. Each node.ini can declare a new environment.

Nice! This was very inspiring! Glad that platformio has such nice features. Dream about monolithic repository with multiple projects just came one step nearer. It is now possible to extend project base without writing everything in one place! Thanks!