coverage-plugin User Guide

The coverage-plugin is a C++ project using the Model Trace Interface Plugin Development Kit (MTIPDK) in order to create a trace plugin, which is a special shared library. The trace plugins can be loaded into Arm Fast Models to produce execution trace data for doing code coverage measurement.

Dependencies

  • GCC 7.5.0 at least

Building the coverage-plugin

$ cd coverage-plugin
$ make PVLIB_HOME=</path/to/model_library>

Capturing a trace

You need to add two options to your model command-line:

   --plugin /path/to/coverage_trace.so
   -C TRACE.coverage_trace.trace-file-prefix="/path/to/TRACE-PREFIX"

You can then run your FVP model. The traces will be created at the end of the simulation*.

BEWARE: Traces aren't numbered and will be overwritten if you do two successive runs. Aggregating results will require moving traces to a separate place or changing the prefix between runs. This is the responsibility of the plugin user.

*NOTE: The plugin captures the traces in memory and on the termination of the simulation it writes the data to a file. If user terminates the simulation forcefully with a Ctrl+C the trace files are not generated. Traces can be saved by interacting with the plugin itself. More info can be found in the Interacting with the plugin chapter .

Exception level based tracing.

The coverage tool support only tracing specific exception levels. This is useful when trying to trace a small part of a bigger system. This is for example used to measure the code coverage of the OP-TEE secure OS. Where the trace is only being recorded while being inside S-EL1. The exception level can be specified by passing the TRACE.coverage_trace.trace-mode option. The passed value is a 32b bit field.

exception LevelBit Field
None secure modes
EL0t0
EL1t1
EL1h2
EL2t3
EL2h4
EL3t5
EL3h6
usr7
fiq8
irq9
svc10
mon11
abt12
hyp13
und14
sys15
Secure modes
EL0t16
EL1t17
EL1h18
EL2t19
EL2h20
EL3t21
EL3h22
usr23
fiq24
irq25
svc26
mon27
abt28
hyp29
und30
sys31

Interacting with the plugin

The trace-mode and the trace-file-prefix can both be changed at run-time. Every time the trace-file-prefix value is changed, the plugin will save the trace result. This can be used to save the result without the need for the simulation to end.

#!/usr/bin/python
import iris.debug as debug
import iris.iris as iris


trace_file_prefix = ""
self.model = debug.NetworkModel("localhost",9000)

self.trace_component = None
components = self.model.get_targets()
for component in components:
    if "coverage_trace" in component.instName:
        self.trace_component = component

if not self.trace_component:
    fail_msg("Trace component not found")
else:
    # Save the trace results
    self.trace_component.parameters['trace-file-prefix'] = trace_file_prefix

License

BSD-3-Clause