I have a large number of projects, each with at least one automated test suite. The tests are run in IAR's C-Spy simulator. (I am using IAR Embedded Workbench for Arm v6.60.)
If I run one of these test executable from the IDE, I can generate and view code coverage information. This is okay for a single project, but gathering this information for all of my projects by running each one manually is far too cumbersome. I'd like to be able to run my build and have it generate the code coverage information for all test suites.
Based on what I found in the EWARM_DebuggingGuide.pdf, I should be able to generate code coverage for an executable by passing C-Spy the code coverage plugin:
--plugin C:\<IAR path>/common/plugins/CodeCoverage/CodeCoverage.dll
As well as the file that the code coverage info should be dumped to:
--code_coverage_file C:\<test suite path>/CodeCoverageReport.log
So this is the actual command I'm invoking:
C:\<IAR path>/common/bin/CSpyBat.exe C:\<IAR path>/arm/bin/armproc.dll C:\<IAR path>/arm/bin/armsim2.dll C:\<test suite path>/Test.out --plugin C:\<IAR path>/arm/bin/armbat.dll --plugin C:\<IAR path>/common/plugins/CodeCoverage/CodeCoverage.dll --backend -B --endian=little --cpu=Cortex-M4 --fpu=VFPv4 --semihosting --code_coverage_file C:\<test suite path>/CodeCoverageReport.log
C-Spy launches the test suite successfully, my test results are printed, but no code coverage file is created. There are no error messages.
What am I missing?
I think there is only a very small mistake in your command line:
The option
--code_coverage_file
needs to be placed before the option--backend
.I just tested the generation of the code coverage file for EWARM 7.60.1 and 6.50.6. Works fine for both versions. Therefore I expect that EWARM 6.60 will behave the same way.
Background
Everything after
--backend
is not evaluated by C-Spy but by the backend driver (the simulatorarmsim2.dll
in this case). The code coverage is not generated by the simulator but by a separate plugin (CodeCoverage.dll
). This plugin evaluates the--code_coverage_file
option which is only visible to the plugin, if it is placed before the--backend
argument.