Building and Running VxWorks-7 Boost C++ Applications
Table of Contents
- 1. Introduction
- 2. Prerequisites
- 3. Related Documentation
- 4. Create a Real Time Process (RTP) Project in Wind River Workbench
- 5. Locate Boost Library Example Code
- 6. Package Boost Application As an RTP
- 7. Run the boost Application RTP
The Boost project provides a comprehensive set of peer-reviewed, portable C++ source libraries that work well with the C++ Standard Library.
VxWorks is a Real Time Operating System built by Wind River.
VxWorks supports a subset of the Boost C++ library. The supported libraries are:
– Date Time
– Program Options
– Type Erasure
– BOOST Tests
In a previous blog, we explained how to build a boost enabled VxWorks kernel.
This blog describes how to port some boost example code from the boost.org website and run it on the VxWorks target.
These instructions assume that you are using:
– A Windows workstation with the following installed on it:
– Wind River VxWorks 7, SR0620
– Git for Windows
– You have completed the previous blog, “Adding VxWorks-7 Boost C++ Library Support”:
3 Related Documentation
For more information on these topics, refer to:
Wind River documentation:
VxWorks Support for Third-Party Software
Non-Wind River documentation:
4 Create a Real Time Process (RTP) Project in Wind River Workbench
4.1 Create the RTP based on the VxWorks Source Build (VSB) boostvsb
You must create an RTP project based on the boost enabled VxWorks project from the previous blog.
In Workbench, do the following:
File > New > Wind River Workbench Project
Select a Real Time Process Project
Figure 1: Select the RTP Build Type
Name the project “boostapp”.
You must base this project on the VSB you created in the previous blog. The VSB was called “boostvsb.” Select Browse to the file boostvsb/vsb.vxconfig to base the RTP project on “boostvsb.”
4.2 Rename rtp.c as rtp.cpp
The RTP project source file must be renamed to “rtp.cpp” because this boost source file will be C++ not C source code so must be built correctly.
Right-click on “rtp.c” in the Workbench Project Explorer view, select Rename and set the file name to “rtp.cpp”.
Figure 2: Rename the Source File
5 Locate Boost Library Example Code
5.1 Navigate to the boot.org website
From your web browser, navigate to https://www.boost.org.
The “boostvsb” project was built to include the boost match libraries, so we will select some boost.org example code that uses the math
5.2 Locate the Geometry Example Code
Select the boost “Geometry Library” example. Navigate to https://www.boost.org/doc/libs/1_54_0/libs/geometry/doc/html/index.html
Under “Spatial Indexes,” click “Examples.”
Figure 3: Locate the Geometry Example Code
Select the example, “Index of polygons stored in vector.”
Figure 4: Select Index of Polygons Stored in Vector
This presents example source code. The application uses the boost math library to create a tree of polygon math objects and then
interrogate and output their values.
Highlight this source code and copy it.
6 Package Boost Application As an RTP
6.1 Copy the source code to the rtp.cpp file
Make sure that you copy and replace the “rtp.cpp” file contents with all the boost website example source lines.
Figure 5: Copy the Source Code into the RTP Project
6.2 Add the boost_system Library to the RTP Build Properties
Right-click on the boostapp RTP and select Properties.
Select Build Properties, Libraries.
Click Add to all, select Add library file (-I) and type:
Figure 6: Add Core Boost Library to the RTP Project
Click Apply and Close, and click Yes to reindex the project.
Now re-build the project. The build should complete successfully.
If you see any build errors that indicate boost libraries are missing, you must add those libraries manually from this Build Properties, Libraries
Note: if you use the boost thread libraries in your RTP code, you must add -I boost_thread as an additional RTP library.
7 Run the boost Application RTP
7.1 Launch the VxWorks Simulator Target from Workbench
From the Workbench Target Connection window, create a VxWorks simulator connection for the “boostvip” VIP project that you created in
the previous blog.
Figure 7: Create a VxWorks Simulator target connection
Launch the target
7.2 Adjust Kernel Scheduler to Enable Time Slicing
From the VxWorks target kernel shell, type the following:
Boost applications run more successfully on this VxWorks kernel configuration.
7.3 Run the bootapp RTP on the target
Right-click the “boostapp” project in Workbench and select Run/Debug Real Time Process.
Observe the boost polygon application runs on the target and generates outputs from the VxWorks simulator target console.
Figure 8: Run the Boost Polygon Application