1.9. Creating and Building a VxWorks 653 2.x Integration Project

In this tutorial we will create and build a project for Wind River VxWorks 653. We will create and build two application projects and one integration project that encapsulates the two application projects.

Creating a VxWorks 653 project for Ada development is easy with GNATbench and the Wind River wizards for creating 653 projects. The wizards will create and configure the projects for us, with only a little subsequent manual configuration required. Invoking the builder is simply a matter of selecting a command, as usual.

1.9.1. Prerequisites

To use GNAT Pro and GNATbench for VxWorks 653 you need to have the following:

  • Workbench for VxWorks 653
  • GNAT Pro High-Integrity Edition for VxWorks 653
  • GNATbench for Workbench

This tutorial shows how to build an example that is provided with the GNAT compiler. You can follow these steps, if you choose to do so, using the source files and XML files provided there.

Note that in this tutorial, all new projects created through the Workbench wizards must be created in the same workspace.

1.9.2. Workspace Configuration

These initial settings must be done for each new workspace used. You will only have to do this once per workspace unless the preferences are somehow reverted.

Start Workbench.

1.9.2.1. Perspective Selection

Use the Window menu entry and select “Open Perspective”, then select “Advanced Device Development”. Of course you may skip that step if you are already using that perspective.

1.9.2.2. Disabling “Standard” Managed Builds

As of Wind River Workbench 3.0, “Flexible” managed builds are used by default and “Standard” managed builds are deprecated. New GNATbench projects must employ Flexible managed builds.

Therefore, set the options on the Wind River “Build” preference page as shown below to disable Standard managed builds. You must also ensure the option to “Create default build targets for new projects using flexible managed build” remains enabled.

enabling standard build pref page

1.9.3. Preliminary Project Setup

In order to ease the configuration process, we will put all the required xml configuration files from the example into a general Eclipse project within the workspace. The sole purpose of this project is to act as a container for these files and to make these files easily accessible.

First create a new project by selecting New and then Project to invoke the new-project wizard selection dialog, expanding the General category (if necessary) there, and then selecting Project under that, as shown below:

tutorial\_653\_general\_project\_wizard

Press Next to choose that specific wizard.

In the resulting dialog box, name this new project “config” and click Finish. The new project will be created.

Next, import the XML files from the directory containing the example into the new “config” project. To do so, right-click on the “config” project node and select “Import...” from the contextual menu. In the resulting dialog box, select File System under the General category:

tutorial\_653\_import\_file\_system

Press Next to invoke the File System wizard. You should then browse to the location of the example provided with your GNAT Pro installation. By default, this location would be “C:\GNATPRO\version#\share\examples\platform#\Workbench\apex_raven”, where “version#” is the GNAT Pro version you installed, such as “6.3.1”, for example; and “platform#” is “powerpc-wrs-vxworksae”, “e500v2-wrs-vxworksae” or “i586-wrs-vxworksae”. The figure below shows the browser window and the selection of the “config” directory there:

tutorial\_653\_import\_file\_system

Once you have selected the “config” directory press OK. Put a check-mark in the box next to “config” in the left-hand pane. The figure below shows the resulting wizard page:

tutorial\_653\_importing\_config\_files

Press Finish and the files will be imported into the “config” project in the workspace:

tutorial\_653\_config\_files\_imported

1.9.4. Updating imported module.xml file

Depending on your installed Wind River VxWorks 653 Platform, the Board Support Package (BSP) used in imported module.xml file may not be supported.

To get the BSP used by imported module.xml file, open the module.xml file and check what file is included in the “CoreOS” xml element.

To get supported BSPs, list subdirectories found in $(WIND_BASE)/target/config directory.

If required, change module.xml to use a supported platform. Only simpc, wrSbc750gx, wrSbcP4080 and wrSbc8548 have been tested with this example; other BSPs may require more substantial changes.

You will have to select the board support package used by module.xml file when configuring the board support package of the project base in “Project Setup” page during VxWorks 653 projects creation.

1.9.5. Creating and Building the Module OS Project

