Documentation

管理构建过程文件依赖性

生成代码大小的重要控制是管理随附的文件的数量和大小(依赖关系)。为了减少生成代码所需的系统标头文件和生成的标头文件的数量,了解构建过程生成的依赖项以及导致依赖关系的条件很有帮助。

生成的源和标头文件之间的依赖关系显示在图中。来自文件点到其包含的文件的箭头。例如,在simulink上存在其他依赖性金宝app®header filestmwtypes.hsimstruc_types.h,加上C或C ++库文件。图形映射仅在构建文件夹中生成的文件之间的包含关系。这些文件可以引用位于代码生成文件夹中的实用程序和模型参考代码。有关构建过程创建的文件夹和文件的更多信息,请参见管理构建过程文件夹管理构建过程文件

这两个表确定了控制GRT和ERT目标依赖性文件的条件。要管理与构建相关的依赖关系,请考虑这些条件如何适用于您的模型和代码生成过程。然后,配置模型参数和代码生成选项以管理构建过程文件依赖性。

由于使用基于ERT的系统目标文件生成的代码的文件包装选项差异,文件依赖项与基于GRT基于GRT的系统目标文件生成的代码的文件包装略有不同。看Manage File Packaging of Generated Code Modules(嵌入式编码器)。

The parent system header files (模型。H) 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子系统。C或者子系统。Cpp包括模型。H模型_private.h

In the figure, files模型。H,模型_private.h, 和子系统。Hdepend on the header filertwtypes.h。如果您使用不基于ERT系统目标文件的系统目标文件,则您生成的源文件可以在tmwtypes.hsimstruc_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:

  1. 将共享代码放置参数设置为“共享位置”并构建模型。代码生成器将实用程序功能放置在__ sharedutilsfolder.

  2. Use a find-in-file utility (for example, grep utility) to search the。C。Hfiles in the__ sharedutilsfolder for#include。The search results list the utilities with header file dependencies.

  3. 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 - 当代码尊重您的求解器的模型配置时,生成的代码包括此文件停止时间和要么:

  • Your model configuration enablesMAT-file logging。看MAT-file logging

  • Your model configuration enablesCode Generation>Interface>外部模式

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 ofdiv()ABS()

GRT - 生成的代码包括此文件:

  • 您的模型包括状态流®chart.

  • 您的模型包括math function block configured formod()或者rem(),生成电话div()

ERT—Generated code includes this file when either:

  • 您的模型包括状态流chart, and you selectSupport: floating-point numbers

  • 您的模型包括math function block configured formod()或者rem(),生成电话div()

提供内存功能,例如memset()memcpy()

当你莫GRT-Generated代码包括这个文件del initialization code callsmemset()

ERT - 当块或模型初始化代码调用时,生成的代码包括此文件memcpy()或者memset()

For a list of relevant blocks, in the Command Window, type:

showblockdatatypetable

Look for blocks with the N2 note. To omit calls tomemset()从模型初始化代码中选择Remove root level I/O zero initializationRemove internal data zero initialization优化配置参数。

Code Generator Header Files

表中的依赖项生成的标头文件适用于系统目标文件grt.tlcert.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

内置_typeid_ types.h

定义与内置数据类型相对应的枚举类型

GRT和ERT - 当适用这些条件的一个或多个时,生成的代码包括此文件:

  • Your model contains a Stateflow chart that uses messages.

  • Your model configuration enables:MAT-file logging。看MAT-file logging

  • 您的模型配置选择C API options atCode Generation>Interface

dt_info.h

定义外部模式的数据结构

GRT and ERT—Generated code includes this file when your model configuration enables external mode.

ext_work.h

定义外部模式功能

GRT and ERT—Generated code includes this file when your model configuration enables external mode.

fixepoint.h

Provides fixed-point support for noninlined S-functions

GRT - 生成的代码包括此文件。

ERT—Generated code includes this file when either:

  • 您的模型使用非线函数。

  • 您的模型配置选择经典呼叫接口

模型_参考_ types.h

包含定时桥的类型定义

GRT和ERT - 当构建参考模型或构建包含模型块的模型时,生成的代码包括此文件。

模型_ types.h

定义特定于模型的数据类型

GRT and ERT—Generated code includes this file.

多字_ types.h

