How to take the coverage report for Embedded Application Testing
I do system testing of various embedded software(Embedded C) which runs on a microcontroller. How to take a code coverage report in this case as we run the software on the micro and not on a pc?
At this point we cannot afford a simulation model of the system.(I know this makes it easy to have a coverage tool, simulator and tests run together on PC and get a coverage report).
Depending what your code does, you may be able to compile it for x86 architecture to run your unit tests and use traditional code-coverage tools; anything written for C will work in that case. This assumes you're not using any of the peripherals of the embedded processor; otherwise, you may need to write a wrapper layer to simulate them, but then, you'd probably want to do that in your unit test framework in order to adequately simulate the external dependencies of the program anyway. Inline assembly instructions would also prevent this technique from working, of course.
You may be able to break up the code into modules and test some modules on x86 with code coverage tools running while others have to be tested on the device and thus cannot have the code coverage counted. You may be able to use techniques in other answers to measure the coverage of code that is not able to run on an x86 processor. It depends how well you've designed your code.