管理构建过程文件依赖性
生成代码大小的重要控制是管理随附的文件的数量和大小(依赖关系)。为了减少生成代码所需的系统标头文件和生成的标头文件的数量,了解构建过程生成的依赖项以及导致依赖关系的条件很有帮助。
生成的源和标头文件之间的依赖关系显示在图中。来自文件点到其包含的文件的箭头。例如,在simulink上存在其他依赖性金宝app®header filestmwtypes.h
和simstruc_types.h
,加上C或C ++库文件。图形映射仅在构建文件夹中生成的文件之间的包含关系。这些文件可以引用位于代码生成文件夹中的实用程序和模型参考代码。有关构建过程创建的文件夹和文件的更多信息,请参见管理构建过程文件夹和管理构建过程文件。
这两个表确定了控制GRT和ERT目标依赖性文件的条件。要管理与构建相关的依赖关系,请考虑这些条件如何适用于您的模型和代码生成过程。然后,配置模型参数和代码生成选项以管理构建过程文件依赖性。
由于使用基于ERT的系统目标文件生成的代码的文件包装选项差异,文件依赖项与基于GRT基于GRT的系统目标文件生成的代码的文件包装略有不同。看Manage File Packaging of Generated Code Modules(嵌入式编码器)。
The parent system header files (
) include child subsystem header files (模型
。H
). In more layered models, subsystems similarly include their children's header files in the model hierarchy. As a consequence, subsystems are able to view recursively into their descendant subsystems and view into the root system because every子系统
。H
或者子系统
。C
包括子系统
。Cpp
和模型
。H
。模型
_private.h
In the figure, files
,模型
。H
, 和模型
_private.h
depend on the header file子系统
。Hrtwtypes.h
。如果您使用不基于ERT系统目标文件的系统目标文件,则您生成的源文件可以在tmwtypes.h
和simstruc_types.h
。
For information about file dependencies in header files, see the following:
系统标头文件
系统标题文件使函数声明,类型定义和宏观定义可用于旧版或外部代码。某些代码生成方案需要包括特定于代码生成器产品的标头文件。
代码生成器包括一些用于广泛定义的情况的系统标头文件。例如,生成的代码包括
when the model contains a utility function that requires this header file. This approach helps identify header file dependencies:
将共享代码放置参数设置为
“共享位置”
并构建模型。代码生成器将实用程序功能放置在__ sharedutils
folder.Use a find-in-file utility (for example, grep utility) to search the
。C
和。H
files in the__ sharedutils
folder for#include
。The search results list the utilities with header file dependencies.Use this information to identify utilities to remove from the model and reduce header file dependencies in the generated code.
有关更多信息,请参阅Generate Shared Utility Code for Fixed-Point Functions。
System Header File | Description and Inclusion Conditions for GRT or ERT System Target Files |
---|---|
Defines math constants GRT - 生成的代码不包括此文件。 ERT - 当代码尊重您的求解器的模型配置时,生成的代码包括此文件停止时间和要么:
|
|
Provides floating-point math functions GRT - 当您的模型包含浮点数数学功能时,生成的代码包括此文件。 ERT - 当您的模型包含浮点数数学功能时,生成的代码包括此文件,除非代码更换库条目覆盖了该功能。有关更多信息,请参阅选择一个代码替换库。 |
|
Defines NULL GRT and ERT—Generated code includes this file when your model contains a utility function that requires this file. |
|
提供文件I/O功能 GRT - 当您的模型包含一个时,生成的代码包括此文件To Fileblock. ERT—Generated code includes this file when either:
|
|
Provides utility functions such as the integer versions of GRT - 生成的代码包括此文件:
ERT—Generated code includes this file when either:
|
|
提供内存功能,例如 当你莫GRT-Generated代码包括这个文件del initialization code calls ERT - 当块或模型初始化代码调用时,生成的代码包括此文件 For a list of relevant blocks, in the Command Window, type:
Look for blocks with the N2 note. To omit calls to |
Code Generator Header Files
表中的依赖项生成的标头文件适用于系统目标文件grt.tlc
和ert.tlc
。System target files derived from these base system target files can have additional header dependencies. Code generation for blocks from blocksets, embedded targets, and custom S-functions can introduce additional header dependencies.
标题文件 | Description and Inclusion Conditions for GRT or ERT System Target Files |
---|---|
|
定义与内置数据类型相对应的枚举类型 GRT和ERT - 当适用这些条件的一个或多个时,生成的代码包括此文件:
|
|
定义外部模式的数据结构 GRT and ERT—Generated code includes this file when your model configuration enables external mode. |
|
定义外部模式功能 GRT and ERT—Generated code includes this file when your model configuration enables external mode. |
|
Provides fixed-point support for noninlined S-functions GRT - 生成的代码包括此文件。 ERT—Generated code includes this file when either:
|
|
包含定时桥的类型定义 GRT和ERT - 当构建参考模型或构建包含模型块的模型时,生成的代码包括此文件。 |
|
定义特定于模型的数据类型 GRT and ERT—Generated code includes this file. |
|
包含用于多词范围范围数据类型的类型定义及其单词尺寸的块 GRT和ERT - 当适用这些条件的一个或多个时,生成的代码包括此文件:
|
|
金宝app支持无限数字 GRT—Generated code includes this file when one or more of these conditions apply:
ERT - 当应用其中一个或多个条件应用时,生成的代码包括此文件:
|
|
包含特殊数学常数的类型定义(例如π和e)并定义 GRT和ERT-生成的代码包括此文件:
|
|
金宝app支持垫子文件记录和包括: rtwtypes.h内置in_typeid_types.h multiword_types.h rt_mxclassid.h rtw_matlogging.h GRT - 生成的代码包括此文件。 ERT—Generated code includes this file when you model configuration enablesMAT-file logging。看MAT-file logging。 |
|
Defines GRT和ERT - 当代码包含时,生成的代码包括此文件 |
|
金宝app支持连续的时间 GRT—Generated code includes this file when the code includes ERT—Generated code includes this file when your model configuration selects金宝app支持:连续时间和when the code does not already include |
|
金宝app支持外部模式 GRT—Generated code includes this file when the code includes ERT - 当您的模型配置选择外部模式以及代码尚未包含时,生成的代码包括此文件 |
|
金宝app支持垫子文件记录 GRT—Generated code includes this file when the code includes ERT—Generated code includes this file when the code includes |
|
金宝app支持连续状态 GRT—Generated code includes this file when the code includes ERT—Generated code includes this file when your model configuration selects金宝app支持:连续时间和when the code does not already include |
|
定义代码生成器数据类型 GRT - 生成的代码包括此文件。使用该文件的完整版本,其中包括 ERT - 生成的代码包括此文件。使用文件的完整或优化版本。看rtwtypes.h。 If you include |
|
金宝app支持调用使用非线值的s函数 limits.h string.h tmwtypes.h simstruc_types.h GRT - 生成的代码包括此文件。 ERT—Generated code includes this file when either:
|
|
Provides definitions that the generated code uses and includes the header files: rtw_matlogging.h rtw_extmode.h rtw_continuun.h rtw_solver.h sysran_types.h GRT—Generated code includes this file when the code includes ERT - 生成的代码不包括此文件。对于ert, |
|
金宝app支持外部模式 GRT—Generated code includes this file when the code includes ERT - 当您的模型配置选择外部模式以及代码尚未包含时,生成的代码包括此文件 |
|
包含针对具有触发子系统的模型的零交叉定义,其中触发器正在上升,下降或任何一个。仅在模型要求的情况下才能生成文件,该模型由触发信号的数据类型确定。例如,如果触发信号的数据类型是布尔值,则不需要零口气检测。 GRT - 生成的代码不包括GRT代码生成目标的此文件。 ERT - 当模型具有有条件地执行的子系统时,触发器使用零交叉检测时,生成的代码包括此文件。 If generated, the content of |