Use this guide to generate code coverage for an embedded application in the Code Composer Studio (CCStudio) IDE. RKTracer integrates with Code Composer Studio through a command-line utility. You first integrate the tool from a command prompt, then enable it from inside the IDE, rebuild and run your tests on the embedded target, save the coverage data, and generate the HTML reports.
Close the IDE and run rktracer -ds -integrate, enable the External Tools from Customize Perspective, rebuild and run your tests in debug mode, run rkdump from the Scripting Console, then run RKTracer Reports to generate the HTML report.
Step 1: Enable the code coverage tool
First, close the Code Composer Studio IDE, open a command prompt, and run the integration command. This integrates the RKTracer tool with the IDE.
rktracer -ds -integrate
Now open the IDE and make the External Tools visible in the toolbar and the menu. Go to Windows › Perspective › Customize Perspective. Under the Toolbar Visibility tab, select Launch and choose External Tools. Then open the Menu Visibility tab, go to the Run menu, scroll to the end, select External Tools, then apply and close.
The RKTracer tool is now available from Run › External Tools, which offers three options:
- RKTracer ON: Will enable RKTracer tool for instrumentation.
- RKTracer OFF: Will disable RKTracer tool.
- RKTracer Reports: Will generate reports in HTML format.
Step 2: Rebuild the application and run tests
Clean and build the application to instrument it with the RKTracer tool, then run your test cases on the embedded target in debug mode, or your preferred method.
Step 3: Save the coverage data
While still in debug mode, open the Scripting Console from the View menu and run the rkdump command to save the coverage data to the project folder.
rkdump
Step 4: Generate the code coverage reports
Run the RKTracer Reports option from Run › External Tools. The tool converts the raw coverage data files into coverage reports, mapping them with the JSON files generated during instrumentation, and generates the HTML output.
Enable coverage for selected files
You can scope coverage to specific folders, files, or functions by editing the rktracer.config file. For example, to instrument source files from some folders while ignoring others, add the following:
ignore *.c instrument */power/* */core/* */keys/* never */firmware_loader/* */lockdown/*
ignore *.cignores all C source files from instrumentation.instrumentinstruments source files from the given folders.neverignores the selected folders.
Next steps
Once your Code Composer Studio project reports coverage, the same RKTracer workflow applies across other build systems and IDEs. Browse the rest of the documentation, or read more about how RKTracer measures coverage through MC/DC.