Adding a Subversion version string in binary

Technical Note 57192

Architectures:

All

Component:

IDE

Updated:

2/8/2018 6:14 AM

Introduction

How to add a version string from Subversion in the executable?

Discussion

Possible solution

Use the Subversion program svnversion.exe to produce version strings.

  • Set a pre-build action to call an appropriate script.
  • Create a script creating a C source file with a version string.
  • Include the created C source in your project.
  • Do not include the created C source in your version archive.
  • Optionally, use the version string in your code.
    • If so, suggest to create and use a headerfile as done in the example code.
  • Optionally, add a post-build action to remove the created C source.

Download Example (TN57192).zip for more details.

You may want to look at the screenshots in the example file first.

Comments

Has been tested

  • with IAR Embedded Workbench for ARM version 6.50.3.
  • with IAR Embedded Workbench for AVR version 6.20.2.
  • on Microsoft Windows 7 64-bit.
  • with path including blanks.
  • with path on another drive letter.
  • with path on a UNC share (in other words, \\server\share\path).

Set Tools > Options > Messages > Show build messages > 'All' to get messages from bat file in the Build Log window.

Conclusion

Follow this advice to get a Subversion version string added in the executable.

All product names are trademarks or registered trademarks of their respective owners.

We do no longer support Internet Explorer. To get the best experience of iar.com, we recommend upgrading to a modern browser such as Chrome or Edge.