1.12. Creating and Building a VxWorks MILS Integration Project

In this tutorial we will create and build a project for Wind River VxWorks MILS. The system comprises two VxWorks Guest OS virtual boards running mixed language Ada/C applications, a virtual board providing multiplexed I/O using AMIO and ‘wrmonitor.exe’, and a High Assurance Environment virtual board running a simple Ada/C mixed language application.

Creating a VxWorks MILS project for Ada development is easy with GNATbench and the Wind River wizards for creating MILS 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.12.1. Prerequisites

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

  • Workbench and VxWorks MILS
  • GNAT Pro High-Integrity Edition for VxWorks MILS
  • GNATbench for Workbench
  • QEMU, on your path and with its BSP installed under your VxWorks MILS installation, if targeting QEMU for MILS.

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.

Steps specific to the use of QEMU for this exercise will appear as needed.

1.12.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.12.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.12.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.12.3. Installation Preparation

These steps need only be performed once per board support package.

If your BSP is qemu, make sure it is installed according to the directions that come with its distribution package.

Create the virtual board boot application vbElfBoot.bin by opening the VxWorks MILS Development shell ($WIND_HOME/wrenv.sh -p vxworks-mils-2.1 or %WIND_HOME%\wrenvw.exe -p vxworks-mils-2.1, depending on your development host’s OS).

cd $WIND_HOME/vxworks-mils-vbbooter-1.0

or

cd %WIND_HOME%\vxworks-mils-vbbooter-1.0

make BSP=your BSP name

1.12.4. Integration Project

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

tutorial\_mils\_new\_integration\_project\_menu

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

tutorial\_mils\_new\_int\_project\_page1

Select the appropriate BSP from the dropdown list. In this case we are targeting QEMU:

tutorial\_mils\_new\_int\_project\_page2

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

tutorial\_mils\_new\_int\_project\_in\_explorer

Note the “config” folder in the new project. It contains XML files describing the project configuration.

The example directories and files used in this tutorial (supplied with GNAT Pro) also include a “config” directory containing XML files. These files will be used to update those that are located in the “config” folder within the new project. To do so, we will next import them into the Workbench project.

Right-click on the “Integration” 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.

Browse to the MILS example that comes with the compiler. Note that the location of the example will be different from that which is depicted in the figure below. Expand the “Integration” subdirectory and then select the “config” directory within, and, if targeting QEMU, the “qemu-boot” directory. (Make sure you do not select the entire “Integration” directory itself.) Note that the file “qemu-boot/start.s” has been customized for this example system. Do not use the version of the file that comes with the QEMU distribution example.

Also be sure to select “Makefile”. For an integration project, ordinarily you must modify the Makefile generated by Workbench to identify the directories containing the components of the system image (makefile variable PAYLOAD_PATH). The Makefile that comes with this example already takes care of this.

On that same page, enable the “Overwrite existing resources without warning” check-box in the “Options” panel.

The figure below shows the resulting wizard page for the QEMU usage case, after the directories and the Makefile file have been selected and the overwrite option enabled. (The location of the folder containing these files will be part of the GNAT Pro installation on your system.)

tutorial\_mils\_importing\_config\_files

Press Finish when ready.

The files and directories will be imported into the project. (Recall that this is the QEMU usage scenario. Your project will look slightly different if you are not targeting QEMU.)

tutorial\_mils\_config\_files\_imported

After importing, edit the “Makefile” file found in the “qemu-boot” folder. Specifically, change the definitions of the macro values for “CC” and “OBJCOPY” that appear on the first two lines, if they are not already as depicted below. In the following figure we have commented the original definitions and inserted the new, changed definitions:

tutorial\_mils\_qemuboot\_makefile\_after

Once changed, save and close the file.

If you are targeting QEMU, edit another “Makefile” file as well. This aditional file is the “Makefile” located in the root of the “Integration” project. Change it to enable variables and rules needed to build the QEMU boot image. Before the change, the Makefile will appear as follows:

