UseEcos

This module defines variables and macros required to build eCos application.

Macros

This module defines the following macros:

ecos_add_include_directories
ecos_add_include_directories()

Adds the eCos include directories for the current CMakeLists.txt file.

ecos_adjust_directory
ecos_adjust_directory(<var> <sources>...)

Adjusts the paths of given source files <sources>... and stores them into a result variable named <var>.

<var>

Result variable name holding a new list of source files with adjusted paths.

<sources>...

A list of relative or absolute source files to adjust their paths.

Use this macro when the actual sources are located one level upwards. A ../ has to be prepended in front of every source file that is given as a relative path.

ecos_add_executable
ecos_add_executable(<name> <sources>...)

Creates an eCos application executable.

<name>

The name of the executable.

<sources>...

A list of all source files, where the path has been adjusted beforehand by calling the ecos_adjust_directory().

This macro also sets the ECOS_DEFINITIONS local variable, holding some common compile definitions.

Macros for selecting the toolchain:

ecos_use_arm_elf_tools
ecos_use_arm_elf_tools()

Enables the ARM ELF toolchain for the directory where it is called. Use this macro, when compiling for the xscale processor.

ecos_use_i386_elf_tools
ecos_use_i386_elf_tools()

Enables the i386 ELF toolchain for the directory where it is called.

ecos_use_ppc_eabi_tools
ecos_use_ppc_eabi_tools()

Enables the PowerPC toolchain for the directory where it is called.

Variables

Module also defines the following variables:

ECOSCONFIG_EXECUTABLE

Cache variable that contains a path to the ecosconfig executable (the eCos configuration program).

ECOS_CONFIG_FILE

A local variable that defaults to ecos.ecc. If eCos configuration file has a different name, adjust this variable before calling the ecos_add_executable().

Examples

# CMakeLists.txt

include(UseEcos)

# Add the eCos include directories.
ecos_add_include_directories()

# Include the file with the eCos sources list. This file, for example, defines
# a list of eCos sources:
#   set(sources file_1.cxx file_2.cxx file_3.cxx)
include(../ProjectSources.txt)

# When using such directory structure, relative source paths must be adjusted:
ecos_adjust_directory(adjusted_sources ${sources})

# Create eCos executable.
ecos_add_executable(ecos_app ${adjusted_sources})