NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

Code Coverage

From Texas Instruments Wiki
Jump to: navigation, search

Code Coverage in CCSv4/v5[edit]

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[edit]

  • Goto Menu Tools->Profile->Setup Profile Data Collection and select Collect Code Coverage and Exclusive Profile Data
  • Click on properties to select the events to be collected along with code coverage.

Profile setup4.jpg

  • Load the application & run.

Code Coverage Result[edit]

  • To view the code coverage results, click Menu Tools->Profile->View Code Coverage Results. Function Coverage & Line Coverage window will pop-up.

Profile output1.jpg

  • To highlight Line coverage info inside the editor window, click on Highlight coverage info in editor icon on the Function Coverage & Line Coverage window.

Profile output2.jpg

Profile Control Points[edit]

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).

  • Click on new breakpoint drop-down menu & select Profile Control Point

Profile control2.jpg

  • Profile Control point menu will pop-up. Need to specify the address & action. Actions are Pause Profiling , Resume Profiling & Terminate Profiling.
    • Pause Profiling - Pause collecting profile informations
    • Resume Profiling - Resume collecting profile informations
    • Terminate Profiling - Stops/Terminate collecting profile informations

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[edit]

Code Coverage is supported on CCSv3.3 as well.

FAQ[edit]

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?[edit]

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)?[edit]

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

  • Enable Code Coverage & run the applications till a logical point where you want to stop collecting coverage result.
  • Place Profile Control Point for "Terminate Profiling" at that locations.
  • Once you cross the profile control point, click Menu Tools->Profile->View Code Coverage Results to view the coverage result.

Alternative method:

  • Enable Code Coverage & run the applications till a logical point where you want to stop collecting coverage result.
  • Click reset->CPU & click Menu Tools->Profile->View Code Coverage Results to view the coverage result.


Q. How do I view coverage for inline functions?[edit]

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?[edit]

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?[edit]

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

E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article Code Coverage here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article Code Coverage here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article Code Coverage here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article Code Coverage here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article Code Coverage here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article Code Coverage here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article Code Coverage here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article Code Coverage here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article Code Coverage here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity