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.

Appending version number to output file

Hi,

I was wondering if anyone knows of an easy way to append a version number to the generated *.out file.  The reason is because we want to read back and verify the version number from the *.out  file in software before we bootload and update the firmare.  So for example, if we read version 1.5 in the image, and the latest version is 1.6, we would be able to reject the image file in software before updating.

Thanks,
Harvey 

  • There is no easy way to add anything to a .out file.  Put the version info in just like building any other C code.  Something like ...

    char version_info = "version info here";

    How do you plan to access info in the .out file?  I only know how to do it from tools running on a hosted system like a PC running Windows or Linux.

    Thanks and regards,

    -George

     

  • I've done it on other ides by adding a post processing step that renames the file.

  • Yeah, I actually added it into the C code, just like you did in your example.  But the problem is that when the bootloading PC software reads in the binary file (generated by the *.out file), it has no way to parse out the version number to verify if it is the latest file before it tries to use it to update the firmware.

    If I could append it to the end of the *.out file somewhere,  a PC software could just scan the file and check for the version number. 

     

    Thanks,

    Harvey

  • I like the idea of encoding the version info in the file name.  But if that doesn't work for you, here is an idea for you to consider.

    You could run the names utility like this to see the target address of where your version info exists ...

    C:\dir>nm6x -g file.out | find "version_info"
    00002ce5 B version_info

    The target address is 0x2ce5 in this case.  I could tell you how to convert that target address into a file offset in the .out file.  And then you would be able to read out the version info directly from the .out file.  It is not trivial, but it is doable.  Are you interested?

    -George

     

  • Georgem said:
    nm6x -g file.out | find "version_info"

    The user could define a user-defined absolute symbol in the linker command file.  Then the value of that symbol would show up as the address reported by nm6x.