'Automatic versioning during C code building
I have several HW projects done in C, which I am maintaining for which I would like to add automatic versioning if possible. They include HW written in C for Atxmega (Atmel Studio), dsPIC33 (MPLAB IDE) and Microblaze (Xilinx SDK).
The idea is that a build tool should be able to insert version information automatically before compilation (major, minor, patch and time) into a dedicated macro which I can then use in the code and send out that information when requested (and then get version command via communication interface). Then as soon as someone updates and recompiles the code, the end user will get this information when using the system via this get version command.
I have found out that I can maybe use predefined macros for this. My question: Is there some standard way of doing this which I can utilize across different SDKs and compilers?
My other ideas where writing a python script to edit the code manually before compilation or even modify the hex or elf file after compilation.
Is there a way to connect it somehow with the git and then send out the git commit ID (from a macro) which would also do the job just fine.
Thank you,
Ivan
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
