Programming Embedded Systems in C and C++
- 20 -
Certainly, C must be the centerpiece of any book about embedded programming-and this
book will be no exception. More than half of the sample code is written in C, and the
discussion will focus primarily on C-related programming issues. Of course, everything that is
said about C programming applies equally to C++. In addition, I will cover those features of
C++ that are most useful for embedded software development and use them in the later
examples. Assembly language will be discussed in certain limited contexts, but will be
avoided whenever possible. In other words, I will mention assembly language only when a
particular programming task cannot be accomplished in any other way.
I feel that this mixed treatment of C, C++, and assembly most accurately reflects how
embedded software is actually developed today and how it will continue to be developed in
the near-term future. I hope that this choice will keep the discussion clear, provide
information that is useful to people developing actual systems, and include as large a potential
audience as possible.
1.4 A Few Words About Hardware
It is the nature of programming that books about the subject must include examples. Typically,
these examples are selected so that they can be easily experimented with by interested readers.
That means readers must have access to the very same software development tools and
hardware platforms used by the author. Unfortunately, in the case of embedded programming,
this is unrealistic. It simply does not make sense to run any of the example programs on the
platforms available to most readers-PCs, Macs, and Unix workstations.
Even selecting a standard embedded platform is difficult. As you have already learned, there
is no such thing as a "typical" embedded system. Whatever hardware is selected, the majority
of readers will not have access to it. But despite this rather significant problem, I do feel it is
important to select a reference hardware platform for use in the examples. In so doing, I hope
to make the examples consistent and, thus, the entire discussion more clear.
In order to illustrate as many points as possible with a single piece of hardware, I have found
it necessary to select a middle-of-the-road platform. This hardware consists of a 16-bit
processor (Intel's 80188EB
[2]
), a decent amount of memory (128KB of RAM and 256 KB of
ROM), and some common types of inputs, outputs, and peripheral components. The board
I've chosen is called the Target188EB and is manufactured and sold by Arcom Control
Systems. More information about the Arcom board and instructions for obtaining one can be
found in Appendix A.
[2]
Intel's 80188EB processor is a special version of the 80186 that has been redesigned for use in embedded systems. The original
80186 was a successor to the 8086 processor that IBM used in their very first personal computer-the PC/XT. The 80186 was never
the basis of any PC because it was passed over (in favor of the 80286) when IBM designed their next model-the PC/AT. Despite
that early failure, versions of the 80186 from Intel and AMD have enjoyed tremendous success in embedded systems in recent
years.