Hi, all!
I have a question for the community before creating an issue on GitHub.
I’d like to use a single “base” configuration .ini
file for a couple of projects in a single mon-repository.
That “base” configuration file would contain sections like [esp32-chip-base], and each particular project would include it, and add its own [env:…] configurations, extending base one and adding or overriding some options.
Am I rights, that it’s not possible now?
I studied extra_configs
options, but it seems to solve the opposite problem.
Using extra_configs
we can point not to a “base” file, but, contrary, to a number of “extension” files, and they would override options from platform.ini, isn’t it?
Is it possible to “include” a shared “base” file with the extra_configs
option, or not?
If not, I’d like to request a new option like base_configs
, which would work in the opposite way, so that options from platform.ini
override base options.
Are you sure you don’t mean extends = <some base environment>
(docs)?
Exactly, I’d like to extend a base section, but is it possible to extend a section from another file?
Like extends = ..\shared-options\shared.ini
?
The platformio.ini
can load all other environments from a .ini
file into the “global space” through extra_configs
. Then you can use extends
based on an the enviornment name. Think of extra_configs
like a #include <file.h>
in C/C++.
If you e.g. have a shared.ini
[esp32-chip-base]
platform = espressif32
framework = arduino
and a platformio.ini
of
[platformio]
extra_configs =
shared.ini
[env:my_esp32_chip]
extends = esp32-chip-base
board = esp32dev
This is effectively the same as
[env:my_esp32_chip]
platform = espressif32
framework = arduino
board = esp32dev
extra_configs
and extends
work independently of each other and can be combined.
I tried it, but it didn’t work for some reason.
Have you seen it working?
The documentation says quite clearly that options from extra_configs override options from platform.ini:
If you declare the same pair of “group” + “option” in an extra configuration file which was previously declared in a base “platformio.ini” (Project Configuration File), it will be overwritten with a value from extra configuration.
Maybe, I should investigate my problem deeper…
Because I tried exactly that scheme you provided
Yes that applies for double-declared options, but this should not be an issue. If you take the example in the documentation you’ll see how [common] debug_flags
override that exact same option declared in the platformio.ini
. Such a conflict sitation is not present in the example above.
If you post the exact platformio.ini
you’re trying and what results you’re expecting I can help you further.
Note the “merging is not done automatically” section in extends
(important for e.g. build_flags
) for that the “include option from another environment” scheme as documented should be used.
@maxgerhardt Yep, it’s my fault… 
extra_configs works as expected, there are problems with only one of my final env configurations (for ESP32). I’ll investigate it, and sorry for disturbing.
Should sleep more :)))
If you find the error, it’d be good to post here what error it was and how it was solved, for future reference. Or let me know if you need help.