Open-source script to automatically add (and update) git info to cpp variables

Hello,
I have made a python script that runs on the portable PlatformIO python environment that automatically abstracts your git info to variables. I use this for printing a few lines at the top of the code that tells me exactly what commit and even CRC was uploaded. This script automatically updates a header file everytime you build the code, as it is added as an extra_scripts flag in platform.ini.

I have tested only with Arduino framework but see no reason why it wouldn’t work with any other framework as it produces generic C++ code.

Please let me know if you have any questions! I hope you find it useful!

2 Likes

Now available as a standalone library in the PlatformIO registry! PlatformIO Registry