Main Content

Analyze Generated Service Code Interface Report

When you generate a code generation report, you can include a code interface report, which documents the generated code interface, including model entry-point functions and services. The code interface information helps you to review the generated code and integrate it with other code. The information in the report depends on the type of code interface configuration that you use. For models that use a data interface configuration for the generated code, the code interface report includes information about data and functions. See Analyze Generated Data Code Interface Report.

For code that you configure with service interfaces, the code interface report includes these subsections:

  • Introduction — A high-level description of how the code interface interacts with services provided by the target platform software

  • Execution Interfaces — Interface information about each model execution entry-point function, including model_initialize, model_step, and (if applicable) model_reset and model_terminate

  • Service Interfaces — Interface information about platform services that the generated code uses, including data transfer and timer services

To generate a code interface report, select the configuration parameters Create code generation report and Code Interface Report. For more information, see Generate Code Generation Report. For limitations that apply to code interface reports, see Code Interface Report Limitations.

To open the example models used in this topic, use the openExample command:

openExample('ComponentDeploymentFcn'); 

Navigate Code Interface Report Subsections

To help you navigate code interface descriptions, the code interface report provides show/hide tokens and hyperlinks.

  • For a large subsection, the report provides Hide and Show buttons that allow you to collapse or expand that section.

  • The code interface report provides several forms of hyperlink navigation:

    • The Table of Contents located at the top of the code interface report provides links to each sections and subsections of the report.

    • You can click each function name to go to its definition in model.c.

    • You can click the header file name for each function to go to the header file source listing.

    • If you select the configuration parameter Code-to-model, to go to the corresponding location in the model display, you can click hyperlinks for these constructs:

      • Function argument

      • Function return value

      • Variable representing an inport

      • Variable representing an outport

      • Interface parameter (if the parameter source is a block)

      • Variable representing a data store (if the data store source is a Data Store Memory block)

For backward and forward navigation within the HTML code generation report, use the Back and Forward arrow buttons above the Content section in the upper-left corner of the report.

Interpret the Execution Interfaces Section

The Execution Interfaces section of the code interface report provides this interface information about each model entry-point function, including model_initialize, model_step, and (if applicable) model_reset and model_terminate.

  • The function name

  • Description of the purpose of the function including:

    • Sample time interval for functions that the code calls periodically. If the code does not call the function periodically, the section does not show a sample time.

    • A link to the associated model element for exported functions.

  • Header file information

  • Function prototype including the function return value, name, and arguments

  • A list of services that the function calls, with a link to the report subsection for each service. You can also place your cursor over the link to see a tooltip with information about the service interface.

For example, consider the Execution Interfaces subsection for the model ComponentDeploymentFcn.

Execution section of the code interface report. The cursor points to the link to a data transfer service and a tooltip next to the cursor shows interface information for the data service.

Interpret the Service Interfaces Section

The Service Interfaces section of the code interface report provides this interface information about each service in the generated code.

  • The service name

  • Description of the purpose of the service, including a link to the model element if the service is associated with a block.

  • Header file information

  • Service prototype

  • A list of functions that call the service, with a link to the report subsection for each function

  • Data communication method. The options are outside execution, during execution, or direct access.

For example, consider this portion of the Service Interfaces section for the model ComponentDeploymentFcn.

Code interface report for the ComponentDeploymentFcn model showing the sections for sender service interfaces and data transfer service interfaces.

Code Interface Report Limitations

These limitations apply to the code interface section of the HTML code generation reports.

  • The code interface report supports data resolved with most storage classes, except when the storage class properties are set in one of these ways:

    • The storage class property Type is set to FlatStructure, such as when the BitField and Struct storage classes in the Simulink® package have Type set to FlatStructure.

    • The storage class property Type is set to Other, such as when the GetSet storage class in the Simulink package has Type set to Other.

    • The storage class property Data access is set to Pointer, indicating that the code declares imported symbols as pointer variables rather than simple variables. This property is accessible only when the storage class property Data scope is set to Imported or Instance-specific.

    In these cases, the report displays empty Data Type and Dimension fields.

  • For outports, if you optimize memory, the code interface report cannot describe the associated memory (data type and dimensions). In these cases, the report displays empty Data Type and Dimension fields.

  • The code interface report does not support data type replacement using the Code Generation > Data Type Replacement pane of the Configuration Parameters dialog box. The data types in the report link to built-in data types rather than their specified replacement data types.

Related Topics