The code generator software produces an HTML code generation report so that you can view and analyze the generated code. When your model is built, the code generation process produces an HTML file that is displayed in an HTML browser or in the Model Explorer. The code generation report includes:
The Summary section that contains model and code information, including Author, Tasking Mode, System Target File, Hardware Device Type, and code generation objectives information. The Configuration settings at the time of code generation link opens a noneditable view of the Configuration Parameters dialog box. The dialog box shows the Simulink® model settings at the time of code generation, including TLC options.
The Subsystem Report section that contains information on nonvirtual subsystems in the model.
The Code Interface Report section that provides information about the generated code interface, including model entry-point functions and input/output data. For more information, see Analyze the Generated Code Interface.
In the Code section on the Contents pane, you can click the names of source code files generated from your model to view their contents.
For an example, see Generate a Code Generation Report.
If you have a Simulink Report Generator™ license, you can document your code generation project in multiple formats, including HTML, PDF, RTF, Microsoft® Word, and XML. For an example of how to create a Microsoft Word report, see Document Generated Code with Simulink Report Generator.
The default location for the code generation report files is
html subfolder of the build folder,
the name of the System target file specified
on the Code Generation pane. The default
name for the top-level HTML report file is
For more information on the location of the build folder, see Manage Build Process Folders.
To generate a code generation report for a top model and code generation reports for each referenced model, you need to specify the Create code generation report on the Code Generation > Report pane for the top model and each referenced model. You can open the code generation report of a referenced model in one of two ways:
From the top-model code generation report, you can access the referenced model code generation report by clicking the name of the top-model above the generated code. In the drop-down list of the model reference hierarchy, click the referenced model. To navigate back to the top model code generation report, use the Back button at the top of the left navigation pane or use the model reference hierarchy drop-down menu.
In the referenced model diagram window, on the C Code tab, click Open Report.
For more information, see Generate Code for Model Reference Hierarchy.
If you have an Embedded Coder® license, the code generator enhances the HTML code generation report. Configure your model to include the following sections in the report:
The Traceability Report section enables you to account for Eliminated / Virtual Blocks that are untraceable versus the listed Traceable Simulink Blocks / Stateflow Objects / MATLAB Scripts. This section provides a complete mapping between model elements and code. For more information, see Customize Traceability Reports.
The Static Code Metrics Report section provides generated
code statistics. Metrics are estimated from static analysis of the generated
code. To generate a static code metrics report without generating a code
generation report, use the function
coder.report.generateCodeMetrics. For more information, see
Static Code Metrics.
The Code Replacements Report section enables you to account for code replacement library (CRL) functions that were used during code generation, providing a mapping between each replacement instance and the Simulink block that triggered the replacement. For more information, see Analyze Code Replacements in Generated Code.
The Coder Assumptions section provides a list of:
Code generation assumptions for your target hardware that you can check.
Expected results for the assumption checks.
For more information, see Check Code Generation Assumptions.
The model Web view displays an interactive model diagram within the code generation report and supports traceability between the source code and the model. You can then share your model and generated code outside of the MATLAB environment. For more information, see Web View of Model in Code Generation Report.
On the Contents pane, in the Generated Files section, you can click the names of source code files generated from your model to view their contents in a MATLAB® Web browser window. In the displayed source code:
If you enable code-to-model traceability, hyperlinks within the displayed source code navigate to the blocks or subsystems from which the code is generated. For more information, see Code-to-Model Traceability.
If you enable model-to-code traceability, you can navigate to the generated code for a block in the model. For more information, see Model-to-Code Traceability.
If you set the Code coverage tool parameter on the Code Generation > Verification pane, you can view the code coverage data and annotations. For more information, see Configure Code Coverage with Third-Party Tools.
If you select the Generate static code metrics check box on the Code Generation > Report pane, you can view code metrics information and navigate to code definitions and declarations in the generated code. For more information, see View Static Code Metrics and Definitions Within the Generated Code.
To view the contents of your generated code and navigate between model and code, you can also use the Code view in the Code perspective. In the perspective, click the Code tab in the bottom-right corner.