Embedded Software: The Works

C is still the most commonly used programming language for embedded software applications. Although a small language, it continues to challenge software engineers. Many of these challenges arise from the origins of the language, which were quite a different context from that in which it is now applied. The articles in this chapter address the topic from various perspectives.
This article is based upon one written for NewBits way back in 1990 by Ken Greenberg. It addresses an issue that was and still is a common area of confusion among C developers. Over the years, embedded tools have become more like those used for host native development in both their capability and the standards to which they adhere, but some issues, such as the handling of weak externals, persist. (CW)
In this article, we will discuss the concept of C common, sometimes referred to as weak externals. A C common data object is a global variable that has not been explicitly declared to be either static or external and has not been initialized in any module. Thus, a declaration of the form:
int currentTask;
may be in C common. You can't tell by looking at only one module whether a given data object will or will not end up in C common since it may have been initialized elsewhere.
It is now common maybe even standard practice for software engineers to prototype their applications (or at least as much of the applications as...