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.
To run this on pre or post-build, a user would need to define this in 'Real-Time Application Properties>Pre/Post Build Actions'.
This text file will be moved to cRIO target as an 'Always Included' file.
This file can be later read to acquire the version of the build:
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:
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:
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.
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.