Ecosconfig on Windows and Linux Quick Start

As an alternative to using the graphical Configuration Tool, it is possible to configure and build a kernel by editing a configuration file manually and using the ecosconfig command. Users with a Unix background may find this tool more suitable than the GUI tool described in the previous section.

Manual configuration and the ecosconfig command are described in detail in Chapter 26.

To use the ecosconfig command you need to start a shell. In Windows you need to start a DOS command line or Shell Environment. For eCosPro installations on Windows earlier than eCosPro 3.1, you need to start a CygWin bash shell. These may also be obtained using the menu item Tools->Shell of the GUI eCos Configuration Tool.

eCosPro installations will include Desktop menu entries for the Shell Environment for both Linux and Windows that will also set up the paths to user-defined build and user tools, as well as the tools defined by the eCosPro profiles. If you have multiple eCosPro installations or profiles, you will be prompted to select a Profile into which the Shell Environment is to be configured. This initialises the PATH environment variables and sets up the eCos specific environment variables, such as ECOS_REPOSITORY, as well as the OPENOCD_SCRIPTS, INSTALL_DIR and ECOSPRO_PROFILE variables as described in the Section called Environment Variables in Chapter 11.

The following instructions assume that the PATH and ECOS_REPOSITORY environment variables have been set up correctly. These instructions also assume Linux usage but can be applied equivalently to Windows.

Before invoking ecosconfig you need to choose a directory in which to work. For the purposes of this tutorial, the default path will be <BASE_DIR> (e.g. $HOME/ecos-work) Create this directory and change to it by typing:

$ mkdir <BASE_DIR>
$ cd <BASE_DIR>

To see what options can be used with ecosconfig, type:

$ ecosconfig --help

The available packages, targets and templates may be listed as follows:

$ ecosconfig list

Here is sample output from ecosconfig showing the usage message.

Example 7-1. Getting help from ecosconfig

$ ecosconfig --help --config-help
Usage: ecosconfig [ qualifier ... ] [ command ]
  commands are:
    list [ packages | templates | targets ]  : list repository contents
    new TARGET [ TEMPLATE [ VERSION ] ]      : create a configuration
    target TARGET                            : change the target hardware
    template TEMPLATE [ VERSION ]            : change the template
    add PACKAGE [ PACKAGE ... ]              : add package(s)
    remove PACKAGE [ PACKAGE ... ]           : remove package(s)
    packages [ loaded | active ]             : list configuration packages
    attributes [ ATTRIBUTE ... ]             : list configuration attributes
    present PACKAGE [ PACKAGE ... ]          : check presence of package(s)
    version VERSION PACKAGE [ PACKAGE ... ]  : change version of package(s)
    export FILE                              : export minimal config info
    import FILE                              : import additional config info
    check                                    : check the configuration
    resolve                                  : resolve conflicts
    tree                                     : create a build tree
    <configuration command>                  : get or set a configuration option
                                             : use --config-help for more details
  qualifiers are:
    --config=FILE                            : the configuration file
    --prefix=DIRECTORY                       : the install prefix
    --srcdir=DIRECTORY                       : the source repository
    --builddir=DIRECTORY                     : the build tree directory (default: cwd)
    --no-resolve                             : disable conflict resolution
    --version                                : show version and copyright
    -q, --quiet                              : reduce verbosity
    -v, --verbose                            : increase verbosity
    -l, --long                               : full/long list format
    -i, --ignore-errors                      : ignore unresolved conflicts
    -n, --no-updates                         : read-only mode, do not modify the file system
    -c, --compat                             : GUI configtool compatibility
    --enable-debug                           : enable debugging in this configuration
    --disable-debug                          : disable debugging in this configuration
    --help                                   : display this message
    --config-help                            : display configuration commands