Use the menu bar and select File, then New, and then the list of project types will be displayed in the menu. Select “VxWorks 653 Module Operating System Project”, as shown in the following figure:

tutorial\_653\_new\_mos\_project\_menu

In the resulting dialog box, name the new project “coreOS” and click Next.

tutorial\_653\_new\_mos\_project\_page1

In the next page, select your board support package and build spec. Use the board support package of the imported module.xml file.

On that same page, click on the Advanced button.

Select “Use XML module file” and point it to the “module.xml” file located in the config project we just created.

Set the kernel name to “coreOS”. (It has to match the name given in the “module.xml” file.)

The wizard page will appear as follows:

tutorial\_653\_new\_mos\_project\_page2

Click Finish. The wizard will compute the necessary properties and create the new project. (This may take a little while.) It will appear as follows:

tutorial\_653\_new\_mos\_project\_in\_explorer

Using the “Kernel Configuration” node in the “coreOS” project, you could add any additional components required. No additional components are needed for this tutorial.

Note, however, that if you want to use a terminal server, you must use the Kernel Configuration interface to add the following components (for those not already present):

  • INCLUDE_DEBUG_CORE
  • INCLUDE_EXC_SHOW_INIT
  • INCLUDE_KERNEL_FULL
  • INCLUDE_KERNEL_UTIL
  • INCLUDE_KERNEL_SHOW
  • INCLUDE_LOADER
  • INCLUDE_LOADER_EXTRA
  • INCLUDE_NET_SYM_TBL
  • INCLUDE_BOOT_LINE_INIT
  • INCLUDE_SHELL
  • INCLUDE_SHELL_VI_MODE
  • INCLUDE_SYM_TBL_INIT
  • INCLUDE_USR_FS_UTILS

These components are equivalent to

%WIND_BASE%\target\config\comps\vxWorks\sysTemplates\vxKernel\targetTools.ddf

Next, build the “ADD_NEEDED” target by right-clicking on the target in the Project Explorer and selecting Build Target.

tutorial\_653\_build\_add\_needed

A dialog box may pop up, indicating that the C++ index needs to be rebuilt to reflect these changes. Select Yes.

Note

This C/C++ Index changed dialog may be displayed later.

tutorial\_653\_index\_changed\_dialog

Finally, build the “coreOS” project itself. To do so, right-click on the project node in the Project Explorer and select Build Project:

tutorial\_653\_build\_mos\_project

The build will appear in the Build Console view, as follows:

tutorial\_653\_build\_mos\_project\_console

1.9.6. Creating and Building the Partition OS Project

Use the menu bar and select File, then New, then Project... so that the list of project types will be presented. Expand the “VxWorks 653” category, if necessary, and select “VxWorks 653 Partition Operating System Project”, as shown in the following figure.

tutorial\_653\_new\_pos\_project\_menu

In the resulting dialog box, name the new project “vxSysLib” and click Next.

tutorial\_653\_new\_pos\_project\_page1

In the next page, select your board support package and build spec. Use the board support package of the imported module.xml file.

On that same page, click on Advanced.

Select “Use XML module file” and point it to the “module.xml” file located in the config project.

Ensure the Shared library name is “vxSysLib”. (It must match the name given in the “module.xml” file.)

The wizard page will appear as follows:

tutorial\_653\_new\_pos\_project\_page2

Click Finish. The wizard will compute the necessary properties and create the new project. It will appear as follows:

tutorial\_653\_new\_pos\_project\_in\_explorer

The Ada applications use an APEX library that is not included by default by the Workbench wizard. To include it, take the following steps:

In the Project Explorer, double-click on the “vxSysLib.xml” file located in the “vxSysLib” project to open the file in an editor. Then use the “Source” or “vxSysLib.xml” tab at the bottom of the editor to switch to the source view, and add the following line to the list of interfaces (you can copy and paste this text):

<xi:include href="$(WIND_BASE)/target/vThreads/config/comps/xml/apex.xml"/>

After inserting the line, the file will appear as illustrated below. Line 10 is the newly inserted line:

tutorial\_653\_edited\_newpos\_xml\_file

