| Contents | Index |
Use parameters on the Diagnostics and Code Generation > Debug panes of the Configuration Parameter dialog box to configure a model such that generated code and the build process are optimized for debugging. You can set parameters that apply to the model compilation phase, the target language code generation phase, or both.
Parameters in the following table will be helpful if you are writing TLC code for customizing targets, integrating legacy code, or developing new blocks.
| To... | Select... |
|---|---|
| Display progress information during code generation in the MATLAB Command Window | Verbose build.Compiler output also displays. |
| Prevent the build process from deleting the model.rtw file from the build folder at the end of the build | Retain .rtw file. This parameter is useful if you are modifying the target files, in which case you need to look at the model.rtw file. |
| Instruct the TLC profiler to analyze the performance of TLC code executed during code generation and generate a report | Profile TLC. The report is in HTML format and can be read in your Web browser. |
| Start the TLC debugger during code generation | Start TLC debugger when generating code. Alternatively, enter the argument -dc for the System target file parameter on the Code Generation pane. To start the debugger and run a debugger script, enter -df filename for System target file. |
| Generate a report containing statistics indicating how many times the Simulink Coder code generator reads each line of TLC code during code generation | Start TLC coverage when generating code. Alternatively, enter the argument -dg for the System Target File parameter on the Code Generation pane. |
| Halt a build if any user-supplied TLC file contains an %assert directive that evaluates to FALSE | Enable TLC assertion. Alternatively, you
can use MATLAB commands to control TLC assertion handling. To set the flag on or off, use the set_param command. The default is off. set_param(model, 'TLCAssertion', 'on|off') To check the current setting, use get_param. get_param(model, 'TLCAssertion') |
| Detect loss of tunability | Diagnostics > Data
Validity > Detect loss of tunability. You can use this parameter to report loss of tunability
when an expression is reduced to a numeric expression. This can occur
if a tunable workspace variable is modified by Mask Initialization
code, or is used in an arithmetic expression with unsupported operators
or functions. Possible values are:
For a list of supported operators and functions, see Tunable Expression Limitations |
| Enable model verification (assertion) blocks | Diagnostics > Data
Validity > Model Verification block enabling . Use this parameter to enable or disable model verification
blocks such as Assert, Check Static Gap, and related range check blocks.
The diagnostic has the same affect on generated code as it does on
simulation behavior. For example, simulation and code generation ignore
this parameter when model verification blocks are inside an S-function.
Possible values are:
For Assertion blocks not disabled, generated code for a model includes one of the following statements, depending on the blocks input signal type (Boolean, real, or integer, respectively). utAssert(input_signal); utAssert(input_signal != 0.0); utAssert(input_signal != 0); By default, utAssert has no effect in generated code. For assertions to abort execution, you must enable them by specifying the followingmake_rtw command for Code Generation > Make command: make_rtw OPTS="-DDOASSERTS" Use the following variant if you want triggered assertions to print the assertion statement instead of aborting execution: make_rtw OPTS="-DDOASSERTS -DPRINT_ASSERTS" utAssert is defined as #define utAssert(exp) assert(exp). To customize assertion behavior, provide your own definition of utAssert in a handwritten header file that overrides the default utAssert.h. For details on how to include a customized header file in generated code, see Configure Model for External Code Integration. When running a model in accelerator mode, the Simulink engine calls back to itself to execute assertion blocks instead of using generated code. Thus, user-defined callbacks are still called when assertions fail. |
See the Target Language Compiler documentation for details. Also, consider using the Model Advisor as a tool for troubleshooting model builds.
For descriptions of Debug pane parameters, see Code Generation Pane: Debug in the Simulink Coder reference documentation.
![]() | Code Appearance | Source Code Generation | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |