Code coverage for assembler source files

From HCL OneTest Embedded V8.3.0, you can collect coverage metrics for assembler source files. Coverage information is displayed in the coverage report.

Note:

This feature supports only ARM in 32 bits mode. It is an extension of the C language mode.

You must have configured HCL OneTest Embedded to recognize the .asm file extension used for assembler files. For more details, see Using assembler source files.

Coverage Assembler language for ARM processor is fully compatible with C/C++ and Ada code coverage.

Assembler source files are taken into account in the build as C/C++ source files. Optionally, C/C++ source files could be instrumented at the assembler level and not at the C/C++ level. To launch code coverage for assembler files from a command, see Command line to launch code coverage for assembler files.

The supported coverage levels are:
  • Functions
  • Functions and exits
  • Statement blocks
  • Calls

CONFIGURATION

Code coverage for assembler source files requires the use of an appropriate TDP. You can use the clinCrossRaspiRemote.xdp and cwinCrossRaspiRemote.xdp that are delivered, for example.

There two use case scenarios:
  • For a project that uses both C and assembler source files, you only have to add the assembler .asm source files to the list of sources to be compiled. The .asm files are then instrumented, built, and linked with the other C sources to produce an executable file.
  • For C code source files that are instrumented in assembler mode, the C source files are converted into assembler files by using the gcc -S command. Then, they are instrumented in assembler mode, they are converted into assembly language, and linked.

    To implement this use case scenario, you must set the INSTR_C_AS_ASM=1 environment variable.

    To add this environment variable in Studio, proceed as follows:
    • Click Settings in the Project window.
    • Select Build options > Environment.
    • Click the Value field on the Environment variable line, and click ....
    • Click the Add icon, give a name to the variable, and enter INSTR_C_AS_ASM=1 in Value.
    • Apply and close the window.
    See the following example:

Note: In some case, when the assembler code increased due to the code coverage level, it might be necessary to re-organize the assembler code (Example: you can move data pools), or to decrease the level of code coverage (Example: you can delete code coverage for some functions calls in libraries).