Chapter 10. Programming With eCos

The following chapters of this manual comprise a simple tutorial for configuring and building eCos, building and running eCos tests, and finally building three stand-alone example programs which use the eCos API to perform some simple tasks.

You will need a properly installed eCos system, with the correct versions of the GNU toolchain. On Windows you will be using the bash command line interpreter that comes with Cygwin, with the environment variables set as described in the toolchain documentation.

The Development Process

Most development projects using eCos would contain some (or most) of the following:

eCos Configuration

eCos is configured to provide the desired API (the inclusion of libc, uitron, and the disabling of certain undesired funtions, etc.), and semantics (selecting scheduler, mutex behavior, etc.). See Chapter 11.

It would normally make sense to enable eCos assertion checking at this time as well, to catch as many programming errors during the development phase as possible.

Note that it should not be necessary to spend much time on eCos configuration initially. It may be important to perform fine tuning to reduce the memory footprint and to improve performance later when the product reaches a testable state.

Application Development - Target Neutral Part

While your project is probably targeting a specific architecture and platform, possibly custom hardware, it may be possible to perform part of the application development using simulated or synthetic targets.

There are three good reasons for doing this:

This approach is possible because all targets (including simulators and synthetic ones) provide the same basic API: that is, kernel, libc, libm, uitron, infra, and to some extent, HAL and IO.

Synthetic targets are especially suitable as they allow you to construct simulations of elaborate devices by interaction with the host system, where an IO device API can hide the details from the application. When switching to hardware later in the development cycle, the IO driver is properly implemented.

Simulators can also do this, but it all depends on the design and capabilities of the simulator you use. Some, like SID or Bochs provide complete hardware emulation, while others just support enough of the instruction set to run compiled code.

Therefore, select a simulator or synthetic target and use it for as long as possible for application development. That is, configure for the selected target, build eCos, build the application and link with eCos, run and debug. Repeat the latter two steps until you are happy with it.

Obviously, at some time you will have to switch to the intended target hardware, for example when adding target specific feature support, for memory footprint/performance characterization, and for final tuning of eCos and the application.