1.7. Creating and Building a General Purpose Platform Project on Wind River Workbench 3.x

In this tutorial we will create and build a project for the Wind River General Purpose Platform (GPP) for VxWorks. We have arbitrarily chosen to create a Downloadable Kernel Module (DKM) project; the process is almost exactly the same for Real-Time Process (RTP) projects.

Building a GPP 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.7.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.

1.7.1.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.7.1.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.7.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:

new project menu

We want the DKM project creation wizard so we click on the wizard named “VxWorks Downloadable Kernel Module Project” to select it.

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

new DKM project wizard project name page

Enter the name of the new project (we used “test”, again 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 builder characteristics. You should choose the default “Flexible” build mechanism. Ordinarily the option to use “Standard” managed builds for a new project should be disabled.

Press Next.

new DKM project wizard build setup

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

new DKM project wizard build support

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” because we have a PPC board and GNAT is a GNU compiler. *Be sure to select the GNU version of any given build spec.*

new DKM project wizard 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.

new DKM project wizard build target

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.

new DKM project wizard indexer

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

created project in Project Explorer

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:

tutorial\_file\_new\_other

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.

tutorial\_conversion\_wizard\_page1.png

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

The first page asks for the GNAT project unit name. This is not the gpr file name. Rather, it is the name of the unit (the project) within the gpr file.

Unlike the Eclipse project name, the GNAT project unit name must be a legal Ada identifier. The wizard will try to make a legal Ada name from the Eclipse project name, for example, by substituting underscores for dashes. If the Eclipse project name is already a legal Ada identifier that name is used unchanged, as in this case:

project conversion project unit name page

The next page asks for the name of the Ada main program, if any:

project conversion ada main subprogram page

Enter the name of the Ada main subprogram – not the file name – and press Next. In this case we have entered the name “test_main”. Note that a main program is not required. We have also chosen to have the wizard generate the source code for the procedure.

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

tutorial\_project\_dirs\_dialog.png

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.

tutorial\_project\_build\_settings\_dialog.png

After conversion, note the presence of the new makefile in the Project Explorer. This is a makefile fragment that will automatically invoke the Ada compiler and other builder tools when the Workbench project builder is invoked. It 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, “test_main.adb”, and will contain a procedure with that unit name:

tutorial main subprogram in editor

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.7.3. Building the Project

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

tutorial\_menu\_build\_project.png

A popup will appear. Just press “Continue”.

initial popup when building project

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

content of Build Console after successful build

1.7.4. Congratulations

That’s it! You have created and built a DKM project with Ada sources.