PlatformIO Community

Unable to put a timestamp into the .bin filename


I manage to build my project with the custom binary filename that contains a git version, following the scripts from your docs.
But, I would also like to include the timestamp into that filename. I already have a build flag called BUILD_TIME generated with a python script using dynamic build flags, explained again in your docs.

But when I include it into the python script line:

env.Replace(PROGNAME="firmware_%s_%s" % ( defines.get("GIT_REV"), 
defines.get("BUILD_TIME") ) )

It most of the time fails to build, saying things like this:

c:/users/krivi/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: cannot open linker script file No such file 
or directory
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\esp01_1m_OTA_RELEASE\firmware_v1.3.1_2021-06-05]

But to make it more funny, it doesn’t happen always. Like, 1 out of the 10 times, it manages to build and creates a proper binary filename.

What to make of it?

Sounds like Using dot `.` in PROGNAME causes unexpected behavior during building · Issue #3906 · platformio/platformio-core · GitHub.

Do pio upgrade --dev in a CLI and retry.

hey, thanks for the answer. Glad to see this is the issue that’s been worked on…
What will pio upgrade --dev do? Will I be able to roll back to my current version (5.1.1)

Upgrade to the latest development version. (5.2.0a6)

Yes, by doing a core reinstall or a pip uninstall platformio && pip install platformio with PlatformIO’s pip version in C:\Users\<user>\.platformio\penv\Scripts.

For my experience, that is pretty much never necessary, regressions are rare, upgrading to the latest dev version has only ever helped me.