tutorial\_mils\_makefile\_before

Uncomment all of the lines following “# rules for qemu boot image”

After making these changes, the file will appear as shown in the figure below (again, this is when targeting QEMU):

tutorial\_mils\_makefile\_after1

If you are targeting QEMU, right-click on the Integration project and select “Properties”. Select the “Build Properties” page and then the “Build Specs” tab. If your QEMU build spec does not exist, press the “New” button to the right to add it. Then select it as the active build spec and press “Apply” (not “OK”, since we are not finished yet). In our case we are using QEMU for a PPC, so the build spec is named “qemu-PPC604gnu”. The figure below shows the dialog to add that build spec.

tutorial\_mils\_new\_qemu\_buildspec

Once the QEMU build spec is defined, select it as the active build spec (and the default too).

Further, again only if you are targeting QEMU, in this same dialog box select the “Build Macros” tab, select the qemu build spec from the “Active build spec” pull-down list, and enter the following build macros’ values:

tutorial\_mils\_new\_qemu\_buildmacros

Press “OK”.

We will specify project references while creating the remaining projects for the system.

1.12.5. VxWorks MILS Kernel Image Project

If you do not already have a suitable kernel image in your workspace, follow these instructions to create one.

Create a new kernel image project using the “VxWorks MILS Kernel Image Project” new-project wizard:

tutorial\_mils\_new\_kernel\_project\_wiz

Name the new project “milsKernel” in the resulting first wizard page:

tutorial\_mils\_new\_kernel\_project\_page1

Press “Next”.

Select the BSP. If you are targeting QEMU, add it as a build spec (if necessary) and select it for the active build spec. In this case, the build spec will be the BSP name “qemu”. On the Build Macros page, set BSP to “qemu” and TOOL to “gnu”.

tutorial\_mils\_new\_kernel\_project\_page2

Press “Finish” and the new kernel image project will be created.

tutorial\_mils\_new\_kernel\_project\_in\_explorer

In the Project Explorer, select the milsKernel project and drag it into the Integration project to make it a subproject. Once that is done, the projects will appear as follows:

tutorial\_mils\_after\_kernel\_subproject

1.12.6. VxWorks Guest OS Virtual Boards

The following steps are to be performed for each of the “sender”, “receiver” and “amioServer” virtual boards, with one exception. The “amioServer” project should not be extended for use by GNATbench as it runs a pure C application providing multiplexed I/O to the other virtual boards.

First, right-click on the existing “Integration” project. *This approach to invoking the wizard is essential.* Then, in the contextual menu, select the “VxWorks MILS VxWorks Guest OS Application Project” new-project wizard:

tutorial\_mils\_new\_guest\_os\_project\_wiz

Name the new project “sender” in the resulting first wizard page:

tutorial\_mils\_new\_guest\_os\_project\_page1

Press “Next”.

Click the checkbox “Add reference to Integration”.

tutorial\_mils\_new\_guest\_os\_project\_page2

Press “Next” repeatedly until you get to the “Build Specs” page. Uncheck any build specs you don’t need and select the one you wish to use in the “Active build spec” pull-down:

tutorial\_mils\_new\_guest\_os\_buildspec\_page

Press “Next”.

Set the build target and binary output names to “sender” if not yet set. Make sure the builder is set to “Linker” in the drop-down text box.

tutorial\_mils\_new\_guest\_os\_buildtarget\_page

Press “Finish”.

The new VxWorks Guest OS project will be created and will appear nested within the “Integration” project. In the figure below, we have expanded it to show the contents:

tutorial\_mils\_sender\_in\_explorer

Next we import the project content from the example directories in the file system outside the workspace, much like we did for the XML files and Makefile for the “Integration” project.

Right-click on the “sender” project node and select “Import...” from the contextual menu.

tutorial\_mils\_sender\_import\_init.png

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.

