Error Reporting

Reporting errors is surprisingly non-trivial in embedded systems. You can’t simply printf stuff. There may be no stdlib, and there may be no console 🙂 In many embedded systems there is no way of error logging, everything must be tested thoroughly, so there are no errors left. Alternatively, there is usually some kind of memory area, where log messages and error statuses are collected (“Fehlerspeicher”). So we came up with a first cut at a simple error reporting approach. Here is some code:

We first define messages. These have IDs, an error test, a classification (ERROR, WARN, INFO) and, later, a numerical code and additional log data. Reporting an error happens via the code shown in the function: a message is references and reported, possibly only if a certain condition is met. Messages can be disabled, in which case the report statements that report those disabled messages are not generated into the code — no reporting, no cost.

Depending on the target platform, the report statements are either transformed simply to a printf, or to writing into some kind of error memory. Platform-dependent language concept translation is an important ingredient to our approach, and illustrated, albeit with a simple example, by the error reporting feature.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s