You can use the Target Language Compiler (TLC) to fine-tune your generated code. TLC supports extended code generation variables and options in addition to parameters available on the Code Generation pane on the Configuration Parameters dialog box. There are two ways to set TLC variables and options, as described in this section.
Do not customize TLC files in the folder
though the capability exists to do so. It is possible that such TLC customizations
are not applied during the code generation process. Such customizations can lead to
%assign statement lets you assign a value to a TLC
variable, as in:
%assign MaxStackSize = 4096
This assignment is also known as creating a parameter name/parameter value pair.
For a description of the
%assign statement, see Target Language Compiler Directives. 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
Target Language Compiler Optional Variables
When the Enable local
block outputs check box is selected,
the total allocation size of local variables that are declared
by block outputs in the model cannot exceed
Note: Local variables in the
generated code from sources other than local block outputs, such
as from a Stateflow® diagram or MATLAB Function
block, and stack usage from sources such as function calls and
context switching are not included in the
When the Enable local block outputs
check box is selected, this selection limits the size of a local
block output variable declared in the code to
For a model that uses fixed-point data types, control the
generation of preprocessor directives that perform fixed-point
word size checks. If
You can also suppress the generation of the preprocessor directives by running this command:
set_param(gcs, 'TLCOptions', ... '-aRemoveFixptWordSizeChecks=1')
If you generate code that does not contain the fixed-point word size checks, you can use processor-in-the-loop (PIL) simulations that check Hardware Implementation settings with reference to the target hardware. For more information, see Verification of Code Generation Assumptions (Embedded Coder).
Flag to control display of overflow warnings for blocks that have saturation capability, but have it turned off (not selected) in their dialog box. Options include:
You can specify TLC command-line options for code generation using the model
TLCOptions in a
set_param function call. For
information about these options, see Specify TLC for Code Generation and Configure TLC.