Configuration commands are:
  set_comment `COMMENT'                : set comment to COMMENT
  add_comment `COMMENT'                : append COMMENT to comment
  get_comment                          : output the comment
  get_enabled <PACKAGE|OPTION>         : output 0 or 1 if PACKAGE or boolean OPTION is enabled
  set_enabled <PACKAGE|OPTION> <0|1>   : enable (1) or disable (0) PACKAGE or boolean OPTION
  get_value OPTION                     : output the value of cdl OPTION
  set_value OPTION VALUE               : set the value of cdl OPTION to VALUE
  get_legal_values OPTION              : output the legal values of cdl OPTION

Example 7-2. ecosconfig output — list of available packages, targets and templates

$ ecosconfig list
Package CYGPKG_CYGMON (CygMon support via eCos):
aliases: cygmon
versions: <version>
Package CYGPKG_DEVICES_WALLCLOCK_DALLAS_DS1742 (Wallclock driver for Dallas 1742):
aliases: devices_wallclock_ds1742 device_wallclock_ds1742
versions: <version>
Package CYGPKG_DEVICES_WALLCLOCK_SH3 (Wallclock driver for SH3 RTC module):
aliases: devices_wallclock_sh3 device_wallclock_sh3
versions: <version>
Package CYGPKG_DEVICES_WATCHDOG_ARM_AEB (Watchdog driver for ARM/AEB board):
aliases: devices_watchdog_aeb device_watchdog_aeb
versions: <version>
Package CYGPKG_DEVICES_WATCHDOG_ARM_EBSA285 (Watchdog driver for ARM/EBSA285 board):
aliases: devices_watchdog_ebsa285 device_watchdog_ebsa285
versions: <version>

Selecting a Target

To configure for a listed target, type:

$ ecosconfig new <target> [<template>]

The <template> is optional and if none is specified, the default template will be used. For example, to configure for the ST Micro 32F429IDISCOVERY development board, type:

$ ecosconfig new stm32f429i_disco

You can then edit the generated file, ecos.ecc, setting the options as required for the target (endianess, CPU model, Startup type, etc.). For detailed information about how to edit the ecos.ecc file, see the CDL Writer's Guide and the Section called Editing an eCos Savefile in Chapter 26.

To create a build tree for the configured target in the current directory where ecos.ecc is located by type:

$ ecosconfig tree

You can use the --builddir to specify a directory for the build tree to be located, other than the current directory, as well as the --config option to specify a path to the configuration file if it is different from ecos.ecc or not in the current directory.

If there are any problem with the configuration, ecosconfig will tell you. The most likely cause of this is mistakes when editing the ecos.ecc file. You can check whether the configuration you have made is correct, without building the tree with the following command:

$ ecosconfig check

If this reports any conflicts you can get ecosconfig to try and resolve them itself by typing:

$ ecosconfig resolve

See the Section called Conflicts and constraints in Chapter 26 for more details.

You can now run the command make or make tests, after which you will be at a similar point you would be after running the Configuration Tool. The library and header files will be in the install subdirectory of the current working directory (unless of course the option --prefix is provided to the ecosconfig tree command to specify the path to the install directory). You can now start developing your own applications, following the steps in Chapter 9.

Note: The build and install directory layout differ between the eCos Configuration Tool and ecosconfig for historic reasons. You can make ecosconfig use the same layout and naming convention as the eCos Configuration Tool by including the -c option with appropriate ecosconfig commands.

The procedure shown above allows you to do very coarse-grained configuration of the eCos kernel: you can select which packages to include in your kernel, and give target and start-up options. But you cannot select components within a package, or set the very fine-grained options.

To select fine-grained configuration options you will need to edit the configuration file ecos.ecc in the current directory and regenerate the build tree.


You should follow the manual configuration process described above very carefully, and you should read the comments in each file to see when one option depends on other options or packages being enabled or disabled. If you do not, you might end up with an inconsistently configured kernel which could fail to build or might execute incorrectly.

Documentation license for this page: Open Publication License