Article: Embedded SW Debugging Techniques

To solve a problem one has to first identify the source of the problem. This article talks about some methods of debugging embedded software.

Eliminate Hardware

Embedded software engineers like to blame hardware for all their troubles and Hardware Engineers the other way round. But to identify the actual source of the problem, it is important to identify it as a HW or SW issue first. The rule is simple. It should always be possible to test hardware independant of the Software being developed. Specific test routines must be present which test Hardware. Then it is simple. When in doubt run the test. If Hardware passes, it is software. This is important because minor changes in board design create a lot of hardware issues also. It is always good to test when in doubt.

Use global test variables

The life of a variable causes many problems. Local variables are not present once the function exits. Mirroring their values into global variables before function exit allows engineers to check their values.Don't forget to clean up before release.

Go through the code methodically

This seemingly obvious method saves a lot of debugging time. Reading code is a good way of identifying the module that is likely to cause issues. This narrows down the search.

Check for Reset

If a bug is causing the system to Reset it is easier to identify. This is because the possibilities have narrowed.Always check for system reset.

Use of the debugger

For bugs which can be caught by the use of debugger there is nothing simpler. monitor the variables, set breakpoints and run through the code systematically. However many bugs cannot be caught by the debugger. The ability to repeat such bugs then becomes very important.

Have a Robust test plan

The test plan is integral to debugging. Each module's test plan should be well thought of. Data patterns to be fed, which should pass as well as fail. The negative tests are as important as the positive ones.


TL Micro Automation - Electronic Products , Embedded Design Services , Consulting