Our project has a standard version numbering system with major, minor and revision numbers. For this discussion, assume they have values 1, 2 and 3 respectively.
I'd like to define the major, minor and revision number components in a single place but with the following twist: the version number components must be accessible to the C compiler (likely defined by the pre-processor) so I can do something like this:
write_to_flash(make_version_number(VERS_MAJOR, VERS_MINOR, VERS_REVISION));
AND also accessible to KDS/Eclipse, so I can generate an output filename of the form:
I already have a pre-processor script, so I could clearly use it to take build variables and create a .h file from them, so I'd end up with:
#define VERS_MAJOR 1
#define VERS_MINOR 2
#define VERS_REVISION 3
This way, I only have to define the version numbers (once) in the project's Build Variables. Is this the recommended way to do it? Or is there another preferred technique?