Save and close the file.

Next, double-click on the project’s “Makefile.vars” file to open an editor, then add the following line to the end of the file (you can copy and paste this text):

SSL_OBJS += apexComponent.o

After inserting the line, the file will appear as illustrated below. Line 13 is the newly inserted line:

tutorial\_653\_edited\_makefilevars\_file

Save and close the file.

You can then build the “vxSysLib” Partition OS project. Right-click on the project node in the Project Explorer and select Build Project:

tutorial\_653\_build\_pos\_menu

The build will appear in the Build Console view as usual.

tutorial\_653\_build\_pos\_project\_console

1.9.7. Creating and Building the Application Projects

There are two Ada applications in this example: “sender” and “receiver”. Each application is located within a separate, dedicated Workbench project.

The following steps are described for the “sender” application. After completing these steps, follow the same steps for the “receiver” application, replacing “sender” by “receiver” in each instance.

Use the menu bar and select File, then New, then Project... so that the list of project types will be presented. Expand the “VxWorks 653” category if necessary, then select “VxWorks 653 Application Project”, as shown in the following figure:

tutorial\_653\_new\_app\_project\_menu

In the resulting dialog box, name the new project “sender” and click Next.

tutorial\_653\_new\_app\_project\_page1

In the next page, select your board support package and build spec. Use the board support package of the imported module.xml file.

On that same page, click on Advanced.

Select “Use XML module file” and point it to the “module.xml” file located in the config project.

Set the Application name to “sender”. (It must match the name given in the “module.xml” file.)

The wizard page will appear as follows:

tutorial\_653\_new\_app\_project\_page2

Click Finish. The wizard will compute the necessary properties and create the new project. It will appear as shown below:

tutorial\_653\_new\_sender\_project\_in\_explorer

1.9.7.1. Import Ada Resources

Next, import the Ada sources from the sender application in the example to this new “sender” project. To do so, we use the file system import wizard just as we did when importing the XML files into the “config” project in the workspace.

Right-click on the “sender” project node and select “Import...” from the contextual menu. In the resulting dialog box, select File System under the General category:

tutorial\_653\_import\_file\_system

Press Next to invoke the specific wizard. The figure below shows the resulting wizard page after the “sender.gpr” file, the “src” sources folder, and the “obj” objects folder have been selected. (The location of the folder containing these files will also be part of the GNAT Pro installation on your system, as was the case earlier.)

tutorial\_653\_importing\_sender\_files

Press Finish and the folders and files will be imported into the project in the workspace:

tutorial\_653\_sender\_files\_imported

The “obj” folder must be manually created because the Import wizard will not import empty directories. To do so, right-click on the “sender” project node, select New, and then select Folder. In the resulting dialog box (see figure below), ensure “sender” is selected, enter the new folder name (“obj”), and press Finish.

tutorial\_653\_create\_obj\_folder

1.9.7.2. Configure for GNATbench Support

Next, the application project should be configured to support Ada specific activities. This support requires the project to be configured for GNATbench use.

Right-click on the “sender” project to invoke the contextual menu, select New, then Other, expand the “Ada” category if necessary, and then finally select “Convert to an Ada Project”.

tutorial\_653\_convert\_to\_gnatbench\_menu

Press Next.

In the resulting dialog, specify “sender” as the project to convert.

On the same page, select “Use a local GNAT project file” and specify “sender.gpr”.

The wizard page, when filled out, will appear as illustrated by the figure below:

tutorial\_653\_convert\_sender\_to\_gnatbench\_page1

Click the Finish button and the project will be enhanced for GNATbench use. The project will appear as follows:

tutorial\_653\_converted\_sender\_project

Note

The application procedure to be invoked from vxMain is automatically added to Workbench USER_APPL_INIT macro. It is provided to Workbench through ADDED_CFLAGS variable. (see below from generated gnat.makefile)

# Cause main generated by gprbuild to be invoked from vxMain

ADDED_CFLAGS = “-DUSER_APPL_INIT=$(MAIN)()”

1.9.7.3. Configure for Partition OS Interface Use