Browse to the “sender” folder under the same “mils_example” folder that you used to import the “Integration” directory contents earlier. The “sender” folder must be the only folder on the left panel in the dialog, as shown in the following figure. This is important because you do not want to import the “sender” folder itself, just the files within it and the “src” folder (and its contents) underneath it.

tutorial\_mils\_initial\_import\_sender.png

Click on the plus sign next to “sender” to display the expanded contents in the dialog box. The dialog will appear as follows:

tutorial\_mils\_import\_sender\_expanded.png

Put a check-mark next to the “src” folder in the left-hand pane. This will ensure the “src” folder and all its files will be imported. Next, in the right-hand pane, place check-marks in each of the files within the “sender” folder. The “sender” folder will have a green box rather than a check-mark, indicating that its contents are checked, but that the folder itself is not to be imported. This state is depicted in the following figure:

tutorial\_mils\_import\_sender.png

(Note that, when following these steps for the “amioServer” project, that project does not have a source directory to import so just import the files immediately within the “amioServer” directory.)

Ensure the option “Overwrite existing resources without warning” is enabled. If you forget, simply allow any files (such as the file named “usrAppInit.c”) to be overwritten when warned during the actual import processing.

Press “Finish”.

The sender project will now appear as depicted in the next figure. Note how the “src” folder appears immediately underneath the “sender” project itself, as do the imported files such as “sender.gpr” and the replacement “usrAppInit.c”, among others. In other words, we did not import the “sender” folder when we imported its contents.

tutorial\_mils\_import\_sender\_complete.png

Next, we create a folded named “obj” that is used to hold intermediate compilation products, such as object files. If you neglect this step, it’s harmless, but you will get a warning when converting the project to a GNATbench project. The directory will be created when building the project. (Note that the amioServer project does not need this folder added). Simply right-click on the “sender” project node and select “New”, then “Folder”:

tutorial\_mils\_sender\_file\_new\_folder.png

With the “sender” folder highlighted in the resulting dialog, name the new folder “obj” and press “Finish”.

tutorial\_mils\_sender\_file\_new\_folder2.png

We next extend the “sender” project for GNATbench Ada development.

Right-click on the “sender” project to invoke the contextual menu, select “New”, and then “Other”, as shown in this figure:

tutorial\_mils\_invoke\_sender\_conversion.png

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, use the pull-down menu to specify “sender” as the project to convert, rather than “Integration”.

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

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

tutorial\_mils\_convert\_sender\_to\_gnatbench\_page1

Press the “Finish” button and the project will be enhanced for GNATbench use.

For the sake of brevity, assume we have repeated the above steps for the “receiver” and “amioServer” virtual boards (but did not extend the “amioServer” project for GNATbench).

Once all these Guest OS projects are created, they will appear in the Project Explorer as illustrated in the figure below:

tutorial\_mils\_all\_guest\_projects\_explorer

1.12.7. High Assurance Environment Virtual Board

This section provides the steps for importing a mixed language application for execution in the High Assurance Environment (HAE).

First, right-click on the existing “Integration” project. *This approach to invoking the wizard is essential.* Then, in the contextual menu, select the “VxWorks MILS High Assurance Environment Application Project” new-project wizard:

tutorial\_mils\_new\_hae\_project\_wiz

Name the new project “baremetal” in the resulting first wizard page:

tutorial\_mils\_new\_hae\_project\_page1

Press “Next”.

Click the checkbox “Add reference to Integration”.

tutorial\_mils\_new\_hae\_project\_page2

Press “Next” repeatedly until you get to the “Build Specs” page. Uncheck any build specs you don’t need and select the one you wish to use in the “Active build spec” pull-down:

tutorial\_mils\_new\_hae\_buildspec\_page

Press “Next”.

Set the build target and binary output names to “baremetal”. Make sure the builder is set to “Linker” in the drop-down text box.

tutorial\_mils\_new\_hae\_buildtarget\_page

