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 28.
To use the ecosconfig command you need to start a shell. In Windows you need to start a CygWin bash shell, not a DOS command line.
The following instructions assume that the PATH and ECOS_REPOSITORY environment variables have been setup correctly as described in Chapter 7. They also assume Linux usage but equally well apply to Windows running Cygwin.
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/ecos-work. Create this directory and change to it by typing:
$ mkdir BASE_DIR/ecos-work $ cd BASE_DIR/ecos-work
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 11-1. Getting help from ecosconfig
$ ecosconfig --help Usage: ecosconfig [ qualifier ... ] [ command ] commands are: list : 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) 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 qualifiers are: --config=FILE : the configuration file --prefix=DIRECTORY : the install prefix --srcdir=DIRECTORY : the source repository --no-resolve : disable conflict resolution --version : show version and copyright $
Example 11-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> …
To configure for a listed target, type:
$ ecosconfig new <target>
For example, to configure for the ARM PID development board, type:
$ ecosconfig new pid
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 28.
Create a build tree for the configured target by typing:
$ ecosconfig tree
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 28 for more details.
You can now run the command make or make tests, after which you will be at the same point you would be after running the Configuration Tool — you can start developing your own applications, following the steps in Chapter 13.
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.