You will next indicate that the application project will use the interface provided by the Partition OS.

Right-click on the “sender” project node in the Project Explorer and select “Properties” from the contextual menu. In the resulting dialog, select the “Build Properties” category in the left-hand pane, then the “Build Macros” tab (for PSC 2.3.*) or “Variables” (for PSC 2.4.*) tab on the top. See the figure below.

tutorial\_653\_build\_macros

Click the New button located in the top right of the pane. A dialog will open, as shown in the following figure:

tutorial\_653\_new\_macro\_dialog

As shown, specify a new build macro named “SSL_NAME” and set its value to “vxSysLib”, the name of the Partition OS project. Press OK. The “Build Properties” page will then appear as follows:

tutorial\_653\_sender\_new\_build\_macro

Still in the Properties dialog, select the “Project References” category on the left-hand side of the dialog and insert a check-mark to enable a reference to “vxSysLib”.

tutorial\_653\_sender\_property\_newpos\_ref

Press the OK button to apply the changes and close the Properties dialog.

The projects will now appear differently in the Project Explorer as shown below. Note, in particular, how the “vxSysLib” project is now indicated as a referenced project for “sender”, instead of a stand-alone root project:

tutorial\_653\_sender\_after\_newpos\_ref

1.9.7.4. Select the Ada Runtime Library and APEX Binding

Next open the Scenario Variables view (if not already open). To do so, first invoke the “Window” menu, then the “Show View” submenu. The Scenario Variables view may be presented in the list of views for opening directly, as shown below. If the view is not one of those presented for selection, press “Others...” and “Ada” to get to the Ada-specific views.

tutorial\_653\_open\_scenariovar\_view

Select “Scenario Variables” and then press OK.

Once open, by default the view will appear in the same group as the Build Console, Problems, and Tasks views. See Scenario Variables View for how to set scenario variables in the view. Likewise, see Scenario Variables for the scenario variable concept itself.

Scenario variable can be set in two different modes: either “<set environment to use this value>” or “<set project specific value>”. In this tutorial, we will use the former.

Change the “BINDING” scenario variable from “apex” to “apex_zfp”. You will have to scroll down in the list of values to make that selection, as shown below:

tutorial\_653\_apex\_zfp\_pulldown

