This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Getting software version from linker output files?

I need to create a image file from the output of the CCS V4 linker. It looks like using hex430.exe to create an ascii file of some type and then parsing that will get me the actual contents that need to be burned to flash. However, I also need to obtain the version number to put in the image file header.

Right now the version is defined, well, as a define:

#define HOSTBOX_VERSION 1

But this doesn't show up in any of the linker output files that I can find. Has anyone found a way to define a version number that can be extracted?

 

  • Hi Robert,

    in general, when you want some information such as a version string to propagate from your C file into the final binary output file you should create a global constant, just defining a macro won't be enough. Also, you likely need to take measures so that it doesn't get optimized away during the linking process. This could happen if there is no access to the constant in C. One possible way around that would be to create a small assembler module containing your version information and include it into your project or to dummy-access that constant from C.

    Regards,
    Andreas

  • Thanks Andreas,

    For now I'm going to have my program scan the appropriate source code file looking for the define. If this doesn't work out for some reason I'll revisit getting that info into a output file for parsing.

    Bob

**Attention** This is a public forum