Chapter 5. About application projects
Table of Contents
5.1. eCos C/C++ Application Projects
eCos C/C++ Application Projects are Eclipse/CDT Application
projects which are associated with a specific
eCos Configuration
Project. These projects are automatically rebuilt if any
changes are made to their associated eCos Configuration
Project and inherit certain C/C++
Build
properties from this associated project such as
the environment variable ECOS_INSTALL_DIR
,
which points to the install
subdirectory of the eCos build, as well as the toolchain (compiler,
linker and assembler) flags defined by the eCos configuration
and toolchain executables defined by the eCosPro Profile
of the associated eCos Configuration
Project.
5.2. Application project options
When creating an eCos application project within Eclipse, you have a fundamental choice to make:
Managed make projects are recommended for new users. All source code files within the project are implicitly considered to be part of the application and, in most cases, no further configuration is required. Compilation of these projects is fully managed by Eclipse.
To use this sort of project for your application, create a C/C++ project of type eCos Managed Make Application.
Standard make projects are for users who prefer to write a GNU makefile, or for situations where customised build steps are needed. The wizard offers to create a template makefile with eCos-specific build settings, which we strongly recommend; of course, you can customise as necessary.
To use this sort of project for your application, create a project of type Makefile project. Then either the eCos Makefile Project subtype can be used to create a project with a template makefile to use as a starting point, or the Empty Project subtype can be used to create a completely empty project. In either case, ensure you select as your toolchain the !eCos toolchain for standard make projects.
The eCos project creation wizard will automatically set important default properties for the project. For example, if you select a project in the Project Explorer and view its properties by and selecting Properties, then within the C/C++ Build properties you will see an entry for Environment variables. While the wizard provides sensible default values, you may in future wish to modify variables such as
ECOS_INSTALL_DIR
which by default will point into the eCos Configuration Project you selected at project creation time; or thePATH
which is used to search for the eCos host tools and GNU toolchain executables.Note If changing
ECOS_INSTALL_DIR
to point to a different eCos configuration, then you will probably want to remove or update the reference to the associated eCos Configuration Project. This reference is there to inform Eclipse when a project may need rebuilding because it has a dependent project which has been updated. The procedure for updating this reference is the same as that for Managed Make application projects.
You must also understand what the end result of your project will be. In most cases this will be an executable. In some circumstances it is useful to create a library project for later use by application projects. To create a managed make library project, use the eCos Mangaged Make Library project type, ensuring you also select the eCos toolchain as the toolchain.
Warning | |
---|---|
A library project should be compiled with the same eCos configuration project which will be used to compile the application. If you use a different eCos configuration, the results will be difficult to predict. |
To manage the building of a library yourself use a Makefile
project in the same way as when creating a standard make
application project. But in this case it will be up to you to construct a
makefile which generates the necessary library. The name of the library
must be assigned to the makefile variable TARGET
, for
example:
TARGET = libutils.a
No other project types are supported for use with eCos.
Managed-make application projects are created with what Eclipse calls two build configurations. The Debug configuration is the default; it has debugging symbols enabled and compiler optimization turned off. Release turns on optimization and omits debugging symbols; it is generally only used for performance testing and final deployment builds.
5.3. Application Project Properties
eCosPro C/C++ managed make application and library projects are created with, or inherit, properties that are defined by the associated eCos Configuration Project. These properties may be viewed or edited through the application properties dialog illustrated in Figure 5.1, “eCos Application Properties”.
Figure 5.1. eCos Application Properties
This dialog may be reached by highlighting the eCos application project within the window of the C/C++ perspective through the menu option → (Alt+Enter) or by → .
5.3.1. Project References
When the project references property is highlighted as illustrated in Figure 5.1, “eCos Application Properties”, the right-hand panel will display a list of eCos Configuration Projects with which the application project may be referenced. This reference defines the eCos configuration, eCosPro profile (and hence also eCos toolchain) and build flags, as well as the eCos library with which the application project is compled and linked. An eCos application project may therefore only be associated with a single eCos Configuration Project. To change the associated eCos Configuration Project, deselect the selected configuration project, select the new configuration project and . An error will result if the application project is not associated with a single configuration project, otherwise the application's remaining properties will be updated to those appropriate to the associated eCos Configuration Project. The application will also be rebuilt against these new properties.
By changing the eCos Configuration Project, you can change either the target hardware of the application, or the eCos configuration (for example, between a debug or a release configuration).
5.3.2. C/C++ Build Environment
When the BUILD SYSTEM
, as
described in Section 6.1, “eCos configuration projects”).
CWD
The current working directory under which the application project is to be built.
ECOS_INSTALL_DIR
The installation directory where eCos sub-directories such as
etc
,include
andlib
are installed when the associated eCos Configuration Project is built.PATH
The search path for executables to be used in building the application which will include at its head the paths to the execuable directories of the eCos Host Tools and the GNU Toolchain for the eCosPro Profile with which the referenced eCos Configuration Project is associated.
PWD
The present working directory under which the application project build is initially started. This is normally the same as the
CWD
.
5.3.3. C/C++ Build / Tool Settings
When the eCos Configuration Project as illustrated in Figure 5.2, “C/C++ Build Properties / Tools Settings”.
item within the properties branch is selected or highlighted, the panel on the right will include a tab in which the compiler, assembler and linker commands are defined as well as the flags that are passed to each when each of the application's source files are compiled or assembled, or when the application is linked with the eCos library resulting from the referencedFigure 5.2. C/C++ Build Properties / Tools Settings
The defaults for these settings are inherited from the referenced
eCos Configuration Project, but may be edited in
accordance to the developer's requirements. For example, code
optimisation may be enhanced, or the code may be generated to include
gprof
calls and information.
2020-11-03 | Legal Notice |