Similarly, select “ravenscar-cert” for the “RUNTIME” variable in the Scenario Variables view. (Note that you may need to scroll down, as before, in the list of values. Once set, the variables will look like the following in the view:

tutorial\_653\_sender\_scenariovars\_set

Also select your platform with the “PLATFORM” variable.

You can then build the “sender” project. Right-click on the project node and select “Build Project” as usual. If a dialog popup appears, asking whether to set the include path for the project, simply press “Continue”. This dialog will only appear once.

The project build will appear in the Build Console:

You may need to edit manually sender/receiver gnat.makefile if gprconfig fails detecting C & C++ compiler. Remove C & C++ lines from the gprconfig call.

tutorial\_653\_sender\_project\_build

For the sake of brevity assume we have performed the above steps for the “receiver” project. After doing so, the projects will appear in the Project Explorer as follows:

tutorial\_653\_both\_apps\_in\_explorer

The Scenario Variables view will also show both projects’ scenario variables:

tutorial\_653\_both\_apps\_scenario\_vars

1.9.8. Creating and Building the Integration Project

The final step is to create and build the integration project. To create this project we invoke the project creation wizard again. Use the File menu and select New as usual, and then select “VxWorks 653 Integration Project.”

tutorial\_653\_new\_int\_project\_menu

In the resulting dialog box, name the new project “Integration” and click Next.

tutorial\_653\_new\_int\_project\_page1

In the second wizard page, click on Advanced.

Enable “Create from CPU and XML module file(s)” and specify the “module.xml” file located in the “config” project created earlier. The easiest way is to use the Add button to browse to the file. When completed, the wizard page will appear as follows:

tutorial\_653\_new\_int\_project\_page2

Press Next.

The next wizard page (see below) is the Partition Setup dialog.

tutorial\_653\_new\_int\_project\_partition\_page

The VxWorks 653 2.3 and more recent versions, this dialog is the easiest way to set up the integration project. We will not do so in this tutorial, but if you decide to use it here, be sure to enable the option to include the sender, recever, and other projects as sub-project references. (This is the “Add a reference to the corresponding project” option in the Specify dialogs.)

Instead of using the Partition Setup dialog, you can perform the setup steps manually, and in older versions of VxWorks 653 you will have to do so. Therefore, we describe those steps here, as if you did not use the dialog. Instead, we assume you simply pressed Finish.

The wizard will then construct the new project. It will appear in the Project Explorer as follows:

tutorial\_653\_new\_int\_project\_in\_explorer

In the Project Explorer, invoke the contextual menu on the “Integration” project, select Properties to invoke the dialog, and then select the “Project References” page. Add the module OS, partition OS, and two application projects as references. The page will appear as shown in the next figure after these references are set:

tutorial\_653\_int\_project\_properties

Press OK. In the Project Explorer, the “Integration” project will now show the others as referenced projects nested underneath the Integration project node:

tutorial\_653\_int\_project\_refs

Next, double-click on the “Makefile.vars” file (see the figure above) to open it in an editor. Add the following lines to automatically copy the ”.sm” files to the “Integration” project during builds. You can copy and paste the following lines, but be sure to replace the leading blanks with a single *tab* on the four command lines! That change is absolutely essential: the build will fail otherwise.

coreOS.sm: ../coreOS/$(CPU)gnu.debug/coreOS.sm
        $(CP) $(subst /,$(DIRCHAR),$<) $@

vxSysLib.sm: ../vxSysLib/vxSysLib.sm
        $(CP) $(subst /,$(DIRCHAR),$<) $@

sender.sm: ../sender/$(CPU)gnu/sender/Debug/sender.sm
        $(CP) $(subst /,$(DIRCHAR),$<) $@

receiver.sm: ../receiver/$(CPU)gnu/receiver/Debug/receiver.sm
        $(CP) $(subst /,$(DIRCHAR),$<) $@

After the insertion, the file will appear as follows:

tutorial\_653\_int\_project\_makefilevars\_new

(Note that this marks the end of the manual alternatives to the integration Partition Setup dialog.)

You should also add the following lines to the “Makefile.vars” makefile if you want to build a ROM image (to use GNATemulator, for example). For VxWorks 653 version 2.3 and more recent, see the GNATemulator User Guide section on Workbench for a simpler method.

payloadObjs_rom.o: ../coreOS/$(CPU)gnu.debug_romPayload/payloadObjs_rom.o
        $(CP) $(subst /,$(DIRCHAR),$<) $@

As with the earlier fragment, you can copy and paste the lines above, but be sure to replace the leading blanks with a single *tab* on the command line.

(The file “payloadObjs_rom.o” is built via the “payloadObjs” target in the “coreOS” project.)

Finally, copy the “vxSysLib.xml”, “sender.xml”, and “receiver.xml” files located in the config project to the “Integration” project. To do so, open the “config” project in the Project Explorer, control-click on each of the three files, and then right-click on any one of them to invoke the contextual menu. In the menu, select “Copy”.

tutorial\_653\_copy\_xml\_files

Then go back to the “Integration” project and right-click on the project node. Select “Paste”.

tutorial\_653\_paste\_xml\_files

After copying the files, they will appear in the “Integration” project:

tutorial\_653\_final\_int\_project

You are now ready to build the integration project. Build either the “net” or “rom” targets to finalize compilation of the system. For example, right-click on the “net” target and select “Build Target”:

tutorial\_653\_build\_net

The last part of the build will appear in the Build Console as follows:

tutorial\_653\_build\_net\_console

After building the “net” target, the project will appear in the Project Explorer as shown below:

tutorial\_653\_int\_project\_after\_build\_net

1.9.9. Congratulations

That’s it! You have created and built a VxWorks 653 Integration project with Ada applications.

Note that to start the application, you select schedule 1 using the command “arincSchedSet 1” in the host shell.