VxWorks is a Real-Time Operating System (RTOS) built by Wind River. It is a licensed RTOS designed for industrial equipment, aerospace and defense, network infrastructure, consumer electronics, etc. VxWorks RTOS provides a complete development environment with an Eclipse-based IDE called the Wind River Workbench. The RTOS also provides a simulator that can help you virtualize your hardware and make the development process easier. The VxWorks development tools also let you use modern programming frameworks including the C++ 17 standard.
The TargetRTS C++ library can be used to develop any type of embedded or real-time applications on VxWorks RTOS. The Operating System supports C++ in its user space on 32/64-bit ARM and Intel architecture devices. Hence, you can create complex software applications with much ease while working with the TargetRTS library on RTOS.
This article covers how to build Model RealTime applications for VxWorks 7 from a Windows host machine:
Note: VxWorks support is available from the 7.1.11 version of TargetRTS.
Let's say, you have created the WindRiver folder in the C drive and installed the complete VxWorks package in the C:\WindRiver directory on a Windows host. Then, you will get the VxWorks RTOS, Clang compiler and WorkBench in this folder. To build TargetRTS on VxWorks, you need to set the following three VxWorks-specific environment variables.
Variables | Values |
---|---|
WIND_BASE | install-dir\vxworks\version |
WIND_CC_SYSROOT | install-dir\workspace\VSB |
WIND_HOME | install-dir |
Here the install-dir is the directory where VxWorks is installed (by default, which is C:\WindRiver) and version is the VxWorks version.
The VxWorks RTOS installs a command-line interface called the wrenv.exe to set up the environment for accessing VxWorks tools.
A VSB project specifies the CPU or board support package (BSP) associated with your target. A BSP is nothing but a set of code that provides a standard interface between the target hardware and the VxWorks RTOS.
Open the wrenv.exe shell and configure the VSB as shown below:
cd workspace
vxprj vsb create -bsp vxsim_windows_2_0_1_2 -S VSB
vxprj build VSB
You can also create the VSB project using the VxWorks Workbench.
VxWorks compiles the BSP source files from the BSP selected in the VSB and generates a VxWorks image file, which is VxWorks Image Project.
In the wrenv.exe shell, configure the VIP as shown below:
vxprj create -vsb VSB llvm VIP
cd VIP
vxprj build
You can also create the VIP project using the VxWorks Workbench.
You can run the following command to create and build the TargetRTS library. This command must be issued from TargetRTS/src folder using wrenv.exe. This build command should work if you have already created the VSB and VIP projects.
rtperl Build.pl VxWorks7T.simnt-Clang-15.x make all
Note: The rtperl utility can be found inside the plugin com.ibm.xtools.umldt.rt.core.tools in the Model RealTime installation. Locate the version under 'tools' that matches your operating system and add its folder to your PATH variable before running the command.
Start Model RealTime by running Eclipse.exe from the wrenv.exe present in the WindRiver folder.
Create a 'Hello World' application on Eclipse with the following configuration:
Configuration | Values |
---|---|
TargetRTS Configuration | VxWorks7T.simnt-Clang-15.x |
Make type | GNU_make |
Build the application to see the executable.vxe file, which will be recognized by the VxWorks RTOS.
You can run the VxWorks simulator to run the 'Hello World' application. For this, open the wrenv.exe command line from the WindRiver folder and change the directory to locate the simulator. VxWorks simulator will be present in VIP project inside default folder.
>C:\WindRiver>cd workspace\VIP\default
Run the Vxworks Simulator using vxsim command.
>C:\WindRiver\workspace\VIP\default>vxsim
Wait for the simulator to start. You have to run the executable on a simulator. Copy the 'Hello World' executable path and use the cd command on simulator to change the directory to the path of the executable.vxe of the 'Hello World' application. Ensure that the double quotes are present for the path.
cd "/host.host/C:/ModelRealTime/vs/HelloWorld_target/default"
To run the executable.vxe, you can call the following command in the simulator. Here also, ensure that the double quotes are present.
rtpSp "executable.vxe -URTS_DEBUG=quit"
This command spawns an RTP application, that is, it creates and initializes a Real Time Process in the system with the specified .vxe file as the executable for the RTP.