Main Content

Code Generation Configuration Sets

Configure models for simulation and code generation

The model configuration parameters for code generation define how the code generator produces code and builds an executable from your model.

Model Settings

expand all

Shared coder dictionaryEmbedded Coder Dictionary that contains code interface configuration for code generation
Prioritized objectivesPrioritized list of Code Generation Advisor objectives to apply for reviewing model configuration parameter settings

Data initialization

Remove root level I/O zero initializationControl generation of initialization code for root-level inports and outports set to zero
Remove internal data zero initializationControl generation of Initialization code for internal work structures, such as block states and block outputs, to zero

Optimization levels

LevelOptimization level for generated code
PriorityControl application of optimizations based on priority
Specify custom optimizationsEnable option to choose individual optimization parameters
Simplify array indexingReplace multiply operations in array indices when accessing arrays in a loop
Generate parallel for-loopsOptimization for parallel for-loops
Pack Boolean data into bitfieldsControl storing Boolean signals
Reuse buffers of different sizes and dimensionsReuse buffers to store data of different sizes and dimensions
Optimize global data accessOptimize global variable usage
Optimize block operation order in the generated codeSpecify to reorder block operations for improved code execution speed
Reuse global block outputsOptimization to reuse global variables
Reuse output buffers of Model blocksReuse referenced model buffers if possible
Perform in-place updates for Assignment and Bus Assignment blocksReuse the input and output variables of Bus Assignment and Assignment blocks
Reuse buffers for Data Store Read and Data Store Write blocksEliminate temporary buffers for Data Store Read and Data Store Write blocks
Bitfield declarator type specifierSpecify bitfield type
Pass reusable subsystem outputs asControl how a reusable subsystem passes outputs

Advanced parameters

Optimize using the specified minimum and maximum valuesOptimize using minimum and maximum values for signals and parameters
Remove Code from Tunable Parameter Expressions That Saturate Out-of-Range ValuesControl generation of protective code that saturates out-of-range tunable parameter expression values
Remove code that protects against division arithmetic exceptionsControl generation of protective code for division arithmetic exceptions
Use signal labels to guide buffer reuseReuse buffers by using signal labels
Operator to represent Bitwise and Logical Operator blocksSpecify operator type in generated code
Code-to-modelInclude hyperlinks in the code generation report that link to the model diagram
Model-to-codeEnable code highlighting in the code generation report when you click on Simulink blocks, Stateflow objects, and MATLAB functions
Eliminated / virtual blocksInclude a summary of eliminated and virtual blocks in the code generation report
Traceable Simulink blocksInclude a summary of Simulink blocks and the corresponding code locations in the code generation report
Traceable Stateflow objectsInclude a summary of Stateflow objects and the corresponding code locations in the code generation report
Traceable MATLAB functionsInclude a summary of MATLAB functions and corresponding code locations in the code generation report
Summarize which blocks triggered code replacementsInclude a summary of replacement functions used and their associated blocks in the code generation report
Generate model Web viewInclude the model Web view in the code generation report
Static code metricsGenerate static code metrics report
Trace to model usingSpecify format of comments
Operator annotationsInclude operator annotations for Polyspace in generated comments
Simulink block descriptionsInsert descriptions of blocks as comments in generated code
Simulink data object descriptionsInclude descriptions of Simulink data objects as comments in generated code
Custom comments (MPT objects only)Include comments for MPT signal and parameter data in generated code
Custom comments functionSpecify a file that contains comments for MPT signal and parameter data objects
Stateflow object descriptionsInclude descriptions of Stateflow objects in generated comments
Requirements in block commentsInclude requirement descriptions in generated comments
MATLAB user commentsInclude MATLAB user comments in generated code
Insert Polyspace commentsInclude code comments for Polyspace block annotations
Comment styleSpecify comment style in generated code

Auto-generated identifier naming rules

