I’d like to embed a build timestamp into the firmware, but without forcing a recompilation of the entire world each time I invoke pio run
. I first used
build_flags = -DBUILD_TIMESTAMP=$UNIX_TIME
and while that does allow me to embed the timestamp into the firmware it forces a recompilation.
The idea I’ve come up with so far is to define a symbol on the linker commandline and set the value of the symbol to the timestamp or firmware version. In GLD I believe this can be done using --defsym symbol=expression
. This way if the firmware gets relinked it gets a fresh timestamp, but if it doesn’t nothing is forced to be linked or compiled. I have tried this, so perhaps it doesn’t actually work the way I’m thinking…
Any thoughts, other suggestions? How could I try the above idea out?