This document is part of The Definitive Guide: Programming NI VxWorks Real-Time Controllers in C/C++. Here, we detail the use of Wind River Workbench to program these controllers.
We use Wind River Workbench 3.0.1 with VxWorks 6.x configuration. This configuration installs the PowerPC target and the necessary library and header files for VxWorks.
Open Wind River Workbench, and select from the top menu bar, File -> New -> VxWorks Downloadable Kernel Module Project. A project configuration wizard opens.
Figure 2.1a: Workbench getting started window.
We are building an example application to generate Fibonacci numbers. Enter "fib" for the project name, and select Next. The defaults for the Project Structure, Build Defaults, and Build Support are correct; press Next to advance to the Build Specs dialog. The correct build specification is PPC603gnu (PPC603 instruction set using the GNU toolchain); deselect all build specifications except for PPC603gnu.
Figure 2.1b: Compile architecture settings..
You may optinally deselect Debug Mode if you do not plan to debug your application. The project settings are now complete; press Finish to view your new project in Workbench.
To create a new source file, in the Project Explorer view, right click on the "fib" project, and select from the context menu, New -> File. Name the file fib.c. Paste the following code into the editor for fib.c:
Your environment window should resemble ours below:
Figure 2.2a: Environment window for the Fib project.
Open the build properties dialog by right-clicking on your project and selecting Properties. Within the properties dialog, select the Build Properties filter, and then the Build Settings tab. Add the text –mlongcall to the Build Flags textbox.
Figure 2.3a: Compiler tool flag settings, showing the addition of -mlongcall.
Also add the option to the linker tool flags:
Figure 2.3b: Compiler tool flag settings, showing the addition of -mlongcall.
Select from the top menu bar, Project -> Build All. Workbench compiles your code into an executable library, shown in your project:
Figure 2.4a: Project navigator showing an output binary file for the Fib project.
The file fib.out is the binary library that may be executed on the target. Refer to the top-level document, The Definitive Guide: Programming NI VxWorks Real-Time Controllers in C/C++ for instructions on how to upload your executable to the target and execute your code.
Instructions for disabling the CPU Exception Handler are found in the top-level guide, The Definitive Guide: Programming NI VxWorks Real-Time Controllers in C/C++.
3.2 Start the Debugging Task
Workbench uses low-level debugging capabilities that are not enabled by default on RIO targets. Debugging is enabled by starting a task from the VxWorks Kernel Shell. Refer to the top-level document, The Definitive Guide: Programming NI VxWorks Real-Time Controllers in C/C++ for instructions on how to connect to the VxWorks Kernel Shell.
From the VxWorks Kernel Shell, enter the command debuggingInit. The response should be similar to ours below:
Figure 3.2a: Starting the debugging task.
Using FTP, download the file ni-rt/system/vxWorks to your computer using BINARY transfer mode. We suggest downloading to a path that does not contain spaces, i.e. c:\target\VxWorks . This file will be referenced when connecting the debugger to the target.
Select from the Workbench menu bar, Target -> New Connection .When prompted to select the remote system type, choose Wind River VxWorks 6.x Target Server Connection When and then click Next. Enter the IP address or hostname of your target, and the filesystem location of the VxWorks kernel you downloaded in the previous step, into the Target Server Options dialog and press Finish.
Figure 3.4a: Connecting to the target.
Workbench will automatically connect to the target if possible. The target will appear in a Debug Targets view. Right-click on the target to launch a console to the VxWorks Kernel Shell on the target, which communicates over ethernet instead of serial.
To debug, first connect to all kernel tasks by first right clicking on Kernel Tasks and selecting "Connect All Kernel Tasks". Right click on Kernel Tasks again to select Run or Debug Kernel Task, which will download your library to the target and either execute the library or start a debug session. We refer you to the Wind River Workbench 3.0 User's Guide for instructions on using the Workbench debugger.
Is there any way to get the latest kernel and service configuration for VxWorks 6.3 on CRIO (9014). Which filesystem(s) are configured? Is virtual memory running? What caching options are configured? Basically, is there a way to get the configAll.h?
I ask because our company is evaluating data storage/management options for our RT application, which may include embedded db or custom libraries "under-the-hood" of LabView RT.