Press “Finish”.

The new HAE project will be created and will appear nested within the “Integration” project. In the figure below, we have expanded it to show the contents:

tutorial\_mils\_baremetal\_in\_explorer.png

Using the Project Explorer, delete the file “main.c” from the project.

Next we import the project content from the example directories in the file system outside the workspace, much like we did for the XML files and Makefile for the “Integration” project.

Right-click on the “baremetal” project node and select “Import...” from the contextual menu.

In the resulting dialog box, select “File System” under the “General” category, as usual.

Press Next to invoke the “File System” wizard. Browse to the “baremetal” directory below the “mils_example” directory in the supplied example. You will see this directory at the end of the selection for the “From directory:” panel in the figure below. As a result, the “baremetal” directory will be the root of the directories displayed at the left of the dialog box:

tutorial\_mils\_initial\_import\_baremetal.png

Click the box next to “baremetal” to place a check-mark in the box.

Click the plus-sign next to “baremetal” to expand the tree to verify that the “src” folder is also selected.

Once these steps have been taken, all the files immediately within the “baremetal” directory (on the right) will have check-marks next to them. Likewise, all the files immediately within “src” will have check-marks next to them. This state is depicted in the following figure:

tutorial\_mils\_import\_baremetal.png

Press “Finish”.

The “baremetal” project will now appear as depicted in the next figure:

tutorial\_mils\_import\_baremetal\_complete

Next, we create a folder named “obj” that is used to hold intermediate compilation products (such as object files). This step is not strictly necessary, but if you skip it you will get a harmless warning when converting to a GNATbench project. In that case, the folder will be created when first building the project.

Simply right-click on the “baremetal” project node and select “New”, then “Folder”. With the “baremetal” folder highlighted in the resulting dialog, name the new folder “obj” and press “Finish”.

tutorial\_mils\_baremetal\_file\_new\_folder

We next extend the “baremetal” project for GNATbench Ada development.

Right-click on the “baremetal” project to invoke the contextual menu, select “New”, and then “Other”, as shown in this figure:

tutorial\_mils\_invoke\_baremetal\_conversion

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 “baremetal” as the project to convert.

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

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

tutorial\_mils\_convert\_baremetal

Press the “Finish” button and the project will be enhanced for GNATbench use.

The Explorer now shows all projects in place:

tutorial\_mils\_all\_projects\_explorer

1.12.8. Building the Integration Project

Before building the first time, you must change some of the scenario variables from their default values. Use the Scenario Variables view to make the changes. (See Scenario Variables View for how to set scenario variables in the view. Likewise, see Scenario Variables for the scenario variable concept itself.)

Specifically, you must check the BINDING and RUNTIME scenario variables for all three projects for specific values. (Changing values invokes some automatic processing that make change the focus to another view. In that case simply put the focus back to the Scenario View to make any other changes.

Set the BINDING variables to “apex_mils” for the purpose of this tutorial. For the baremetal project, set the RUNTIME to “zfp”, the “zero-foorprint” run-time library. For the sender and receiver projects, check that RUNTIME is set to either “full” or “ravenscar-cert”. After you verify the values, the Scenario Variables view will appear as follows:

tutorial\_mils\_scenario\_vars\_after\_change

Note that you need not make these changes every time you build. Only the initial change is required.

You can now build the entire system by selecting the “Integration” project, right-clicking to invoke the contextual menu, and selecting “Build Project”. You can also build the projects individually using the same technique.

A pop-up dialog box will appear the first time a project is built. Press the “Continue” button; the build will then proceed.

The following figure illustrates what to expect in the Build Console as one of the individual projects (the “sender” project) is built:

tutorial\_mils\_sender\_built

Similary, the figure below illustrates what to expect in the Build Console as the “Integration” project is built (for QEMU in this case). We show only the last part of the build, for lack of space.

tutorial\_mils\_integration\_built

1.12.9. Congratulations

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