Global variablesCustomize generated global variable identifiers
Global typesCustomize generated global type identifiers
Field name of global typesCustomize generated field names of global types
Subsystem methodsCustomize generated function names for reusable subsystems
Subsystem method argumentsCustomize generated function argument names for reusable subsystems
Local temporary variablesCustomize generated local temporary variable identifiers
Local block output variablesCustomize generated local block output variable identifiers
Constant macrosCustomize generated constant macro identifiers
Minimum mangle lengthSpecify the minimum number of characters for name-mangling
System-generated identifiersSpecify whether to use shorter names for the $N token in system-generated identifiers
Generate scalar inlined parameter asExpress scalar inlined parameter values in the generated code as literals or macros

Advanced parameters

Shared checksum lengthSpecify character length of $C token
EMX array utility functions identifier formatCustomize generated identifiers for emxArray utility functions
EMX array types identifier formatCustomize generated identifiers for emxArray types
Shared utilities identifier formatCustomize shared utility identifiers
Custom token textSpecify text to insert for $U token
Signal namingSpecify rules for naming mpt signals in generated code
M-functionSpecify rules for naming identifiers in generated code
#define namingSpecify rule for naming #define parameters in generated code
M-functionSpecify rule for naming identifiers in generated code
Parameter namingSpecify rules for naming mpt parameters in generated code
M-functionSpecify rules for naming identifiers in generated code
Parentheses levelParenthesization style for generated code
Preserve operand order in expressionPreserve order of operands in expressions
Preserve condition expression in if statementPreserve empty primary conditions in if statements
Convert if-elseif-else patterns to switch-case statementsGenerate code for if-elseif-else logic as switch-case statements
Preserve extern keyword in function declarationsInclude extern keyword in function declarations
Preserve static keyword in function declarationsInclude static keyword in function declarations
Suppress generation of default cases for Stateflow switch statements if unreachableWhether to generate default cases for switch-case statements for Stateflow charts
Replace multiplications by powers of two with signed bitwise shiftsReplace multiplications by powers of two with signed bitwise shifts
Allow right shifts on signed integersAllow right bitwise shifts on signed integers
Casting modesMethod of casting data types for variables
Array container typeContainer type for arrays
Indent styleStyle for placement of braces
Indent sizeSize for indents in generated code
Newline styleNewline character in generated code
Maximum line widthMaximum line width for wrapping generated code
Code templates: Source file (*.c) templateSource code file template
Code templates: Header file (*.h) templateTemplate for generated code header
Data templates: Source file (*.c) templateTemplate for generated data source file
Data templates: Header file (*.h) templateTemplate for generated data header file
File customization templateTemplate for custom file processing
Generate an example main programControl generation of example main program
Target operating systemTarget operating system for example main program
Generate full file bannerInclude code generation information in header file banner
Enable custom file bannerControl whether to use configurations for code and data templates
Data definitionPlacement of global variable definitions
Data definition filenameFile to contain data definitions
Data declarationLocation for data declarations
Data declaration filenameFile to contain deta declarations
#include file delimiterType of delimiter for include file
Use owner from data object for data definition placementWhether to use data ownership setting for definition in code
Signal display levelPersistence level for MPT signal data objects
Parameter tune levelPersistence level for MPT parameter data objects
File packaging formatMethod of file packaging for generated code files
Header filesCustom name for header files
Source filesCustom name for source files
Data filesCustom name for data files
Rate Transition block codeFormat for rate transition block code and data

Objects

expand all

rtw.codegenObjectives.ObjectiveCustom code generation objective

Blocks

expand all

Custom MATLAB fileUpdate active configuration parameters of parent model by using file containing custom MATLAB code
ERT (optimized for fixed-point)Update active configuration parameters of parent model for ERT fixed-point code generation
ERT (optimized for floating-point)Update active configuration parameters of parent model for ERT floating-point code generation
GRT (debug for fixed/floating-point)Update active configuration parameters of parent model for GRT fixed-point or floating-point code generation
GRT (optimized for fixed/floating-point)Update active configuration parameters of parent model for GRT fixed-point or floating-point code generation

Topics

Code Generation Configuration

Model Configuration Parameters: Code Generation

Related Information