RTI Data Distribution Service Getting Started Guide Addendum For

RTI Data Distribution Service . Getting Started Guide Addendum for Embedded Systems . Version 4.5 . The Global Leader in DDS
community.rti.com/docs/pdf/rti_dds_gettingstarted_embeddedsystemsaddendum.pdf

 

 DOWNLOAD | Find Similar

 


advertisement

 

 

 

Text Previews (text result may be not accurate)

RTI Data Distribution Service Addendum for Embedded Systems Version 4.5 2010-2011 Real-Time Innovations, Inc All rights reserved. Printed in U.S.A. First printing. October 2011. Trademarks Real-Time Innovations and RTI are registered trademarks of Real-Time Innovations, Inc. All other trademarks used in this document are the property of their respective owners. Copy and Use Restrictions No part of this publication may be reproduced, st ored in a retrieval system, or transmitted in any form (including electronic, mechanical, photoc opy, and facsimile) without the prior written permission of Real-Time Innovations, Inc. The software described in this document is furnished under and subject to the RTI software license agreem ent. The software may be used or copied only under the terms of the license agreement. Technical Support Real-Time Innovations, Inc. Sunnyvale, CA 94089 Phone:(408) 990-7444 Email:support@rti.com Website: https://support.rti.com/ 1Addendum for Embedded Platforms 2.1Building and Running a Hello World Example................................................................... 2.2Configuring Automatic Discovery........................................................................................ 3.1Building the Kernel......................................................................................................... ......... 3.2Building and Running a Hello World Example................................................................... 3.2.1Generate Example Code and Project File with rtiddsgen.................................... 3.2.2Build the Publish and Subscribe Applications...................................................... 3.2.5Run the Application and View the Output............................................................ 4.1Building the Kernel......................................................................................................... ......... 4.2Building and Running a Hello World Example................................................................... 4.2.1Generate Example Code and Makefile wi th rtiddsgen........................................ 4.2.2Building and Running an RTI Data Distribution Service Application as a Kernel Task.................................................................................................................. 4.2.3Building and Running an RTI Data Distribution Service Application as a VxWorks Real-Time Process (RTP).......................................................................... 5.2Creating DDS Applications................................................................................................... 5.3Running DDS Applications.................................................................................................. 1. Addendum for Embedded Platforms Chapter 1Addendum for Embedded Platforms In addition to enterprise-class platfo rms like Microsoft Windows and Linux, RTI® Data Distribution Service supports a wide range of embedded platforms. This document is a companion to the 2. Embedded UNIX- This chapter provides instructions on building and running RTI Data Distribution Service applications on embedded UNIX-like system s, including QNX® and LynxOS® systems. It will guide you through the process of generating, compiling, and running a Hello World application on an embedded UNIX-like system by expanding on Generating Code with rtiddsgen (Section 4.3.2.1) in the . Please read the follow ing alongside that section. In the following steps: All commands must be executed in a co mmand shell that has all the required environment variables. For details, see opment Machine (Section 3.1.1.1) in the We assume that you have gmake installed. If you have , you can use the generated makefile to compile. If you do not have gmake , use your normal com pilation process. (Note: the generated makefile assumes the correct version of the compiler is already in your path and that NDDSHOME 2.1 Building and Running a Hello World Example This section describes the basic st eps for building and running an rtiddsgen -generated Create a directory to work in. In this example, we use a directory called In the directory, create a file called HelloWorld.idl that contains a user- defined data type: Use the rtiddsgen utility to generate sample code and a makefile. Modify, build, and run the generated code as described in Using Types Defined at Compile Time (Section 4.3.2) in the For C++: For Java: For Java users: The generated makefile deduces th e path to the java executable based on the APOGEE_HOME environment variable , which therefore must be set in order to run the example applications. 2.2Configuring Automatic Discovery In most cases, multiple appl ications—whether on the same host or different hosts—will discover each other and begin communicatin g automatically. However, in some cases you must configure the discovery service manually. For example, on LynxOS systems, multicast is not used for discovery by defaul t; you will need to configure the addresses it will use. For more information about thes e situations, and how to configure discovery, see Automatic Application Discovery (Section 4.1) in the 1. For example: $(APOGEE_HOME)/lynx/pcc/ive/bin/j9 struct HelloWorld { stringኀ128 msg; rtiddsgen -language C++ -example architect¦.7;&#xrchi;&#xtect;.7u;&#xre00;ure HelloWorld.idl gmake -f makefile_HelloWorld_archi rch;&#xi6.7;&#xtect;&#xure0;tecture ./objs/architectu r6.;|hi;&#xtect;&#xu6.7;&#xre00;re/HelloWorld_subscriber ./objs/architectu r6.;|hi;&#xtect;&#xu6.7;&#xre00;re/HelloWorld_publisher rtiddsgen -language Java -example architec.7a;&#xrchi;&#xtec6;&#x.7tu;&#xre00;ture HelloWorld.idl gmake -f makefile_HelloWorld_archi rch;&#xi6.7;&#xtect;&#xure0;tecture gmake -f makefile_HelloWorld_archi rch;&#xi6.7;&#xtect;&#xure0;tecture HelloWorldSubscriber gmake -f makefile_HelloWorld_archi rch;&#xi6.7;&#xtect;&#xure0;tecture HelloWorldPublisher 3. INTEGRITY Systems This chapter provides simple instructions on configuring a kernel and running RTI Data Distribution Service applications on an INTEGRITY system. Please refer to the documen- tation provided by Green Hills Systems for more information about this operating sys- This process has been tested on INTEGRITY 5.0.11 and assumes that applications are downloaded dynamically. For more information on using RTI Data Distribution Service on an INTEGRITY system, please see the RTI Data Distribution Service Platform Notes The first section describes Building the Kernel (Section 3.1) The next section guides you through the step s to build and run an rtiddsgen-generated Building and Running a Hello World Example (Section 3.2) Before you start, make sure that you know how to: 3.1 Building the Kernel Launch MULTI. Select File, Create new project Choose the INTEGRITY Operating System and make sure the path to your INTEGRITY distribution is correct. Choose a processor family and board name. Choose Language: Project type: INTEGRITY Kernel Choose a project directory and name. 10. In Kernel Options, choose at least: '. Everything else can be left to default. 11. In the Project Builder, you should see the following file: name of your project _default.ld (under src/resource.gpj). 12. Right-click the file and edit it; the parameters of interest are the following: Note that most RTI Data Distribution Service applications will require the Stack ues shown above are adequate to run the examples presented in this document. 13. Once you have changed the desired values, right-click the top-level project and select Build 14. CONSTANTS __INTEGRITY_DebugBufferSize = 0x10000 __INTEGRITY_HeapSize = 0x100000 __INTEGRITY_StackSize = 0x4000 __INTEGRITY_DownloadSize = 0x400000 __INTEGRITY_MaxCoreSize = 0x200000 Building and Running a Hello World Example 3. INTEGRITY Systems 3.2Building and Running a Hello World Example This section describes the basic st eps for building and running an rtiddsgen -generated Generate Example Code and Project Fi le with rtiddsgen (Section 3.2.1) Build the Publish and Subscribe Applications (Section 3.2.2) Run the Application and View the Output (Section 3.2.5) 3.2.1Generate Example Code and Project File with rtiddsgen To create the example applications: Create a directory to work in. In this example, we use a directory called In the directory, create a file called HelloWorld.idl that contains a user- defined data type: Use the rtiddsgen utility to generate sample code and a project file as described in Generating Code with rtiddsge n (Section 4.3.2.1) in the Choose either C or C++. For C: For C++: In your directory, you will see that rtiddsgen has created a number of source code files (describ ed in Section 3.7 of the User’s Manual ), additional sup port files (not listed here), and a project file: HelloWorld_default.gpj Edit the example code to modify the data as described in Generating Code with rtiddsgen (Section 4.3.2.1) in the struct HelloWorld { strinኀg128 msg; architecture HelloWorld.idl architecture HelloWorld.idl 3.2.2Build the Publish and Subscribe Applications Launch MULTI. Select File, Open Project Builder and choose the top-level project file generated rtiddsgen HelloWorld_default.gpj Right-click the top-level project file in th e Project builder and edit it to add the following line: -os_dir= the path to your INTEGRITY distribution Note: For Interpeak architectures: Also add the location of your Interpeak librar ies: -Linterpeak install.7i;&#xnter;&#xpeak;.7 ;&#xinst; ll6;&#x.7 d;&#xir00; dir/libs Save your changes. Right-click the top-level project and Build the project. MULTI might ask you if you want to load the changes to your project, you should do so. 3.2.3Connect to the INTEGRITY Target from MULTI From the MULTI Launcher, click the Connection button and open the Connect option. Your mode should be Download (Download and debug application). Create a custom connection rtserv -port udp@ You only have to create your connection once, MULTI will remember it. In the task window, select Browse for your executables; there should be 3 of them in your project directory: HelloWorld_publisherdd HelloWorld_subscriberdd posix_shm_manager Building and Running a Hello World Example 3. INTEGRITY Systems Load the posix_shm_manager first, it will appear in the Tasks window as a sep arate address space and start running by itself once loaded. It will allow you to Note: The default rtiddsgen -generated code tries to use shared memory, so unless you have manually disabled it, your application will crash if you do not load the shared memory manager befo re running the application. Load the publisher, subscriber, or both. They should appear in separate address spaces in the Tasks window. 3.2.5Run the Application and View the Output Select the task called "Initial" in your application's address space in the Tasks window; you can either click the play button to run it, or click the debug button to debug it. Note that with some versions of INTEGRITY, it is difficult to pass arguments to applications. Arguments can always be hard-coded in your application before compiling it. To quickly experiment with multiple runs of the application with different arguments, one option is to ru n your application within the debugger. From the Tasks window, select Target, Show Target Windows . This will show Some errors messages may still go through the serial port, so you should leave your serial port connection open and monitor it as well. Go to your serial port connection monitor and type ' 4. VxWorks Systems This chapter provides simple instructions to configure a kernel and run RTI Data Distri bution Service applications on VxWorks 6.x systems. Please refer to the documentation provided by Wind River Systems for more information on this operating system. See RTI Data Distribution Service Platform Notes This chapter will guide you through the process of generating, compiling, and running a Hello World application on vxWorks 6.x systems by expanding on Generating Code with rtiddsgen (Section 4.3.2.1) in the Getting Started Guide ; please read the following alongside that section. The first section describes how to build the kernel: Building the Kernel (Section 4.1) The next section guides you through the step s to generate, modify, build, and run the Building and Running a Hello World Example (Section 4.2) 4.1Building the Kernel Launch Workbench. Select File, New, VxWorks Image Project Give your project a name. Choose the board support package according to your hardware. For the Tool chain, select For the Profile, select PROFILE_DEVELOPMENT Leave everything else For VxWorks 6.4 and below: Once the project is created, double-click Kernel Configuration and add at least the following modules: nents (The RTI Data Distribution Service libraries for VxWorks Kernel Mode use ZBUF sockets. If you do add this module to the kernel, you will see undefined symbols when loading the RTI Data Distribution Service IGMP v4 (under To add a module to the kernel, right-click include Included modules have a dark blue box, modules not included have light blue Compile the Kernel by right-clicking the project and selecting Build project The Kernel and associated symbol file will be found under your project direc 4.2Building and Running a Hello World Example This section will guide you through the steps required to successfully run an rtiddsgen generated example application on a VxWork s 6.x target, using kernel mode or RTP mode: Kernel Mode : see Section RTP Mode see Section 1. In 4.5d the only architecture with SMP support is ppc604Vx6.7gcc4.1.2_smp. Building and Running a Hello World Example 4. VxWorks Systems 4.2.1Generate Example Code and Makefile with rtiddsgen To create the example applications: Create a directory to work in. In this example, we use a directory called In the directory, create a file called HelloWorld.idl that contains a user- defined data type: Use the rtiddsgen utility to generate sample code and a makefile as described in Generating Code with rtiddsge n (Section 4.3.2.1) in the Guide .Choose either C or C++. The architecture names for Kernel Mode and RTP Mode are different. For C: For C++: For Java: Edit the generated example code as described in Generating Code with rtidds gen (Section 4.3.2.1) in the 4.2.2Building and Running an RTI Data Distribution Service Application as a Kernel Task There are two ways to build and run your RTI Data Distribution Service application: Using Command Line (Section 4.2.2.1) Using Workbench (Section 4.2.2.2) 4.2.2.1Using Command Line Set up your environment with the wrenv.sh script in the VxWorks base directory. struct HelloWorld { strኀing128 msg; rtiddsgen -language C -example architecture HelloWorld.idl rtiddsgen -language C++ -example architecture HelloWorld.idl rtiddsgen -language Java -example architecture HelloWorld.idl Build the Publisher and Subscriber modules using the generated makefile. This makefile will work out of the box on a Solaris host; you will have to modify the compiler and linker paths for Linux and Windows hosts. To use dynamic linking, remove the RTI Data Distribution Service libraries from the link objects. (Note: steps 4, 5 and 6 can be replaced by Launch Workbench. In the host shell: if using static linking, load the single file produced by the If using dynamic linking: to avoid unresolved symbols warnings, load the librar ies first, in this order: libnddscore.so , then libnddscpp.so then load your file. or publisher_main function. For example: In this example, 38 is the domain ID and 10 is the number of samples. Note: If you plan on running more than one RTI Data Distribution Service application as a Kernel task (for example, a publisher and a subscriber), use dynamic linking to avoid 4.2.2.2Using Workbench Using Workbench, create a new Downloadable Kernel Module Project, choose Managed build option and the PPC32gnu Copy the source files and headers generated by rtiddsgen into the project direc tory. cd "directory" ld 1 HelloWorld_subscriber.so taskSpawn "sub", 255, 0x8, 150000, subscriber_main, 38, 10 Building and Running a Hello World Example 4. VxWorks Systems Right-click the project in Workbench, then select to see the files. Right-click the project and go to Properties Build Properties Build Macros Add to DEFINES: -DRTI_VXWORKS -mlongcall (only needed for PowerPC targets) If you are use static linking: Add to LIBPATH: -L/{your path to the RTI Data Distribution Service libraries, make sure th ey're the Kernel ones} Add to LIBS: -lnddscppz -lnddscz -lnddscorez (in that order) (If you are using dynamic linking, there are no changes required to LIB PATH or LIBS.) In the Build Paths tab, click Generate Make sure all the Substitute paths are unchecked. Next , then manually add the folders containing the RTI Data Distribution Service header files using the Add Folder option: $(NDDSHOME)/include and $(NDDSHOME)/include/ndds Resolve All and make sure there are no more Unresolved Include Direc tives Apply to save the changes, then click to exit the properties menu. Right-click the project, then select Build 11. Run the application as described starting in Step 3 on page 4-4 , except you HelloWorld.out instead of HelloWorld_subscriber.so Step 6 on page 4-4 4.2.3Building and Running an RTI Data Distribution Service Application as a VxWorks Real-Time Process (RTP) There are two ways to build and run your RTI Data Distribution Service RTP application: Using the Command Line (Section 4.2.3.1) Using Workbench (Section 4.2.3.2) 4.2.3.1Using the Command Line Generate the source files and the makefile with rtiddsgen. The architecture names for Kernel Mode and RTP Mode are different. Please refer to the RTI Data Distribution Service User’s Manual for more informa tion on how to use rtiddsgen Set up your environment with the wrenv.sh script in the VxWorks base directory. Build the Publisher and Subscriber modules using the generated makefile. This makefile will work out of the box on a Solaris host; you will have to modify the compiler and linker paths for Linux and Windows hosts. (Note 1: steps 4 to 10 can be replaced by (Note 2: if you want to dynamically link your RTP to the RTI libraries (VxWorks 6.3 and above only), make the following modifications the generated makefile: Then add to the LD_LIBRARY_PATH environment variable the path to your RTI libraries as well as the path to libc.so.1 of your VxWorks installation to launch your RTP successfully.) Launch Workbench. Set the Set the arguments (domain ID and number of samples, using a space separator). A Stack size of 0x100000 should be sufficient. If your application doesn't run, try increasing this value. Run LIBS = -L$(NDDSHOME)/lib/ architecture -non-static -lnddscpp \ -lnddsc -lnddscore $(syslibs_ architecture Building and Running a Hello World Example 4. VxWorks Systems 4.2.3.2Using Workbench Create a new Real Time Process Project; make sure the Managed build option is checked and choose the PPC32gnu UMgnu Copy the source files an d headers generated by rtiddsgen into the project direc tory. There can only be one main() in your project, so you must choose between a subscriber or a publisher. If you want to run both, you will need two create 2 dif ferent projects. Right-click the project in Workbench, then select to see the files. Right-click the project and go to Properties , then select Build Properties Build Macros to DEFINES: -DRTI_VXWORKS -mlongcall to LIBPATH: -L/{your path to the ndds libraries, make sure they are the RTP ones} for static linking: for dynamic linking (VxWorks 6.3 and above only): In the Build Paths tab, click Make sure all the Substitute paths are Next , then manually add the folders containing the RTI Data Distribution Service header files using the Add Folder option: $(NDDSHOME)/include and $(NDDSHOME)/include/ndds Resolve All and make sure there are no more Unresolved Include Direc Apply to save the changes, then click to exit the properties menu. 10. Right-click the project, then select Build 11. Run the application as described starting in Step 4 on page 4-6 -lnddscppz -lnddscz -lnddscorez -non-static -lnddscpp -lnddsc -lnddscore (in that order) 5. VxWorks 653 This chapter provides simple instructions on how to configure a kernel and run RTI Data Distribution Service applications on a VxWorks 653 Pl atform 2.x system. Please refer to the documentation provided by Wind River Systems for more information, as well as RTI Data Distribution Service Platform Notes A platform provider , who develops the platform An application developer , who develops applications A system integrator For more information on these roles, please see the VxWorks 653 Configuration and Build This document assumes the above distributi on of development responsibilities, with DDS being a part of the application. This viders, application developers, and system integrators. For platform providers , this document indicates what your system must provide to RTI Data Distribution Service . Platform providers must provid e a platform that application developers will use to create the application. The provided platform must support For system integrators , this document describes how to combine the platform from the platform provider, and the application from the application developer, and create the system to be deployed. System integrators mu st create an integration project using the module OS and partition OS provided by the platform provider, and the application provided by the application provider. To cr eate a system capable of running DDS appli- cations, the system integrator needs to create a ConfigRecord considering the require- ments noted in Step 2 on page 5-8 For someone creating a DDS application , this document provides an example from the ground up. Install Workbench. ple, for sbc8641Vx653-2.3gcc3.3.2, co 5.2Creating DDS Applications This section contains instructions for crea ting DDS applications for the sbc8641Vx653- 2.3gcc3.3.2 platform. The procedure is the sa me for all VxWorks 653 platforms, but the actual values used in the configuration may vary. Create an integration project with two partitions (one for the publisher, one for the subscriber). Follow the instructions from Wind River for doing this. The fol lowing screenshots will guide you through the process. Creating DDS Applications 5. VxWorks 653 Create a new Workbench project. For Build type, select Integration Project Create a project named helloWorld in the workspace. Select the appropriate Board Support package. Make sure the debug Build spec is selected. This example assumes the wrSbc8641d board support pack age is selected. Creating DDS Applications 5. VxWorks 653 Select the default options for adding the ConfigRecord, ModuleOS, and Parti tionOS. Make sure the “ Add a reference to the corresponding project checkbox is selected. Create two partitions, helloWorld_publisher and helloWorld_subscriber create a DDS publisher and subscriber application, respectively. Make sure the “Add a reference to the corresponding project” checkbox is selected. Creating DDS Applications 5. VxWorks 653 Now you are ready to create the Integration Project. Finish to create the Integration project. This will create an integration project with ConfigRecord, ModuleOS, Parti tionOS and two partitions, helloWorld_ publisher and helloWorld_subscriber. helloWorld_ConfigRecord- wrSbc8641d_default.xml and make the changes noted below. By default, the file opens in design mode. You may wish to switch to source mode, which makes it easier to copy and paste sections, which is required in later steps. Under Applications: i.Change the application name from wrSbc8641d_part1 to helloWorld_publisher ii.Under MemorySize: Creating DDS Applications 5. VxWorks 653 (4).For C++ only: Change the MemorySize tag so it ends with ‘ ’ (not ‘ ’). Within MemorySize, add: Close MemorySize with . It should look like this when you are done (the actual values may be different): iii.Create a copy of the application helloWorld_publisher and rename it helloWorld_subscriber Under Partitions: i.Change the partition name from wrSbc8641d_part1 to helloWorld_publisher ii.Change the Application NameRef from wrSbc8641d_part1 to helloWorld_publisher iv.Create a copy of the partition application helloWorld_publisher and rename it helloWorld_subscriber . Change its ID to and its Application NameRef to helloWorld_subscriber Under Schedules: i.Rename PartitionWindow PartitionNameRef from wrSbc8641d_part1 to helloWorld_publisher ii.Create a copy of the PartitionWindow, and change PartitionNameRef to helloWorld_subscriber iii.Add another PartitionWindow, with PartitionNameRef “ SPARE . This partition window schedu les the kernel, allowing time AdditionalSection Name=".gcc_except_table" Size="0x2000" Type="DATA"/ MemorySize MemorySizeBss="0x1000" MemorySizeText="0x4f0000" MemorySizeData="0x1000" MemorySizeRoData="0x90000" AdditionalSection Name=".gcc_except_table" Size="0x2000" Type="DATA"/ /MemorySi&#x/6.7;&#xMemo;&#xrySi;.7z;ze iv.Optionally: (1).If you want only of the applications to run (helloWorld_publisher helloWorld_subscriber), then you only need a partition window for the one you want to run. (2).If you do not want the DDS application to run immediately when the system boots up, change the sche dule ID to non-zero and add a SPARE schedule with ID 0. Under HealthMonitor: i.In PartitionHMTable Settings, change TrustedPartition NameRef from wrSbc8641d_part1 to helloWorld_publisher . This is an optional field, so it can even be removed from the configuration. ii.Optionally, change the ErrorActions from hmDefaultHandler , in case you want the partitions to stop and not restart on exceptions. Under Payloads: i.Change PartitionPayload NameRef from wrSbc8641d_part1 to helloWorld_publisher ii.Create a copy of the PartitionPayload, and change to helloWorld_subscriber Save the changes to wrSbc8641d_default.xml In helloWorld_ModuleOS-Kernel Configuration: hardware-peripherals-hard disks- development tool components- debug utilities [INCLUDE_DEBUG_UTIL] This is needed to enable worker tasks. ponents, and any other components you want to include in the ModuleOS. Save the changes to Kernel Configuration. Note: See the Platform Notes RTI_DDS_PlatformNotes.pdf ) for a complete list of required kernel components for each platform. Creating DDS Applications 5. VxWorks 653 Generate example code with rtiddsgen Create a directory to work in. In this example, we use a directory called In the myhello directory, create a file called HelloWorld.idl that contains a user defined data type: Use the rtiddsgen utility to generate sample code and a makefile as described Generating Code with rtiddsge n (Section 4.3.2.1) in the Guide . Choose either C or C++. struct HelloWorld { string128ኆ&#x.700; msg; rtiddsgen -language C -example architecture HelloWorld.idl rtiddsgen -language C++ -example architecture HelloWorld.idl For this release, the supported architectures are sbc8641Vx653-2.3gcc3.3.2 and Edit the generated example code as described in Generating Code with rtiddsgen (Section 4.3.2.1) in the Import generated code into the application. Right-click helloWorld_publisher and select Import In the Import wizard, select General-File System , then click Browse to the myhello directory. Select the generated files, except HelloWorld_subscriber Import Right-click usrAppInit.c Repeat the same process for helloWorld_subscriber, this time importing HelloWorld_subscriber instead of HelloWorld_publisher. Configure properties for the application. Right-click helloWorld_publisher and select Properties i.Select Build Properties in the selection list on the left. ii.In the Build Macros tab: Add a new macro, NDDSHOME iii.For C++ only: In the Build Tools tab, select Build tool: Change Suffixes to iv.Click Creating DDS Applications 5. VxWorks 653 For C: Right-click helloWorld_publisher For C++: Right-click helloWorld_publisher-pm Select In the Build Macros tab, add -DRTI_VXWORKS -DRTI_VX653 to DEFINES. In the Build Paths tab, add these Include directories: ii. iii. -I$(NDDSHOME)/include iv. -I$(NDDSHOME)/include/ndds Creating DDS Applications 5. VxWorks 653 i.For C++ only, add: (1). ii.Add iii.Add iv.For C++ only: $(NDDSHOME)/lib/sbc8641Vx653- 2.3gcc3.3.2/libnddscpp.so Repeat the same process for helloWorld_subscriber. Build the Integration Project. 5.3Running DDS Applications If the DDS applications are in schedule 0, they will start up automatically, and you should see the publisher and subscr iber communicating with each other. If the DDS applications are not in schedule 0, use this command to change to the desired schedule: