You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dynamic variables (interpolations) are useful when you have a custom configuration data between build environments. For examples, extra build_flags or project dependencies lib_deps.
Each variable should have a next format: ${<section>.<option>}, where <section> is a value from [<section>] group, and <option> is a first item from pair <option> = value.
What currently lacks and what I would like to see added is the following:
A variable for the current section (name) e.g. ${this} where ${this} returns the name of the current section and ${this.option} returns the value of option in the current section.
A variable for the current environment name in an environment section where within section [env:name] ${this.env} returns name.
The names of these vaiables are given as example but could be implemented/named differently. Essential is that they are available to the user as dynamic variables.
Having these variables available allows to create more powerful and more flexible platformio.ini files where actual values only have to be specified once ('single point of definition') without having to use more complex (and for many applications unnecessary) custom build scripts.
Note: Below example only demonstrates possible use of the suggested variables. It does not necessarily demonstrate the best use of these variables or when they are aboslutely needed. Latter would require a much more advanced/complex real life example to demonstrate the importance of the suggested features but that would only make this request more difficult to comprehend.
Below code is an extract from that platformio.ini.
I prefer to be able to write code like: -D BSFILE=\"boards/bsf_${this.env}.h\"
instead of: -D BSFILE=\"boards/bsf_disco_l072cz_lrwan1.h\"
Which prevents having to hard code environement strings and is easier to re-use and maintain.
The text was updated successfully, but these errors were encountered:
lnlp
changed the title
Add dynamic variables for current section and current environment
Please add dynamic variables for current section and current environment
Jun 4, 2021
lnlp
changed the title
Please add dynamic variables for current section and current environment
Feature-request: please add dynamic variables for current section and current environment
Jun 4, 2021
Feature Request
Dynamic variables
What currently lacks and what I would like to see added is the following:
The names of these vaiables are given as example but could be implemented/named differently. Essential is that they are available to the user as dynamic variables.
Having these variables available allows to create more powerful and more flexible
platformio.ini
files where actual values only have to be specified once ('single point of definition') without having to use more complex (and for many applications unnecessary) custom build scripts.Note: Below example only demonstrates possible use of the suggested variables. It does not necessarily demonstrate the best use of these variables or when they are aboslutely needed. Latter would require a much more advanced/complex real life example to demonstrate the importance of the suggested features but that would only make this request more difficult to comprehend.
Example flag values:
For a more real life example see platformio.ini of the LMIC-node application.
Below code is an extract from that platformio.ini.
I prefer to be able to write code like:
-D BSFILE=\"boards/bsf_${this.env}.h\"
instead of:
-D BSFILE=\"boards/bsf_disco_l072cz_lrwan1.h\"
Which prevents having to hard code environement strings and is easier to re-use and maintain.
The text was updated successfully, but these errors were encountered: