Main Content

本页面提供的是上一版软件的文档。当前版本中已删除对应的英文页面。

模型配置

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

涉及代码生成的模型配置参数定义代码生成器如何从模型中生成代码并编译可执行文件。模型顾问可以检查您的模型是否符合各项标准和规范,以及是否准备好生成代码。代码生成顾问会根据您指定的目标来审核您的模型。

模型设置

全部展开

目标选择

系统目标文件File that controls code generation stage of build process
语言Programming language of generated code
语言标准Language standard supported by compiler

编译过程

仅生成代码Generate code versus an executable program
代码和工件打包Package generated code and artifacts in ZIP file
编译器优化级别Control application of compiler optimizations
自定义编译器优化标志Compiler optimization flags
工具链Toolchain to use when building executable program or library
编译配置Build configuration defined by toolchain
工具链详细信息Baseline toolchain settings
生成联编文件Enable generation of makefile to use for compiling generated code
make 命令Make command and options for initiating build process
模板联编文件Template makefile to use to generate makefile for specified system target file

代码生成目标

选择目标Code generation objective
生成代码前检查模型Choose whether to run Code Generation Advisor checks

高级参数

自定义 FFT 库回调Callback for custom FFT library usage
自定义 BLAS 库回调Callback for custom BLAS library usage
自定义 LAPACK 库回调Callback for custom LAPACK library usage
详细编译Enable display of build process stages and compiler output
在当前编译文件夹中保留 .rtw 文件Retain generated model.rtw file
探查 TLCProfile execution of TLC files used to generate code for model
启用 TLC 断言Produce TLC stack trace
生成代码时启动 TLC 覆盖率报告Log coverage of TLC code during code generation
生成代码时启动 TLC 调试器During code generation, start TLC debugger
Zip 文件名Name of ZIP file
在 Simulink 工具条中显示自定义硬件 AppShow Custom Hardware App in Simulink Toolstrip
在 Simulink 工具条中显示嵌入式硬件 AppShow Embedded Hardware App in Simulink Toolstrip
默认参数行为Represent numeric block parameters in generated code
利用目标硬件指令集扩展Instruction sets to generate single instruction, multiple data (SIMD) code
优化归约Single instruction, multiple data (SIMD) code for reduction operation loops
使用 memcpy 进行向量赋值Optimize code generated for vector assignments
Memcpy 阈值(字节)Specify minimum array size for which memcpy and memset function calls replace for loops for vector assignments
启用局部模块输出Declare block signals locally or globally
重用局部模块输出Reuse local output variables
消除多余的局部变量(表达式折叠)Specify to fold expressions into single expression
使用位集来存储状态配置Bitsets for storing state configuration variables
使用位集来存储布尔数据Bitsets to store Boolean data
最大堆栈大小(字节)Specify maximum stack size for local variables in model
循环展开阈值 Specify minimum array size width for generating for loops
内联不变信号Transform symbolic names of Invariant signals in generated code
删除涉及饱和处理的从浮点到整数转换中将 NaN 映射至零的代码Control generation of protective code that handles floating-point to integer conversion for NaN values
使用 memset 将浮点和双精度初始化为 0.0Control generation of code that explicitly initializes floating-point data to 0.0
删除从浮点到整数转换中将超出范围值绕回的代码Control generation of wrapping code that handles out-of-range floating-point to integer conversion values
可重用子系统的缓冲区Buffers to enhance reuse of subsystems
自动创建的枚举的基本存储类型Specify storage type and size of enumerations for state outputs
信号存储重用Reuse signal memory
创建代码生成报告Document generated code in an HTML report
自动打开报告Display code generation reports automatically
包括注释Include comments in generated code
Simulink 模块注释包括 Simulink 模块注释
Stateflow 对象注释Include Stateflow object comments
MATLAB 源代码作为注释Include MATLAB source code as comments
显示已消除模块Include eliminated blocks' comments
为 Simulink 全局存储类显示详细注释Reduce code size or improve code traceability
最大标识符长度Specify maximum number of characters in identifiers
使用与仿真目标相同的保留名称Specify whether to use reserved names from the Simulation Target pane
保留名称Avoid name conflicts with custom code
重复的枚举成员名称Specify the action to take if the code generator detects two enumeration types with same member names
使用与仿真目标相同的自定义代码设置Use custom code settings from the Simulation Target > Custom Code pane
源文件Include custom code in the generated model source file
头文件Include custom code in the generated model header file
初始化函数Include custom code in the generated model initialize function
终止函数Include custom code in the generated model terminate function
包含目录Add folders to the include path
源文件Compile and link additional source files with the generated code
用生成的代码链接附加库
定义Add preprocessor macro definitions to the compiler command line

主题

快速入门

  • Code Generation Configuration
    Modify the model configuration parameters specific to code generation from the Configuration Parameters Dialog box.

代码生成配置

模型顾问

代码生成顾问

模型配置参数