Code Coverage

From Texas Instruments Embedded Processors Wiki

(Redirected from Code coverage)
Jump to: navigation, search
Translate this page to   

Contents

Code Coverage in CCSv4/v5

Code Coverage provides coverage data for all functions for the complete run of a program. Note that the code coverage feature describe below is only supported on simulators.

Note: target application must be built with minimal debug option turned on for profiling/Code Coverage to work ([Project Properties]->Tool Settings->Basic Options->Debug model should be set to symdebug:skeletal or symdebug:dwarf). For RTSC project, use 'debug' configuration ... WHOLE_PROGRAM_DEBUG will not work.

Note: Code coverage supports the targets listed in this FAQ entry.

Enable Code Coverage

Profile setup4.jpg

Code Coverage Result

Profile output1.jpg

Profile output2.jpg

Profile Control Points

Profile Control Points enable to collect Function Profiling/Code Coverage for a range or functions. Profile control point works similar to a breakpoint and can be set via Unified Breakpoint Manager (UBM).

Profile control2.jpg

Profile control1.jpg

Note: Simulator will not halt at these profile control points and Profiler need to be enabled at the beginning.


Code Coverage in CCSv3.3

Code Coverage is supported on CCSv3.3 as well.

FAQ

Q. In an old code coverage user guide (spru624) I see a limitation that Code Coverage does not work for programs compiled with dwarf debug info. Is this valid anymore?

This is a very old document and has been removed from external web. Code coverage indeed works with dwarf debug info and has been the way for years now. The older doc had the limitation as dwarf was just getting introduced at that time.


Q. Can I gather Code Coverage results on non-terminating applications (e.g. BIOS-based apps)?

Yes (note that BIOS-based applications are "non-terminating" as they simply enter the idle loop when there is nothing that can be run).

Alternative method:


Q. How do I view coverage for inline functions?

Functional coverage for inline functions can be viewed indirectly. When you build a project containing inline functions with the ‘-g’ build option, inline functions behave as normal functions and do not become inline at places where they are called. For example, assume you have a source file called file1.c with the following code:

inline float volume_sphere(float r) {

return 4.0/3.0 * PI * r * r * r; 

}

int foo(...) {

... 
volume = volume_sphere(radius); 
... 

}

If the above source file is build with the ‘-g’ option, then the function volume_sphere would not behave as an inline function. If code coverage was run for this project, the volume_sphere function would be listed in the Function Coverage table (summary worksheet in CCS3.3). However, the function would not behave as an inline function. If the project is built with the Release configuration build option, the functions specified with an inline keyword will retain their inlining behavior.


Q. How do I view code coverage for files with the same name in a project?

Currently, the Code Coverage tool feature only supports functional coverage for the functions listed in files that have identical names. Line coverage for these files is reported incorrectly. It is recommended not to use files with the same name in a project.


Q. Why do I see multiple entries for the same function in the Function Coverage table?

A static function is listed in the assembly as many times as it is called. This is valid for static functions declared and defined in the header file. Therefore, functional coverage is listed for each call of the static function

Leave a Comment
Personal tools
Namespaces
Variants
Actions
Navigation
Print/export
Toolbox