Main Content

本页翻译不是最新的。点击此处可查看最新英文版本。

代码生成配置集

配置模型以进行仿真和代码生成

涉及代码生成的模型配置参数定义代码生成器如何从模型中生成代码并编译可执行文件。

模型设置

全部展开

共享代码生成器字典Embedded Coder Dictionary that contains code interface configuration for code generation
优先目标Prioritized list of Code Generation Advisor objectives to apply for reviewing model configuration parameter settings

数据初始化

删除根级 I/O 零初始化Control generation of initialization code for root-level inports and outports set to zero
删除内部数据零初始化Control generation of Initialization code for internal work structures, such as block states and block outputs, to zero

优化级别

级别Optimization level for generated code
优先级Control application of optimizations based on priority
指定自定义优化Enable option to choose individual optimization parameters
简化数组索引Replace multiply operations in array indices when accessing arrays in a loop
生成并行 for 循环Optimization for parallel for-loops
将布尔数据打包到位域中Control storing Boolean signals
重用不同大小和维度的缓冲区Reuse buffers to store data of different sizes and dimensions
优化全局数据访问Optimize global variable usage
优化生成代码中的模块运算顺序Specify to reorder block operations for improved code execution speed
重用全局模块输出Optimization to reuse global variables
重用 Model 模块的输出缓冲区Reuse referenced model buffers if possible
为 Assignment 和 Bus Assignment 模块执行就地更新Reuse the input and output variables of Bus Assignment and Assignment blocks
重用 Data Store Read 和 Data Store Write 模块的缓冲区Eliminate temporary buffers for Data Store Read and Data Store Write blocks
位域声明符类型设定符Specify bitfield type
可重用子系统输出的传递方式Control how a reusable subsystem passes outputs

高级参数

使用指定的最小值和最大值进行优化Optimize using minimum and maximum values for signals and parameters
从可调参数表达式中删除对超出范围值进行饱和处理的代码Control generation of protective code that saturates out-of-range tunable parameter expression values
删除防止除法算术异常的代码Control generation of protective code for division arithmetic exceptions
使用信号标签来指导缓冲区重用Reuse buffers by using signal labels
用于表示 Bitwise Operator 和 Logical Operator 模块的运算符Specify operator type in generated code
代码到模型Include hyperlinks in the code generation report that link to the model diagram
模型到代码Enable code highlighting in the code generation report when you click on Simulink blocks, Stateflow objects, and MATLAB functions
已消除模块/虚拟模块Include a summary of eliminated and virtual blocks in the code generation report
可追溯的 Simulink 模块Include a summary of Simulink blocks and the corresponding code locations in the code generation report
可追溯的 Stateflow 对象Include a summary of Stateflow objects and the corresponding code locations in the code generation report
可追溯的 MATLAB 函数Include a summary of MATLAB functions and corresponding code locations in the code generation report
摘要显示哪些模块触发了代码替换Include a summary of replacement functions used and their associated blocks in the code generation report
生成模型 Web 视图Include the model Web view in the code generation report
静态代码指标Generate static code metrics report
使用以下方式追溯至模型Specify format of comments
运算符注释Include operator annotations for Polyspace in generated comments
Simulink 模块描述Insert descriptions of blocks as comments in generated code
Simulink 数据对象描述Include descriptions of Simulink data objects as comments in generated code
自定义注释(仅限 MPT 对象)Include comments for MPT signal and parameter data in generated code
自定义注释函数Specify a file that contains comments for MPT signal and parameter data objects
Stateflow 对象描述Include descriptions of Stateflow objects in generated comments
在模块注释中包含需求描述Include requirement descriptions in generated comments
MATLAB 用户注释Include MATLAB user comments in generated code
插入 Polyspace 注释Include code comments for Polyspace block annotations
注释样式Specify comment style in generated code

自动生成的标识符命名规则

全局变量Customize generated global variable identifiers
全局类型Customize generated global type identifiers
全局类型的字段名称Customize generated field names of global types
子系统方法Customize generated function names for reusable subsystems
子系统方法参数Customize generated function argument names for reusable subsystems
局部临时变量Customize generated local temporary variable identifiers
局部模块输出变量Customize generated local block output variable identifiers
常量宏Customize generated constant macro identifiers
代码生成 > 标识符 > 最小修饰长度Specify the minimum number of characters for name-mangling
系统生成的标识符Specify whether to use shorter names for the $N token in system-generated identifiers
生成标量内联参数作为Express scalar inlined parameter values in the generated code as literals or macros

高级参数

共享校验和长度Specify character length of $C token
EMX 数组工具函数标识符格式Customize generated identifiers for emxArray utility functions
EMX 数组类型标识符格式Customize generated identifiers for emxArray types
共享实用工具标识符格式Customize shared utility identifiers
自定义标记文本Specify text to insert for $U token
信号命名Specify rules for naming mpt signals in generated code
M 函数Specify rules for naming identifiers in generated code
#define 命名Specify rule for naming #define parameters in generated code
M 函数Specify rule for naming identifiers in generated code
参数命名Specify rules for naming mpt parameters in generated code
M 函数Specify rules for naming identifiers in generated code
括号层级Parenthesization style for generated code
保留表达式中的操作数顺序Preserve order of operands in expressions
保留 if 语句中的条件表达式Preserve empty primary conditions in if statements
将 if-elseif-else 模式转换为 switch-case 语句Generate code for if-elseif-else logic as switch-case statements
在函数声明中保留 extern 关键字Include extern keyword in function declarations
在函数声明中保留静态关键字Include static keyword in function declarations
禁止为 Stateflow switch 语句生成不可达的默认 caseWhether to generate default cases for switch-case statements for Stateflow charts
将二次幂的乘法替换为有符号按位移位Replace multiplications by powers of two with signed bitwise shifts
允许有符号整数右移Allow right bitwise shifts on signed integers
强制转换模式Method of casting data types for variables
数组容器类型Container type for arrays
缩进样式Style for placement of braces
缩进大小Size for indents in generated code
换行样式Newline character in generated code
最大行宽Maximum line width for wrapping generated code
代码模板:源文件(*.c)模板Source code file template
代码模板:头文件(*.h)模板Template for generated code header
数据模板:源文件(*.c)模板Template for generated data source file
数据模板:头文件(*.h)模板Template for generated data header file
文件自定义模板Template for custom file processing
生成示例主程序Control generation of example main program
目标操作系统Target operating system for example main program
生成完整文件前注Include code generation information in header file banner
启用自定义文件前注Control whether to use configurations for code and data templates
数据定义Placement of global variable definitions
数据定义文件名File to contain data definitions
数据声明Location for data declarations
数据声明文件名File to contain deta declarations
#include 文件分隔符Type of delimiter for include file
使用数据对象的所有者信息来确定数据定义的放置Whether to use data ownership setting for definition in code
信号显示级别Persistence level for MPT signal data objects
参数调整级别Persistence level for MPT parameter data objects
文件打包格式Method of file packaging for generated code files
头文件Custom name for header files
源文件Custom name for source files
数据文件Custom name for data files
Rate Transition 模块代码Format for rate transition block code and data

对象

全部展开

rtw.codegenObjectives.ObjectiveCustom code generation objective

模块

全部展开

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

主题

代码生成配置

模型配置参数:代码生成