4.3.2 Building and Running an Application as a Kernel Task

There are two ways to build and run your Connext application:

4.3.2.1 Using the Command Line

  1. Set up your environment with the wrenv.sh script or wrenv.bat batch file in the VxWorks base directory. Execute the script with the -p parameter. For example:
  2. wrenv.sh -p vxworks
  3. Set the NDDSHOME environment variable as described in Set Up Environment Variables (rtisetenv), in the RTI Connext Getting Started Guide.
  4. Build the Publisher and Subscriber modules using the generated makefile. You may have to modify the HOST_TYPE, compiler and linker paths to match your development setup.
  5. To use dynamic linking, remove the Connext libraries from the link objects in the generated makefile.

(Note: steps 5-7 can be replaced by establishing a telnet connection to the VxWorks target. In that case, Workbench does not need to be used and both the Host Shell and Target Console will be redirected to the telnet connection. Once in the C interpreter (you will see the prompt '->' in the shell) you can type cmd and then help for more information on how to load and run applications on your target.)

  1. Launch Workbench.
  2. Make sure your target is running VxWorks and is added to the Remote Systems panel. (To add a new target, click the New Connection button on the Remote System panel, select Wind River VxWorks 7 Target Server Connection, click Next, enter the Target name or address, and click Finish).
  3. Connect to the target and open a host shell by right-clicking the connected target in the Target Tools sub-menu.
  4. In the shell:
  5. If you are using static linking: Load the .so file produced by the build:

    >cd "directory"
    >ld 0 < HelloWorld_subscriber.so

    (Where ‘directory’ refers to the location of the generated object files.) If you are using dynamic linking: load the libraries first, in this order: libnddscore.so, libnddsc.so, libnddscpp.so; then load the .so file produced by the build.

    Note: If you are statically linking, and you try to load both the publisher and subscriber into the kernel, you will run into duplication of symbols due to the Connext libraries being statically linked in both modules. To overcome that situation, see the "Notes for VxWorks 7 Platforms" section in the RTI Connext Core Libraries Platform Notes, for an explanation about how to create a single Downloadable Kernel Module (DKM) containing both applications.

  6. Change directory to the location where you have generated the example, since it contains the USER_QOS_PROFILES.xml file. Once there, run the run_subscriber_application or run_publisher_application function. For example:
  7. >cd "directory"

    Your current directory should contain the file USER_QOS_PROFILES.xml. Then:

    >taskSpawn "sub", 255, <floating_point_option>, 150000, run_subscriber_application, 38, 10

    Where <floating_point_option> is a numeric value that varies depending on the hardware. See Enabling Floating Point Coprocessor in Kernel Tasks, in the RTI Connext Core Libraries Platform Notes.

    In this example, 38 is the domain ID and 10 is the number of samples.

4.3.2.2 Using Workbench

Note: The following steps might vary slightly depending on your chosen version of VxWorks.

  1. Start Workbench.
  2. Select File, New, Wind River Workbench Project.
  3. Select the desired Target operating system; click Next.
  4. When prompted to choose a Build type, select Downloadable Kernel Module; click Next.
  5. Give your project a name; click Next.
  6. Leave everything else at its default setting; click Finish.
  7. Your project will be created at this time.

  8. Copy the source and header files generated by rtiddsgen in 4.3.1 Generate Example Code and Makefile with rtiddsgen into the project directory.
  9. View the added files by right-clicking on the project in Project Explorer, then selecting Refresh to see the files.
  10. Open the project Properties by right-clicking on the project in Project Explorer and selecting Properties.
  11. In the dialog box that appears, select Build Properties in the navigation pane on the left.
  12. In the Build Support and Specs tab, select the desired build spec from the Active build spec drop-down menu; click Apply to save the changes.
  13. In the Build Macros or Defines tab, add -DRTI_VXWORKS to DEFINES in the Build macro definitions; click Apply to save the changes.
  14. In the Variables tab, add to LIBPATH:
  15. -L/(NDDSHOME)/lib/<architecture>

    If you are using static linking, add to LIBS:

    -lnddscppz -lnddscz -lnddscorez (in that order)

    If you are using dynamic linking, add to LIBS:

    -lnddscpp -lnddsc -lnddscore (in that order)

    Click Apply to save the changes.

  16. In the Build Paths or Paths tab, add both of these:
  17. -I$(NDDSHOME)/include

    -I$(NDDSHOME)/include/ndds

    Click Apply to save the changes.

  18. Click OK to exit the Properties menu.
  19. Build the project by right-clicking on the project in Project Explorer, then selecting Build Project.
  20. Run the application as described starting in Step 5 in the 'Using the Command Line' section, except load HelloWorld.out instead of HelloWorld_subscriber.so when you get to Step 8.