Is there a way to rename the bin file to include the DBUILD_TAG when targeting a specific build?
e.g. in the platformio.ini I have the a entry version = -DBUILD_TAG=2.2. I would like this to be concatenated to the bin file when doing a release build so that firmware.bin becomes firmware_v2.2.bin
I canât get this to work.
This is show in the output
warning: Calling missing SConscript without error is deprecated.
Transition by adding must_exist=0 to SConscript calls.
Missing SConscript âextra_script.pyâ
Import("env", "projenv")
# access to global construction environment
print(env)
# access to project construction environment
print(projenv)
my_flags = env.ParseFlags(env['BUILD_FLAGS'])
defines = {k: v for (k, v) in my_flags.get("CPPDEFINES")}
print(defines)
env.Replace(PROGNAME="firmware_test%s" % defines.get("VERSION"))
So in your platformio.ini you instruct PIO to execute extra_script.py but in your project thereâs no such file, but a extrascript.py instead. You just have a typo .
Just wanted to post this for the next person. I was building some Tasmota firmware and the CPPDEFINES includes nested KVPâs so doing: defines = {k: v for (k, v) in my_flags.get(âCPPDEFINESâ)} will fail. Canât have a key that has the syntax of a KVP. Instead, just do this to parse those nested KVPs.
Import("env")
my_flags = env.ParseFlags(env['BUILD_FLAGS'])
defines = dict()
for b in my_flags.get("CPPDEFINES"):
if isinstance(b, list):
defines[b[0]] = b[1]
else:
defines[b] = b
env.Replace(PROGNAME="%s" % defines.get("IMAGE_NAME"))
Then I have this in my custom platform IO env: platformio_tasmota_cenv.ini
Is it somehow possible to get a #define set in the code, to use by PlatformIO e.g. in the filename of the binary?
So a define which is set in a header file.