包含用于多词范围范围数据类型的类型定义及其单词尺寸的块

GRT和ERT - 当适用这些条件的一个或多个时,生成的代码包括此文件:

  • Your model uses multiword data types.

  • Your model configuration enablesMAT-file logging。看MAT-file logging

  • Your model configuration enablesCode Generation>Interface>外部模式

rtGetInf.h

rtGetNaN.h

rt_nonfinite.h

金宝app支持无限数字

GRT—Generated code includes this file when one or more of these conditions apply:

  • 您的模型包含S功能。

  • 生成的代码需要无限的数字。

  • Your model configuration enablesMAT-file logging。看MAT-file logging

  • 您的模型配置选择经典呼叫接口

ERT - 当应用其中一个或多个条件应用时,生成的代码包括此文件:

  • 您的模型包含S功能。

  • 生成的代码需要无限的数字。

  • Your model configuration enablesMAT-file logging。看MAT-file logging

rt_defines.h

包含特殊数学常数的类型定义(例如π和e)并定义UNUSED_PARAMETER

GRT和ERT-生成的代码包括此文件:

  • 生成的代码需要数学常数定义。

  • 该功能主体无法访问所需的模型函数参数。

rt_logging.h

金宝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

rt_mxclassid.h

Definesmxarray类ID枚举

GRT和ERT - 当代码包含时,生成的代码包括此文件rt_logging.c

rtw_continuous.h

金宝app支持连续的时间

GRT—Generated code includes this file when the code includessimstruc_types.h

ERT—Generated code includes this file when your model configuration selects金宝app支持:连续时间和when the code does not already includeSIMSTRUC.H

rtw_extmode.h

金宝app支持外部模式

GRT—Generated code includes this file when the code includessimstruc_types.h

ERT - 当您的模型配置选择外部模式以及代码尚未包含时,生成的代码包括此文件SIMSTRUC.H

rtw_matlogging.h

金宝app支持垫子文件记录

GRT—Generated code includes this file when the code includessimstruc_types.hrt_logging.h

ERT—Generated code includes this file when the code includesrt_logging.h

rtw_solver.h

金宝app支持连续状态

GRT—Generated code includes this file when the code includessimstruc_types.h

ERT—Generated code includes this file when your model configuration selects金宝app支持:连续时间和when the code does not already includeSIMSTRUC.H

rtwtypes.h

定义代码生成器数据类型

GRT - 生成的代码包括此文件。使用该文件的完整版本,其中包括tmwtypes.hsimstruc_types.h。看simstruc_types.h依赖关系。

ERT - 生成的代码包括此文件。使用文件的完整或优化版本。看rtwtypes.h

If you includertwtypes.htmwtypes.h在与生成代码集成的外部代码中,#includeforrtwtypes.hmust precede the#includefortmwtypes.h。此顺序#includestatements preserves target-specific type definitions. If you reverse the order, a compiler error occurs.

SIMSTRUC.H

金宝app支持调用使用非线值的s函数simstructdefinition; also includes:

limits.h string.h tmwtypes.h simstruc_types.h

GRT - 生成的代码包括此文件。

ERT—Generated code includes this file when either:

  • 您的模型使用非线函数。

  • 您的模型配置选择经典呼叫接口

simstruc_types.h

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 includesrtwtypes.h

ERT - 生成的代码不包括此文件。对于ert,rtwtypes.hcontains definitions, and模型。Hcontains header files.

sysran_types.h

金宝app支持外部模式

GRT—Generated code includes this file when the code includessimstruc_types.h

ERT - 当您的模型配置选择外部模式以及代码尚未包含时,生成的代码包括此文件SIMSTRUC.H

Zero_crossing_types.h

包含针对具有触发子系统的模型的零交叉定义,其中触发器正在上升,下降或任何一个。仅在模型要求的情况下才能生成文件,该模型由触发信号的数据类型确定。例如,如果触发信号的数据类型是布尔值,则不需要零口气检测。

GRT - 生成的代码不包括GRT代码生成目标的此文件。

ERT - 当模型具有有条件地执行的子系统时,触发器使用零交叉检测时,生成的代码包括此文件。

If generated, the content ofZero_crossing_types.h总是一样。

相关话题

这个话题有帮助吗?