Products & Services Solutions Academia Support User Community Company

Learn more about Simulink   

Working with Compilation Reports

About Compilation Reports

Whenever you build a Simulink model that contains Embedded MATLAB Function blocks, Simulink automatically generates a compilation report in HTML format for each Embedded MATLAB Function block in your model. The report helps you debug your Embedded MATLAB functions and verify compliance with the Embedded MATLAB subset. The report provides links to your Embedded MATLAB functions and compile-time type information for the variables and expressions in these functions. If your model fails to build, this information simplifies finding sources of error messages and aids understanding of type propagation rules.

Location of Compilation Reports

Embedded MATLAB provides a compilation report for each Embedded MATLAB Function block in the model model_name at the following location:

slprj/_sfprj/
model_name/_self/
sfun/html/

Opening Compilation Reports

Open the compilation report using one of the following methods:

Description of Compilation Reports

When you build the Embedded MATLAB function, Embedded MATLAB generates an HTML report. The following example shows a successful compilation:

The report provides the following information, as applicable:

Viewing Your Embedded MATLAB Function Code

To view your Embedded MATLAB function code, click the M-code tab. The compilation report displays the M-code for the function highlighted in the list on this tab.

The M-code tab provides:

Viewing Subfunctions

The compilation report annotates the subfunction with the name of the parent function in the list of functions on the M-code tab.

For example, if the M-functions fcn1 contains the subfunction subfcn and fcn2 contains the subfunction subfcn2, the report displays:

fcn1 > subfcn1
fcn2 > subfcn2

Viewing Specializations

If your Embedded MATLAB function calls the same function with different types of inputs, the compilation report numbers each of these specializations in the list of functions on the M-code tab.

For example, if the function fcn calls the function subfcn with different types of inputs:

function y = fcn(u) %#eml
% Specializations
y = y + subfcn(single(u));
y = y + subfcn(double(u));

The compilation report numbers the specializations in the list of functions.

fcn > subfcn > 1
fcn > subfcn > 2

Viewing Call Stack Information

To view call stack information, click the Call stack tab. The call stack lists the functions in the order that the top-level function calls them. It also lists the subfunctions that each function calls.

Viewing the Compilation Summary Information

To view a summary of the compilation results, including type of target and number of errors or warnings, click the Summary tab.

Viewing Error and Warning Messages

The compilation report provides information about errors and warnings. If errors occur during simulation of a Simulink model, simulation stops. If warnings occur, but no errors, simulation of the model continues.

The compilation report provides information about warnings and errors by:

Viewing Errors and Warnings in the All Messages Tab

If errors or warnings occurred during compilation, click the All Messages tab to view a complete list of these messages. The report lists the messages in the order that the compiler detects them. It is best practice to address the first message in the list, because often subsequent errors and warnings are related to the first message. The compilation report marks messages as follows:

Error
Warning

To locate the offending line of code for an error or warning in the list, click the message in the list. The compilation report highlights errors in the list and M-code in red and warnings in orange. Click the blue line number next to the offending line of code in the M-code window to go to the error in the source file.

Viewing Error and Warning Information in Your M-Code

If errors or warnings occurred during compilation, the compilation report highlights them in your M-code.

To learn more about a particular error or warning, place your pointer over the highlighted text. The compilation report provides more information as follows:

Viewing Variables in Your M-Code

The compilation report provides compile-time type information for the variables and expressions in your M-code, including name, type, size, complexity, and class. The report also provides type information for fixed-point data types including word length and fraction length. You can use this type information to find sources of error messages and to understand type propagation rules.

You can view information about the variables in your Embedded MATLAB function by:

Viewing Variable Information in the Variables Tab

To view a list of all the variables in your M-function, click the Variables tab. The compilation report displays a complete list of variables in the order they appear in the M-function selected in the M-code tab. Clicking a variable in the list highlights all instances of that variable, and scrolls the M-code panel so that the first instance is in view.

The report provides the following information about each variable, as applicable.

The report only displays a column if at least one variable in the code has information in that column. For example, if the code does not contain any fixed-point data types, the report does not display the DT mode, WL or FL columns.

Viewing Information about Variable-Size Arrays in the Variables Tab.   For variable-size arrays, the size field includes information on the computed maximum size of the array. The size of each array dimension that varies is prefixed with a colon :.

If Embedded MATLAB technology cannot compute the maximum size of a variable-sized array, the compilation report displays the size as :?.

For more information on how to use the size information for variable-sized arrays, see Representing Data that Varies in Size at Runtime in the Embedded MATLAB documentation.

Viewing Information about Variables and Expressions in Your Embedded MATLAB Function Code

To view information about a particular variable or expression in your Embedded MATLAB function code, place your pointer over the variable name or expression in the M-code pane. The compilation report highlights variables and expressions in different colors:

Green, when the variable has data type information at this location in the code.  

For variable-sized arrays, the size field includes information on the computed maximum size of the array. The size of each array dimension that varies is prefixed with a colon :.

Pink, when the variable has no data type information.  

Purple, information about expressions.   You can also view information about expressions in your M-code. Place your pointer over an expression in the M-code pane. The compilation report highlights expressions in purple and provides more detailed information.

Red, when there is error information for an expression.   If the Embedded MATLAB software cannot compute the maximum size of a variable-sized array, the compilation report provides error information.

Keyboard Shortcuts for the Compilation Report

You can use the following keyboard shortcuts to navigate between the different panes in the compilation report. Once you have selected a pane, use the Tab key to advance through data in that pane.

To select ...Use...
M-Code TabCtrl+m
Call Stack TabCtrl+k
M-Code Pane Ctrl+w
Summary TabCtrl+s
All Messages TabCtrl+a
Variables TabCtrl+v

Compilation Report Limitations

The compilation report displays information about the variables and expressions in your Embedded MATLAB function, with the following limitations:

 varargin and varargout

 Loop Unrolling

 Dead Code

 Structures

 Column Headings on Variables Tab

 Comments

 Multiline Matrices

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS