Language choice

The device drivers shipped with eCos are written in C++, as is the eCos kernel. An IORB base class (along with derived classes for use with serial drivers) is provided, and users can derive their own classes for I/O request management from this class.

The mechanism for generating function tables from the C++ I/O classes is also only available for C++ programmers. Note, though, that these mechanisms are only needed by somewhat more complex device drivers that need request queue management or integration to standard I/O. Simpler device drivers can be written in C with no loss.

There are drawbacks to writing device drivers in C++: the first is that in this version of eCos, the C++ kernel API is not yet standardized, and is subject to change. In contrast the C system call interface (Chapter 5) is standardized and documented. In addition, many embedded system programmers are accustomed to writing device drivers in C.

Future versions of eCos will present a stable kernel C++ API, as well as mechanisms for C device drivers to use IORBs and connect with standard I/O.