Main Content

Tips and Limitations

Model Build and SIL/PIL Blocks Not Supported

Code coverage does not support:

  • The model build process, for example, the Ctrl+B command.

  • SIL or PIL blocks.

Code coverage settings are ignored by the Ctrl+B command and SIL or PIL blocks.

BullseyeCoverage License Wait

When you build your model, you might have to wait for a BullseyeCoverage license. If you want to see information about the wait, before you build your model, in the Configuration Parameters dialog box, select Verbose build.


SIL and PIL simulation support for BullseyeCoverage will be removed in a future release.

Current Working Folder Cannot be UNC Path

If your MATLAB® current working folder is a Universal Naming Convention (UNC) path, code coverage fails.

Characters in matlabroot and File Path

If matlabroot or the path to your generated files contains a space or the . (period) character, code coverage might fail.

Header Files with Identical Names

Consider a model that is configured for LDRA code coverage. During the build process, if the software detects two header files with the same name in the folder for generated code, the software generates an error.

Code Coverage for Source Files in Shared Utility Folders

The software supports code coverage for source files generated in shared utility folders. If you configure code coverage for a model that uses shared utility code generation, when you build the model, you also build all source files in the shared utilities folder with code coverage enabled.

Whenever you build a model, the code coverage settings of the model must be consistent with source files that you previously built in the shared utilities folder. Otherwise, the software reports that code in the shared utilities folder is inconsistent with the current model configuration and must be rebuilt. For example, if you run a SIL simulation for a model with code coverage enabled and then run a SIL simulation for another model with code coverage disabled, the software must rebuild all source files in the shared utilities folder.

BullseyeCoverage Behavior with Inline Macros

The BullseyeCoverage tool, by default, does not provide code coverage data for inline macros.

For example, if a model generates a file slprj/ert/_sharedutils/rt_SATURATE.h that contains the macro

#define rt_SATURATE(sig,ll,ul) (((sig) >= (ul)) ? (ul) : (((sig) <= (ll)) ? (ll) : (sig)) )

and the macro is in sat_ert_rtw/sat.c, then the coverage report provides a measurement for sat.c, but no coverage data for the conditions within the macro rt_SATURATE.

To configure the BullseyeCoverage tool to provide code coverage data for inline macros:

  1. Open the BullseyeCoverage Browser.

  2. Select Tools > Options to open the Options dialog box.

  3. On the Build tab, select the Instrument macro expansions check box.

  4. Click OK.

  5. Rerun your simulation.

Alternatively, you can add the text -macro to the BullseyeCoverage configuration file. For more information, go to


SIL and PIL simulation support for BullseyeCoverage will be removed in a future release.

SIL and PIL Simulations with Open LDRA GUI

If you enable LDRA code coverage, you must verify that the LDRA tool suite GUI is not open when you run your SIL or PIL simulation. If the set name in the GUI differs from the set name used by the SIL or PIL simulation, the SIL or PIL simulation fails.

Minor SIL and PIL Differences for LDRA Tool Suite

The target connectivity API supports LDRA code coverage for top-model and Model block PIL.

There are minor differences in the code coverage information collected during SIL and PIL simulations. In particular, with PIL, the software does not explicitly show function exit point coverage. However, you can infer the coverage of function exit points by examining statement coverage.

PIL Zero Coverage LDRA Annotations

For a PIL simulation with LDRA code coverage specified, recorded coverage for some source files might be zero. In this case, the software provides summary information indicating that:

  • There is coverage to measure.

  • The coverage is zero.

You do not see information for individual probes on each line. The displayed summary information has an associated annotation tooltip:

0 out of N coverage probes were exercised (detailed breakdown unavailable)

Custom Header File Changes and Regeneration of LDRA Instrumentation

When you run a SIL simulation with LDRA code coverage enabled, the code generator uses LDRA software to instrument the generated code only if the code generator determines that the generated code has changed since the last generation of instrumentation code. You can change a custom header file without regenerating code. In this case, the code generator does not update the instrumentation code. The SIL simulation produces this error:

The call to the LDRA code coverage tool did not generate the expected report. 
One possible cause of this error is that the Embedded Coder software did not 
detect the change in a previously analyzed source file and skipped the static 
analysis. The source file that changed might be a custom header file. For more 
information, review the above output from the LDRA tool command. A static 
analysis will be forced on the next simulation. You must rerun the simulation.

PIL Support for BullseyeCoverage

Code coverage with BullseyeCoverage is available for top-model and Model block PIL provided your PIL application can write directly to the host file system. Your target for the PIL application must provide fopen and fread access to the host file system.

If code coverage is not available when you run the PIL application on your target hardware, you might be able to collect code coverage measurements by running the PIL application on an instruction set simulator that supports direct file I/O with the host file system.


SIL and PIL simulation support for BullseyeCoverage will be removed in a future release.

Modify Legacy Code

If you modify legacy code and rerun a SIL or PIL simulation, the legacy code is recompiled. However, the code from the model may be up-to-date. In this case, the code generation report is not updated and does not show the modified legacy code. Instead, the code coverage information for the modified legacy code is displayed with reference to the original legacy code. You must regenerate the report. For more information, see Generate Code Generation Report.

Related Topics