--------------------------------- Creating and Configuring Projects --------------------------------- .. toctree:: Importing Existing GNAT Projects ================================ Importing existing GNAT projects (i.e., those defined by a GNAT project file), is accomplished using a wizard provided by GNATbench. Two steps are required. - Create a new Wind River Workbench project to contain the imported GNAT project - Import the existing GNAT project into the new Wind River Workbench project Strictly speaking you do not need to create a new Wind River project each time you import an existing GNAT project. You can use an existing Wind River project that is not already extended for GNATbench. The point is that the Wind River project that will contain the imported GNAT project must already exist before importing begins. **In any case, the name of the existing Wind River project must match that of the GNAT project to be imported.** For example, if you import a GNAT project file named "ms1553\_demo.gpr", the Wind River Workbench project must be named "ms1553\_demo". Otherwise the project build command will not invoke the Ada builder. That being the case, creating a new Wind River project is the most likely approach. Once the Wind River project is ready, invoke the import wizard using either the "File" menu and selecting "Import...", or use the contextual menu in the Project Navigator and again selecting "Import..." The first approach is illustrated below. .. image:: images/wrs_file_import_menu.png :align: center :alt: file import menu A new wizard page will appear (shown below), allowing you to choose which import wizard to apply. Workbench defines a number of import wizards so you may need to expand the "Ada" category. Select "Existing GNAT Project" and press Next. .. image:: images/wrs_import_wizard_selection_page.png :align: center :alt: import wizard selection page On next wizard page you will make a number of configuration choices that involve changing the default options. It is vital that you make the proper choices when using this general import wizard in the context of Workbench. The wizard page and default options are as shown in the following figure. .. image:: images/import_gnat_proj_selection_page.png :align: center :alt: import gnat project selection page First, in the "Location of the root project" text entry pane, specify the location of the GNAT project file (the "gpr file") defining the project you intend to import. You may enter the path manually or you can browse to it via the button to the right of the text entry pane. Next, you are presented with the choice of whether to import the GNAT project into an existing Workbench project or into a new Workbench project. As indicated earlier, **be sure to use the option to import into an *existing* Workbench project.** Do *not* use the default selection for importing into a new Workbench project. Otherwise the wizard would create a new project that is not a Wind River Workbench project. Also, as indicated earlier, this existing Wind River Workbench project must have the **same project name** as the GNAT project being imported. Finally, when importing the GNAT project, the wizard will attempt to import all the resources it references, such as source folders and files, and binary folders. This same page allows you to choose whether the wizard should copy these external resources into the workspace version of the project, or whether the workspace version should only contain "links" to the resources. **Be sure to select the option to *copy* the resources into the workspace.** Do *not* use the default selection for linking the resources into the workspace. This choice is necessary as long as "Standard" managed builds are used by GNATbench. The figure above shows the default selection of using links, which is typically the right option for an existing external project but should not be used with "Standard" managed builds. The following figure illustrates the appropriate choices for a GNAT project named "sdc" to be imported into an existing Workbench project of the same name: .. image:: images/import_gnat_proj_selection_page_actuals.png :align: center :alt: import\_gnat\_proj\_selection\_page\_actuals Press Finish after making all these choices. The existing GNAT project will be imported into the existing Wind River Workbench project and all the Ada operations will be enabled. Note that you may have to modify the GNAT project file imported by the wizard. For example, you might need to re-specify the location of the executable (a directory) if the original GNAT project file specified it with an absolute path. Similarly, the GNAT project file might specify multiple main programs or other properties that should be changed. *Note that a main program is typically required for building GPP Ada projects under Workbench.* After importing the GNAT project into the existing Workbench project, it will appear in the Project Explorer as a regular GNATbench project: .. image:: images/imported_gnat_project.png :align: center :alt: imported\_gnat\_project Using Non-Default Ada Source File Names ======================================= By default, GNAT compilers require a specific Ada source file naming convention. In this default convention, "spec" files (those containing declarations) have an extension of ".ads" and "body" files (those containing completions) have an extension of ".adb" (i.e., 's' for "spec" and 'b' for "body"). GNATbench uses the convention for a given project when displaying and operating upon source files. For example, double-clicking on a file invokes the Ada language-sensitive editor only if the file has an extension indicating that it is indeed a source file. Similarly, only those files recognized as source files are displayed in source folders within the GNAT Project Explorer. You can change the default Ada source file naming convention used by any given project. To make the change requires two steps: - You must specify the new naming scheme in the GNAT project file (the "gpr file"), and - You must associate the file extension with the AdaCore language-sensitive editor within Eclipse itself. Specifying the Naming Scheme In the Project File ------------------------------------------------ For the first step, you can use the GUI dialog to specify the naming scheme in the project properties. To invoke the dialog, right-click on the project node in the GNAT Project Explorer, select "GNAT Project", then select "Edit Properties" as shown below. Note that the first time you invoke the dialog it may take a little while to appear. .. image:: images/invoke_edit_gnat_properties.png :align: center :alt: invoke\_edit\_gnat\_properties.png In the resulting dialog, select the Naming tab: .. image:: images/gnat_properties_gui_naming_tab.png :align: center :alt: gnat\_properties\_gui\_naming\_tab.png There are a few alternative naming schemes already defined. Active the pull-down menu to see these alternatives. If one of them matches your scheme you simply select that scheme and press OK to finish. Press OK when asked if you want to save the project file changes. .. image:: images/gnat_properties_gui_naming_pulldown.png :align: center :alt: gnat\_properties\_gui\_naming\_pulldown.png If none of the predefined schemes match your convention you may create a new convention by selecting "custom" in the pull-down list, giving the scheme a new name to replace "custom" and then specifying the details of the convention in the various "Details" entry panes. In the following figure we have selected a common scheme in which spec file names end with an underscore, both kinds of file end with ".ada", and dots in Ada unit names are replaced by a a double underscore. .. image:: images/gnat_properties_gui_naming_vax_scheme.png :align: center :alt: gnat properties naming underscore scheme The GUI makes your changes effective by modifying the GNAT project file (the "gpr file") if you choose to save the changes. In this case, it either adds or changes a package named "Naming" within the file. For the above selections these changes would look like the following: .. image:: images/gpr_file_with_nondefault_naming_package.png :align: center :alt: gpr\_file\_with\_nondefault\_naming\_package.png As an alternative to the GUI, you may also simply edit the gpr file manually and insert the package Naming and its contents. Associating the File Name Extension with the Ada Editor ------------------------------------------------------- For the second step, you set the file associations via Eclipse preferences. Specifically, invoke the Window menu and select Preferences to invoke the dialog. Then expand the General and Editors categories. You should now see a choice "File Associations" underneath the Editors category. Click it to open that page. .. image:: images/file_association_dialog.png :align: center :alt: file\_association\_dialog.png In that page you will see a list of file name extensions on the upper part of the page, and associated editors in the lower part. If your extension is not defined, click the Add button to open a new dialog and specify your extension (e.g., "\*.ada", but without the quotes). For example, the following figure illustrates the Add button dialog with "\*.ada" specified: .. image:: images/adding_ada_file_name_extension.png :align: center :alt: adding\_ada\_file\_name\_extension.png Press OK to close the Add extension dialog. Then, back in the File Associations page of the original dialog, select your new extension in the upper part of the page and press the other Add button, the one for the editors in the lower part of the page. Another popup will appear, in which you will select "AdaCore's Ada Editor": .. image:: images/file_association_editor_selection_dialog.png :align: center :alt: file\_association\_editor\_selection\_dialog.png Press OK to close the editor selection dialog. The completed association will appear in the File Associations page: .. image:: images/file_association_dialog_completed.png :align: center :alt: file\_association\_dialog\_completed.png Press OK again to close the Preferences dialog and you're done. .. _project-setup-converting-to-gnatbench: Extending Existing Wind River Workbench Projects for Ada ======================================================== You must extend a newly created Wind River Workbench project to support Ada via GNATbench. This need only be done once, before invoking any Ada operations. To extend the project, invoke the contextual menu on the new project node and select "New", then "Other", as shown below: .. image:: ../getting_started/images/tutorial_file_new_other.png :align: center :alt: tutorial\_file\_new\_other Then select "Convert to an Ada Project" in the resulting dialog and press OK. .. image:: ../getting_started/images/tutorial_extend_for_gnatbench_use.png :align: center :alt: conversion wizard for extending project The first page of the conversion wizard will appear as shown in the next figure. The defaults are as shown (we have arbitrarily named our project "test"). .. image:: images/conversion_wizard_page1_default.png :align: center :alt: conversion\_wizard\_page1\_default.png This first wizard page presents one of the primary extension options: the origin of the GNAT project file. - The first option (":ref:`project-setup-converting-to-gnatbench-use-local`") is used when a GNAT project file is already located within the existing Workbench project. This could be the case, for example, when you have used the Eclipse file system resource importer to bring in files and folders from the external file system (or perhaps via a configuration management system). The point here is that you did not use the GNAT project import wizard to bring in the GNAT project file. The distinction will be clear momentarily. - The second option (":ref:`project-setup-converting-to-gnatbench-use-external`") is applicable if you have an existing external GNAT project (i.e., not a Wind River Workbench project) and want to make it into a Workbench VxWorks project. You direct the wizard to import it by selecting this option, in which case all of the resources defined by the external GNAT project are imported as well -- the source files, source and other binary folders (to the extent possible), and so forth. - The last option (":ref:`project-setup-converting-to-gnatbench-create-new`") is applicable if you are creating a completely new project and do not have an existing GNAT project upon which to base it. **Note** **When not using the option of creating a new GNAT project file, you are responsible for maintaining the integrity of the GNAT project file regarding the resources it references and the relationships required for the project.** For example, the GNAT project file name must match the Workbench project name. The project will not build correctly if the names do not match. Note that you can simply rename the GNAT project file in the Explorer but that, as a result, you must then edit the file contents so that the project name matches the file name. (The name of a GNAT project file must always match the name of the project within the file.) Each of the options is discussed in the following sections. Click on the following option names to go to the corresponding description: .. _project-setup-converting-to-gnatbench-use-local: The "Use a local GNAT project file" Option ------------------------------------------ You may either manually enter the name and location of the existing external GNAT project file, or use the "Search Project" button to specify it (click on the option itself if the button is not enabled). The following figure illustrates the case in which an existing GNAT project file exists in the workspace. In this specific case the GNAT project file already matches the Workbench project name so no changes are required in that regard. In fact, when the wizard was invoked the existing GNAT project file was detected and entered in the text entry pane by default. .. image:: images/conversion_wizard_page1_use_local.png :align: center :alt: conversion\_wizard\_page1\_use\_local.png Once the project file is specified there is nothing else required for the wizard to convert the project. However, the "Finish" button is not enabled until we actually choose the option we want, even though the radio button indicates the first option. 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.* Remember that resources described by the GNAT project file are not created automatically with this option. For example, the project file may specify an "objects" folder. That folder must exist, so you will have to create it if it does not already exist in the workspace project. You may also need to specify a VxWorks Ada toolchain when using this option. This change will be required if the existing GNAT project file does not specify the toolchain required for the build spec (or build specs) to be used by the project. To make this change, right-click on the project node and select "Properties" from the contextual menu. In the resulting dialog, select "GNATbench Properties". This selection will show the page in the following figure. We have set the toolchain to use the PowerPC Ada compiler. Remember that more than one toolchain can be selected. .. image:: images/converted_proj_set_toolchain.png :align: center :alt: converted\_proj\_set\_toolchain.png Typically all these potential changes will not be required because the project is already set up but is simply not yet a GNATbench project. A project checked out from a configuration management system would be an example. .. _project-setup-converting-to-gnatbench-use-external: The "Import an external GNAT project file" Option ------------------------------------------------- In this case there is an existing GNAT project and project file outside of the workspace that we want to make into a Workbench VxWorks project. Because the Workbench project name and the GNAT project file names must match, we created the Workbench project using that same name, before invoking the conversion wizard. .. image:: images/initial_project_before_conversion_import.png :align: center :alt: initial\_project\_before\_conversion\_import.png We then invoke the conversion wizard, select the project to be converted, and select the option to import an external project file: .. image:: images/conversion_wizard_page1_import_external.png :align: center :alt: conversion\_wizard\_page1\_import\_external.png We can then press the "Finish" button to end this first part of the conversion. Doing so will invoke another GNATbench wizard to finish the process. The next page presented will ask for the location of the existing external GNAT project file. You can either manually enter the path, or browse for it. .. image:: images/conversion_wizard_external_proj_location.png :align: center :alt: conversion\_wizard\_external\_proj\_location.png The project will appear as follows, after the wizard finishes: .. image:: images/converted_project_after_import_external.png :align: center :alt: converted\_project\_after\_import\_external.png **Note** When importing the GNAT project file, the wizard will attempt to import all the resources it references, such as source folders and files, and binary folders. This same page allows you to specify whether the wizard should copy these external resources into the workspace version of the project, or whether the workspace version should only contain "links" to the resources. **Be sure to select the option to copy the resources into the workspace.** This choice is necessary as long as "Standard" managed builds are used by GNATbench. The figure above illustrates having selected the option to make a distinct copy. (By default the "linked" resources option is selected.) If you do accidentally choose the option for "linked" resources, the wizard will honor that request but Workbench will detect that "Standard" managed builds are in use and will warn you accordingly: .. image:: images/conversion_wizard_linked_file_popup.png :align: center :alt: conversion\_wizard\_linked\_file\_popup.png A linked project will have little "arrow" decorators attached to the folder and file nodes: .. image:: images/converted_project_linked_resources.png :align: center :alt: converted\_project\_linked\_resources.png Subsequent build attempts will then fail, as depicted by the following figure: .. image:: images/converted_project_linked_build_failure.png :align: center :alt: converted\_project\_linked\_build\_failure.png .. _project-setup-converting-to-gnatbench-create-new: The "Create a new GNAT project file" Option ------------------------------------------- This option will have the wizard walk you through the steps of defining a new project, including source and object folders, main program, and so forth. The wizard will then create those files and folders and will create a new GNAT project file accordingly. .. image:: ../getting_started/images/tutorial_conversion_wizard_page1.png :align: center :alt: tutorial\_conversion\_wizard\_page1.png Press Finish. Since we chose to create a new GNAT project file, a "new project" wizard is invoked automatically. In the new wizard's first page you specify the unit name of the GNAT project. This is not the name of the file, also known as the "gpr file." Rather, it is the name of the unit inside the gpr file. The name you enter is displayed within a project unit declaration in a text frame, as you enter it, to make clear the use for the name requested. .. image:: ../getting_started/images/tutorial_new_project_unit_name_page.png :align: center :alt: new project wizard unit name The unit name need not be the same as the Eclipse project name, but it must be a legal Ada identifier. An error is indicated in the wizard page if this is not the case for the name you enter. The wizard will attempt to convert the Eclipse project name into a legal Ada identifier but might not succeed. In that case you must manually change the name, but, again, the unit name can be different from the Eclipse project name. Pressing Next takes you to the wizard page for entering the main program unit name: .. image:: ../getting_started/images/tutorial_ada_main_name_dialog.png :align: center :alt: 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. .. image:: ../getting_started/images/tutorial_project_dirs_dialog.png :align: center :alt: 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. .. image:: ../getting_started/images/tutorial_project_build_settings_dialog.png :align: center :alt: 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: .. image:: ../getting_started/images/tutorial_main_subprogram.png :align: center :alt: tutorial main subprogram in editor Using Wizards To Create New GPP Projects ======================================== .. toctree:: Creating a Downloadable Kernel Module (DKM) Project on Wind River Workbench 3.x ------------------------------------------------------------------------------- Creating a DKM project for Ada development is easy with the Wind River wizard and GNATbench project converter. 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. .. image:: ../getting_started/images/standard_build_enable_pref.png :align: center :alt: enabling standard build pref page 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: .. image:: ../concepts/images/new_project_menu.png :align: center :alt: new project menu We want the DKM project creation wizard so we click on the wizard named "VxWorks Downloadable Kernel Module Project". The Workbench wizard will open so that you can configure the new DKM project (see figure below). .. image:: images/wrs_dkm_wizard_projname.png :align: center :alt: 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. .. image:: images/wrs_dkm_wizard_build_setup.png :align: center :alt: 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. .. image:: images/wrs_dkm_wizard_build_support.png :align: center :alt: 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.*** .. image:: images/wrs_dkm_wizard_build_spec.png :align: center :alt: 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. .. image:: images/wrs_dkm_wizard_build_target.png :align: center :alt: 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. .. image:: images/wrs_dkm_wizard_indexer.png :align: center :alt: 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: .. image:: ../getting_started/images/tutorial_created_project.png :align: center :alt: created project in Project Explorer Extending the Project for Ada and GNATbench ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Finally, you must extend the new project to support Ada via GNATbench. *This step is essential.* This step must be performed before any functionality for Ada builds, language-sensitive editing, et cetera is invoked. See :ref:`project-setup-converting-to-gnatbench` for the extension process. In the extension wizard you will likely want to select the option "Create a new GNAT project file". This option will walk you through the steps of defining a new project, including source and object folders and so forth, and will create everything you specify. Once the project is converted to a GNATbench project it is ready for use. All the previous Wind River Workbench functionality is still available, and all the additional Ada functionality has been integrated. Creating a Real Time Process (RTP) Project on Wind River Workbench 3.x ---------------------------------------------------------------------- Creating an RTP project for Ada development is easy with the Wind River wizard and GNATbench project converter. 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. .. image:: ../getting_started/images/standard_build_enable_pref.png :align: center :alt: enabling standard build pref page 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: .. image:: ../concepts/images/new_project_menu.png :align: center :alt: new project menu We want the RTP project creation wizard so we click on the wizard named "VxWorks Real Time Process Project". The wizard will open so that you can configure the new RTP project: .. image:: images/wrs_rtp_wizard_projname.png :align: center :alt: new RTP project wizard project name page Enter the name of the new project and choose where the new project files will reside. Typically this location will be the workspace so you can take the default, but otherwise take one of the other choices as appropriate. 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. .. image:: images/wrs_rtp_wizard_build_setup.png :align: center :alt: new RTP 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. .. image:: images/wrs_rtp_wizard_build_support.png :align: center :alt: new RTP project wizard build support The next page (below) allows you to configure the build spec (or specs) for the project. Select one or more, depending on your given hardware. ***Be sure to select the GNU version of any given build spec.*** Press Next once you have made your selections. .. image:: images/wrs_rtp_wizard_build_spec.png :align: center :alt: new RTP 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. .. image:: images/wrs_rtp_wizard_build_target.png :align: center :alt: new rtp 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. .. image:: images/wrs_rtp_wizard_indexer.png :align: center :alt: new RTP 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: .. image:: images/new_rtp_project_before_conversion.png :align: center :alt: new rtp project before conversion Extending the Project for Ada and GNATbench ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Finally, you must extend the new project to support Ada via GNATbench. *This step is essential.* This step must be performed before any functionality for Ada builds, language-sensitive editing, et cetera is invoked. See :ref:`project-setup-converting-to-gnatbench` for the extension process. In the extension wizard you will likely want to select the option "Create a new GNAT project file". This option will walk you through the steps of defining a new project, including source and object folders and so forth, and will create everything you specify. Once the project is converted to a GNATbench project it is ready for use. All the previous Wind River Workbench functionality is still available, and all the additional Ada functionality has been integrated. Note the file containing the main subprogram. This file will have the name we specified, "test\_rtp.adb", and will contain a procedure with that unit name: .. image:: images/rtp_main_subprogram_in_editor.png :align: center :alt: rtp 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. Creating a Downloadable Kernel Module (DKM) Project on Wind River Workbench 4.x ------------------------------------------------------------------------------- Creating a DKM project for Ada development is easy with the Wind River wizard and GNATbench project converter. Preparing a source build or image project ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Prior to be able to create a Downloadable Kernel Module (DKM) 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 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). .. image:: images/wrs_dkm_wrwb4_wizard_build_type.png :align: center :alt: new project wizard DKM build type page Click "Next >" button. Another wizard page will appear, allowing you to select the project name and location. .. image:: images/wrs_dkm_wrwb4_wizard_project_name.png :align: center :alt: 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. .. image:: images/wrs_dkm_wrwb4_wizard_project_context.png :align: center :alt: 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, change the active build spec. You may be asked to rebuild the C/C++ index. (see below) Press "Yes" to rebuild. You can rebuild index later running the menu "Project" > "C/C++ Index" > "Rebuild". .. image:: images/rebuild_c_cpp_index.png :align: center :alt: 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: .. image:: images/new_dkm_wrwb4_project_before_conversion.png :align: center :alt: created project in Project Explorer Extending the Project for Ada and GNATbench ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Finally, you must extend the new project to support Ada via GNATbench. *This step is essential.* This step must be performed before any functionality for Ada builds, language-sensitive editing, et cetera is invoked. See :ref:`project-setup-converting-to-gnatbench` for the extension process. In the extension wizard you will likely want to select the option "Create a new GNAT project file". This option will walk you through the steps of defining a new project, including source and object folders and so forth, and will create everything you specify. Once the project is converted to a GNATbench project it is ready for use. All the previous Wind River Workbench functionality is still available, and all the additional Ada functionality has been integrated. Building the Project ~~~~~~~~~~~~~~~~~~~~ To build the project, select it in the "Project Explorer" view and run on of the following menus. - "Project" > "Build Project" from main menu bar. - "Build Project" or "Rebuild Project" from project's contextual menu. You may be asked to generate the include search paths. (See below) Click "Continue" to build your new Downloadable Kernel Module (DKM) with Ada sources. .. image:: ../project_setup/images/set_include_search_path.png :align: center :alt: set include search path Creating a Real Time Process (RTP) Project on Wind River Workbench 4.x ---------------------------------------------------------------------- Creating an RTP project for Ada development is easy with the Wind River wizard and GNATbench project converter. Preparing a source build or image project ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Prior to be able to create 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 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 "Real Time Process Application" build type. (see figure below). .. image:: images/wrs_rtp_wrwb4_wizard_build_type.png :align: center :alt: new project wizard RTP build type page Click "Next >" button. Another wizard page will appear, allowing you to select the project name and location. .. image:: images/wrs_rtp_wrwb4_wizard_project_name.png :align: center :alt: new project wizard RTP project name page Enter the name of the new project (we used "test", arbitrarily) Typically this location will be the workspace so you can take the default, but otherwise take one of the other choices as appropriate. Press Next. Another wizard page will appear, allowing you to configure the project context. .. image:: images/wrs_rtp_wrwb4_wizard_project_context.png :align: center :alt: new project wizard RTP 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, change the active build spec. You may be asked to rebuild the C/C++ index. (see below) Press "Yes" to rebuild. You can rebuild index later running the menu "Project" > "C/C++ Index" > "Rebuild". .. image:: images/rebuild_c_cpp_index.png :align: center :alt: rebuild C/C++ index Delete the rtp.c file to avoid "multiple definition of \`main'" build error. The new project is now ready to be converted to support Ada language, you should see it in the Project Explorer, like so: .. image:: images/new_rtp_wrwb4_project_before_conversion.png :align: center :alt: new rtp project before conversion Extending the Project for Ada and GNATbench ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Finally, you must extend the new project to support Ada via GNATbench. *This step is essential.* This step must be performed before any functionality for Ada builds, language-sensitive editing, et cetera is invoked. See :ref:`project-setup-converting-to-gnatbench` for the extension process. In the extension wizard you will likely want to select the option "Create a new GNAT project file". This option will walk you through the steps of defining a new project, including source and object folders and so forth, and will create everything you specify. Once the project is converted to a GNATbench project it is ready for use. All the previous Wind River Workbench functionality is still available, and all the additional Ada functionality has been integrated. Note the file containing the main subprogram. This file will have the name we specified, "test\_rtp.adb", and will contain a procedure with that unit name: .. image:: images/rtp_main_subprogram_in_editor.png :align: center :alt: rtp 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. Building the Project ~~~~~~~~~~~~~~~~~~~~ To build the project, select it in the "Project Explorer" view and run on of the following menus. - "Project" > "Build Project" from main menu bar. - "Build Project" or "Rebuild Project" from project's contextual menu. You may be asked to generate the include search paths. (See below) Click "Continue" to build your new Real Time Process (RTP) containing ada code. .. image:: ../project_setup/images/set_include_search_path.png :align: center :alt: set include search path