Creating and Using a Code Generation Report

Overview

The Real-Time Workshop® Embedded Coder™ code generation report is an enhanced version of the HTML code generation report normally generated by the Real-Time Workshop® build process. The report consists of several sections:

Generating an HTML Code Generation Report

To generate a code generation report,

  1. Open the Configuration Parameters dialog box or Model Explorer and navigate to the Real-Time Workshop > Report pane.

  2. Select Create code generation report. By default, Launch report automatically and Code-to-model also are selected, and Model-to-code is cleared, as shown in the figure below.

    You can select or clear any of these options as desired.

  3. Generate code from your model or subsystem (for example, for a model, by clicking Build on the Real-Time Workshop pane of the Configuration Parameters dialog box).

  4. The Real-Time Workshop build process writes the code generation report files in the html subdirectory of the build directory. The top-level HTML report file is named model_codegen_rpt.html or subsystem_codegen_rpt.html.

  5. If you selected Launch report automatically, the Real-Time Workshop build process automatically opens a MATLAB Web browser window and displays the code generation report.

    If you did not select Launch report automatically, you can open the code generation report (model_codegen_rpt.html or subsystem_codegen_rpt.html) manually into a MATLAB Web browser window, or into another Web browser.

  6. If you selected Code-to-model, hyperlinks to blocks in the generating model are created in the report files. When you view the report files in a MATLAB Web browser, clicking on these hyperlinks displays and highlights the referenced blocks in the model. For more information, see Using Code-to-Model Traceability.

  7. If you selected Model-to-code, model-to-code highlighting support is included in the generated HTML report. To highlight the generated code for a block in your Simulink model, right-click the block and select Real-Time Workshop > Navigate to Code. This selection highlights the generated code for the block in the HTML code generation report. For more information, see Using Model-to-Code Traceability and Viewing the Traceability Report.

Using Code-to-Model Traceability

To use Code-to-model,

  1. Open an ERT-based model and go to the Real-Time Workshop + Report pane of the Configuration Parameters dialog box. Select the option Create Code Generation report. By default, Launch report automatically and Code-to-model also are selected.

  2. Build your model. This will launch an HTML code generation report.

  3. In the HTML report window, click any of the hyperlinks present to highlight the source block. For example, in the HTML report shown below for the demo model rtwdemo_hyperlinks, you could click the first UnitDelay hyperlink in the generated code for the model step function.

  4. Making this selection highlights the corresponding source block in the Simulink model window.

See also the demo rtwdemo_hyperlinks, which walks you through using Code-to-model .

Using Model-to-Code Traceability

To use Model-to-code,

  1. Open an ERT-based model and go to the Real-Time Workshop > Report pane of the Configuration Parameters dialog box. Select the options Create Code Generation report, Launch report automatically, and Model-to-code. (Selecting Model-to-code also enables the Configure button, which you can use to open the Model-to-code dialog box; see Using the Model-to-Code Navigation Dialog Box to Load Existing Trace Information.)

  2. Build your model. This launches an HTML code generation report.

  3. In the model window, right-click any block. In the right-click menu, select Real-Time Workshop > Navigate to Code.

  4. This selection highlights the generated code for the block in the HTML code generation report. The total number of highlighted lines is displayed next to each source file name in the left panel of the HTML report. Previous and Next buttons help you navigate through the highlighted lines.

See also the demo rtwdemo_hyperlinks, which walks you through using Model-to-code.

Using the Model-to-Code Navigation Dialog Box to Load Existing Trace Information

To open the Model-to-code navigation dialog box, click the Configure button on the Real-Time Workshop > Report pane of the Configuration Parameters dialog box. You can use this dialog box to reconnect your model with a previously-generated build directory, including trace information for model-to-code highlighting.

If you find that you cannot use right-click Real-Time Workshop > Navigate to Code to trace a block's code, because Navigate to Code is greyed out, it means that a build directory for your model cannot be found in the current working directory. To fix this without having to reset the current working directory or rebuild the model,

  1. Click the Configure button to launch the Model-to-code navigation dialog box.

  2. In the dialog box, click the Browse button, browse to the build directory for your model, and select the directory. The build directory path should be displayed in the Build directory field of the dialog box, as shown in the example above.

  3. Click Apply or OK. This loads trace information from the earlier build into your Simulink session, provided that you selected Model-to-code for the build.

  4. Now you can now successfully use right-click Real-Time Workshop > Navigate to Code to trace a block's code.

Viewing the Traceability Report

When you select the Model-to-code parameter discussed in the previous section, the generated HTML report contains a traceability report. The traceability report contains sections that allow you to account for Eliminated / Virtual Blocks versus Traceable Simulink Blocks, providing a complete mapping between blocks and code.

See the demo rtwdemo_hyperlinks, which walks you through using the traceability report.

Traceability Limitations

The following limitations apply to the traceability features of HTML code generation reports.

  


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