1.11. Creating and Building a VxWorks DO-178B Platform Project

In this tutorial we will create and build a “static kernel module” (SKM) project for the Wind River VxWorks DO-178B Platform. The process is very similar to creating a regular downloadable kernel module (DKM) project.

Building a Cert project for Ada development is easy with GNATbench. The wizard will create and configure the project for us and invoking the builder is simply a matter of selecting a command.

1.11.1. 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. 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. 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.11.2. Creating and Configuring the Project

The first step is to invoke the wizard. In the Application Development perspective, use the menu bar and select “File”, then “New”, and then the list of project types will be displayed in the menu, as shown in the following figure:


We want the SKM project creation wizard so we click on the wizard named “VxWorks Cert Static Kernel Module Project [Cert kernel]” to select it.

The Workbench wizard will open so that you can configure the new SKM project (see figure below).


Enter the name of the new project (we used “demo”, arbitrarily) and choose to have the new project files reside in the default workspace location. Press Next.

Another wizard page will appear, allowing you to select the build type. *You must use the default “Flexible” managed build type.* Ordinarily the option to use “Standard” managed builds for a new project should be disabled, as shown below. If “Standard” managed builds are enabled, do not choose that type of build for the new project.

Press Next.


The next page (below) allows you to configure the build command and how the result is processed. Take all the defaults and press Next.


The next page (below) allows you to configure the build spec for the project. We first press “Deselect All” because we only want one build spec for this tutorial because we only have one type of board available. Then we selected “PPC604gnu_CERT” because we have a PPC board and GNAT is a GNU compiler. (Note that older versions of VxWorks DO-178B will not offer the “_CERT” build specs.) *Be sure to select the GNU version of any given build spec.*


The next page (below) allows you to configure a build target name and tool for the project. Take all the defaults and press Next.


The next page (below) allows you to configure the source code indexer for the project. This is a C++ tool so it is not pertinent to GNATbench projects. You can either take all the defaults and press Next, or disable the indexer altogether. It will not cause difficulties later if you choose to take the defaults. In the figure below we show how to disable the indexer.


You can now press Finish. The new project will be created and you will see it in the Project Explorer, like so:


Next we convert the new project to support Ada via GNATbench. To do this, we invoke the contextual menu on the new project node and select “New”, then “Other”, as shown below:


We then select “Convert to an Ada Project” in the resulting dialog and press OK.

conversion wizard for extending project

The first page of the conversion wizard will appear (shown in the next figure). We enter the name of the new project and select the option to create a new GNAT project file.


We then press Finish.

Since we chose to create a new GNAT project file, another wizard is invoked.

The new-project wizard first asks us to specify the unit name of the GNAT project (not the file name), that is, the name within the gpr file.


The next wizard page allows us to specify the name of the main program, if we choose to have one.


Enter the name of the Ada main subprogram – not the file name – in the text entry pane. In this case (above) we have entered the name “demo_main”.

On that same page we have chosen to have the wizard generate the source code for the procedure. You need not do so if you already have a main procedure that you will import later, or if you simply want to write it yourself. Note that we do *not* take the additional option to have the generated main procedure be a “Hello World” example because the code would use constructs outside the language subset supported by the ZFP runtime library. Without this option the generated procedure simply has a null body.

Press Next

The next page allows selection of the directories that will hold sources and intermediate products. We take all the defaults.


The final page allows selection of one or more toolchains to be available to the project. The appropriate toolchain for the project’s selected build spec will be enabled by default, but can be changed. Multiple toolchains can be convenient for a number of reasons. For example, a project baseline compiler version can be used to build the actual release but a newer version of the same toolchain can also be used for the sake of improved error analysis. This page also allows selection of a “production” and “debug” scenario, in which different switches are applied (e.g., debugging versus optimization) depending on the current development mode. Other build options are also available on the page. We take the defaults and simply press Finish.


After conversion, the project will appear as follows:


Note the presence of the file named “gnat.makefile” and the file named “scenario.makefile” in the Project Explorer. These are makefiles that will automatically invoke the Ada compiler and other builder tools when the Workbench project builder is invoked. *These files must not be deleted.*

Also note the “src” folder containing the main subprogram. This file will have the name we specified via the unit name, “demo_main.adb”, and will contain a procedure with that unit name:


In a real application we would alter the content of the main subprogram. It is a buildable subprogram, though, without any changes, so for the purpose of this tutorial we can leave it as it is.

1.11.3. Building the Project

In the Project Explorer, right-click to bring up the contextual menu. Select “Build Project”.


A popup will appear. Just press “Continue”.


The build will then proceed and you can watch it in the Build Console. A sample successful build will look like the following:


1.11.4. Selecting the Run-Time Library

As generated, the “gnat.makefile” content will use the Zero Footprint (ZFP) run-time library, and the other option, the Ravenscar-Cert library, is commented out. This original state is illustrated below, on lines 16 and 17:


You may edit the makefile to control the library selection each time you want to change it, or you may use a scenario variable. The latter approach is strongly recommended so we will illustrate it here.

First, modify the makefile (just once) so that lines 16 and 17 are now both commented out, and a new line, 18, is added:


Save and close the makefile.

Next, edit the gpr file (named “demo.gpr”) to declare the new scenario variable referenced on line 18 of the makefile. In the figure below, we have added lines 3 and 4:


Save and close the gpr file.

With these changes in place, the SKM will be built with the ZFP run-time library by default. If you want to build with the ravenscar-cert library, simply change the value of the variable with the GUI via the Scenario Variable view. (See Scenario Variables View for how to set scenario variables in the view. Likewise, see Scenario Variables for the scenario variable concept itself.)

To do so, open the Scenario Variables view (if not already open) by invoking “Window”, then “Show View”, then “Other”:


In the resulting dialog pop-up, select “Scenario Variables”:


Press OK.

The Scenario variables view will appear, showing the current selection for CERT_RUNTIME to be “zfp”:


Click on the arrow to the right of the value to show the pull-down list of possible values for the “CERT_RUNTIME” variable. Select “ravenscar-cert” from the list. Once set, the variable will look like the following in the view:


Now, when we build the SKM demo project the ravenscar-Cert runtime library will be used. This change can be seen in the following figure:


1.11.5. Integration Within A “Cert Kernel” Image Project

You may integrate an SKM project into a VxWorks Cert image project just as you would in other versions of VxWorks: you right-click on the SKM project and select “Project References”, then “Add as Project Reference...”, and then select the superproject name from the resulting dialog box. Building and cleaning the superproject will then also build and clean the enclosed subprojects. Note that the BSP for the subprojects must be compatible with the image superproject, otherwise those subprojects will be ignored when building.

In addition, however, you must also take the following steps:

  • Edit the “usrAppinit.c” file so that it calls the generated Ada entry point (the name of the Ada main procedure, with an appropriate pragma Export applied)
  • Add the “-nostdlib” switch to the default switches of package Linker in the SKM gpr file

1.11.6. Congratulations

That’s it! You have created and built an SKM project with Ada sources.