1.11. Creating and Building a General Purpose Platform Project on Wind River Workbench 4.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.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.

1.11.1.1. Perspective Selection

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

1.11.1.2. Preparing a source build or image project

Prior to be able to create a Downloadable Kernel Module (DKM) or a Real-Time Process (RTP) project, you need to have available a Kernel Image project or a pre-built VSB project.

To create them, see menu “File” > “New” > “Wind River Workbench Project...” and “Build type:” equal to Source Build and Kernel Image

1.11.2. Creating and Configuring the Project

The first step is to invoke the wizard. In the System Development perspective, use the menu bar and select “File”, then “New”, and finally “Wind River Workbench Project...”.

The Workbench wizard will open so that you can choose “Downloadable Kernel Module” build type. (see figure below).

new project wizard DKM build type page

Click “Next >” button.

Another wizard page will appear, allowing you to select the project name and location.

new project wizard DKM project name page

Enter the name of the new project (we used “test_dkm”, 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 configure the project context.

new project wizard DKM project context page

Select the project (image project or source build) to be used as base project.

You can now press Finish.

If the current Active Build Spec (see menu “Project” > “Build” > “Set Active Build Spec...”) of your new project is not a GNU spec and a GNU spec is available, change the active build spec to the GNU one.

You may be asked to rebuild the C/C++ index. (see below) Press “Yes” to rebuild. C/C++ Index can be rebuilt later running the menu “Project” > “C/C++ Index” > “Rebuild”.

rebuild C/C++ index

The new project is now ready to be converted to support Ada language, you should see it in the Project Explorer, like so:

The new project will be created and you will see it in the Project Explorer, like so:

created project in Project Explorer

Next convert the new project to support Ada via GNATbench. To do this, select the new project in “Project Explorer” view and invoke “File” > “New” > “Other...” menu.

Then select “Convert to an Ada Project” in the resulting dialog and press “Next >”.

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

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

tutorial\_menu\_build\_project.png

The following popup may appear. Just press “OK”.

initial popup when building project

The following popup may appear. Just press “Continue”.

set include search path

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.11.4. Congratulations

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