Real-Time Workshop    

Target Language Compiler Variables and Options

The Target Language Compiler supports extended code generation variables and options in addition to those included in the code generation options categories of the Real-Time Workshop pane.

There are two ways to set TLC variables and options:

Assigning Target Language Compiler Variables

The %assign statement lets you assign a value to a TLC variable, as in

This is also known as creating a parameter name/parameter value pair.

The %assign statement is described in the Target Language Compiler Reference Guide. It is recommended that you write your %assign statements in the Configure RTW code generation settings section of the system target file.

The following table lists the code generation variables you can set with the %assign statement.

Table 2-3: Target Language Compiler Optional Variables  
Variable
Description
MaxStackSize=N
  • When Local block outputs is enabled, the total allocation size of local variables that are declared by all functions in the entire model may not exceed MaxStackSize (in bytes). N can be any positive integer. The default value for MaxStackSize is rtInf, i.e. unlimited stack size.

MaxStackVariableSize=N
When Local block outputs is enabled, this limits the size of any local variable declared in a function to N bytes, where N>0. A variable whose size exceeds MaxStackVariableSize will be allocated in global, rather than local, memory
WarnNonSaturatedBlocks= value
Flag to control display of overflow warnings for blocks that have saturation capability, but have it turned off (unchecked) in their dialog. These are the options:
  • 0 -- no warning is displayed
  • 1 -- displays one warning for the model during code generation
  • 2 -- displays one warning that contains a list of all offending blocks
BlockIOSignals=value
Supports monitoring signals in a running model. See Signal Monitoring via Block Outputs. Setting the variable causes the model_bio.c file to be generated. These are the options:
  • 0 -- deactivates this feature
  • 1 -- creates model_bio.c
ParameterTuning=value
Setting the variable to 1 causes a parameter tuning file (model_pt.c) to be generated. model_pt.c contains data structures that enable a running program to access model parameters independent of external mode. See C API for Parameter Tuning.

Setting Target Language Compiler Options

You can enter TLC options directly into the System target file field in the Target configuration category of the Real-Time Workshop tab of the Simulation Parameters dialog, by appending the options and arguments to the system target filename. This is equivalent to invoking the Target Language Compiler with options on the MATLAB command line.

The common options are shown in the table below.

Table 2-4: Target Language Compiler Options
Option
Description
-Ipath
Adds path to the list of paths in which to search for target files (.tlc files).
-m[N|a]
Maximum number of errors to report when an error is encountered (default is 5). For example, -m3 specifies that at most three errors will be reported. To report all errors, specify -ma.
-d[g|n|o]
Specifies debug mode (generate, normal, or off). Default is off. When -dg is specified, a .log file is create for each of your TLC files. When debug mode is enabled (i.e., generate or normal), the Target Language Compiler displays the number of times each line in a target file is encountered.
-aVariable=val
Equivalent to the TLC statement
%assign Variable = val
Note: It is recommended that you use %assign statements in the TLC files, rather than the -a option.


  Configuring the Generated Code via TLC Generated Code Formats