Static Properties of Commercial Real-Time and Embedded Systems
Jakob Engblom · 1998
We have used a modified C compiler to analyze a large number of real-life commercial C programs used in real-time and embedded applications. The total size of the sample used in this study is more than 300 000 non-comment lines of C code, from 13 different applications obtained from 6 different companies. Only the static aspects of the programs have been studied, i.e. such information that can be obtained from the source code without running the programs. The code was written for 8and 16-bit embedded systems. The purpose of the study is to guide our future research into practically useful WCET analysis methods by identifying properties of real-time programs. The programs studied were from application fields where parts of the program can be considered timing critical, like control loops and real-time signal encoding/decoding and protocol processing. The most important conclusions for the design of WCET tools are that: § It is not reasonable to assume that an entire real-time system is available as source code. Parts of the system will very likely only be delivered as object files, for example OS code, libraries, and company-specific reusable components. § Most functions in a program have very simple control flow. This fact should be exploited to optimize WCET analysis. § Automatically-generated code is being used, even for small processors. This has the following implications: parts of the program have not been written by humans, which means that it is not possible to ask programmers for help in WCET analysis. Furthermore, automatically generated code has a tendency to have a more complex structure than human-written code, which invalidates certain simplifying assumptions, such as “real-time programs do not use recursion”. Rounding off the study, some other aspects of interest for embedded compiler implementers have been investigated: the distribution of variable sizes and the composition of C switch statements. Static Properties of Commercial Real-Time and Embedded Programs ASTEC Report 98/05 Page 3/28