Determining Build Version Number of NI Linux Real-Time Application

Updated Aug 30, 2023

Environment

Software

  • LabVIEW Real-Time Module

Operating System

  • LabVIEW Real-Time (NI Linux Real-Time)

Programming Language

  • LabVIEW G

Each time a real-time application is compiled, the build version is automatically updated in ‘Real-Time Application Properties>Version Information’. Alternatively, users can also manually control the version information. Reading back the version number from deployed applications can help users in managing their application inventory. This article will discuss different ways of determining the build version from an executable NI Linux RT application.
 

Unfortunately, there is no straightforward approach or API that can fetch the version number from an NI Linux real-time executable directly. However, the following are possible workarounds that can be used for this purpose:

1. Including a text file with RT application that contains version information:
When building the RT executable on the host PC, use a prebuild VI like the below (Get Build Specification Version.vi) to get the version number and update the value to a text file (using simple File IO APIs).  The "Get Build Specification Version.vi" (Windows compatible only VI) is already available in the NI App Builder library.
A picture containing diagram  Description automatically generated

To run this on pre or post-build, a user would need to define this in 'Real-Time Application Properties>Pre/Post Build Actions'.
Graphical user interface, application  Description automatically generated
This text file will be moved to cRIO target as an 'Always Included' file.
Graphical user interface, text, application, email  Description automatically generated

This file can be later read to acquire the version of the build:
Text  Description automatically generated with medium confidence


2. Adding Version Tag in RT Application File Path:
    When compiling an RT Application, users can add [VersionNumber] tag in the target destination directory as shown below:
Graphical user interface, text, application, email  Description automatically generated

When the user will deploy this application executable using LabVIEW on a real-time Linux target, a folder with the same name as version number will be created automatically as shown in the below screenshot:
Graphical user interface, text, application, chat or text message  Description automatically generated

The folder path can be read (programmatically or manually) to acquire the version of the deployed application.
Please note that the above version number tag does not update the file path correctly in 'lvrt.conf' file and may impact the normal startup functionality of the deployed application. You might need to correct the start-up VI path manually after deployment.

3. Using RAD or System Configuration Library:
The Replication and Deployment Utility  (RAD) or System Configuration APIs can also be used as an alternative to keep version control.  If using the Replication and Deployment (RAD) Utility to flash your image, you can use the System Configuration Property Node, with the property ImageVersion to obtain the image version. 
image.png

4. Using Component Definition Files:
Component Definition Files-based deployment approach can also be used. This generates a *.cdf file in ni-rt\system\ path on RT target that contains the version information. However, CDF support for all CompactRIOs ends in the 2021 NI Software Release, and for all PXIs ends in the 2022 Software release. Therefore, it is not recommended for newer designs.