文档

Configure a System Target File

要配置代码生成的模型,请按照以下步骤操作选择支持代码生成的求解器金宝appand从STF浏览器中选择系统目标文件。选择系统目标文件时,其他模型配置参数会更改以满足执行环境的要求。例如:

  • 代码接口参数

  • 构建过程参数,例如工具链或模板makefile

  • 目标硬件参数,例如单词大小和字节订购

选择系统目标文件后,您可以修改模型配置参数设置。

您可以在单个工作流程中以不同的代码生成目的切换不同的系统目标文件(例如,快速原型制作与生产代码部署)。要切换,请为同一模型设置不同的配置集,并为当前操作切换活动配置集。有关如何设置配置集并更改活动配置集的更多信息,请参见Manage a Configuration Set(金宝appSimulink)。

选择支持代码生成的求解器金宝app

To build a model, the model configuration must specify a solver that is compatible with code generation for the system target file. Few system target files support code generation with variable-step solvers or for models with a nonzero start time.

  • 对于GRT,ERT和基于ERT的系统目标文件,设置Typeconfiguration parameter to固定步骤

  • 对于快速模拟(RSIM)或S功能(RTWSFCN)系统目标文件,请设置Typeconfiguration parameter to固定步骤orVariable-step

有关您使用固定步骤求解器为实时系统目标文件生成代码的更多信息,请参见Time-Based Scheduling and Code Generation(Embedded Coder).

快速模拟(RSIM)系统目标文件在金宝appSolver selectionconfiguration parameter is set to使用Si金宝appmulink求解器模块。Other system target files do not support a nonzero start time –– the code generator does not produce code and the build process produces an error.

从STF浏览器中选择系统目标文件

选择求解器后(请参阅选择支持代码生成的求解器金宝app), specify a value for the系统目标文件配置参数。直接在字段中输入系统目标文件的名称,或使用系统目标文件浏览器选择文件。

使用系统目标文件浏览器:

  1. 在“配置参数”对话框中,旁边系统目标文件字段,单击Browsebutton. The browser displays a list of available system target files, including customizations.

  2. From the list, select your file, for example, the GRT system target file (grt.tlc). The background of the list box turns yellow to indicate that the choice is not applied. Click申请orOK

    系统目标文件浏览器

You also can select a system target file programmatically from MATLAB®code, as described in以编程方式选择系统目标文件

选择系统目标文件后,您可以修改模型配置参数设置。为您的模型选择系统目标文件,选择“工具链”方法或模板makefile方法进行构建过程控制。有关这些方法的更多信息,请参阅Choose Build Approach and Configure Build Process

If you want to switch between different system target files in a single workflow for different code generation purposes, set up different configuration sets for the same model. Switch the active configuration set for the current operation. This approach is useful for switching between rapid prototyping and production code deployment. For more information on how to set up configuration sets and change the active configuration set, seeManage a Configuration Set(金宝appSimulink)。

以编程方式选择系统目标文件

金宝app®模型存储整个模型的参数和系统目标文件特定数据configuration sets。Every configuration set contains a component that defines the structure of a particular system target file and the current values of relevant options. Simulink loads some of this information from the system target file that you specify. You can configure models to generate alternative code by copying and modifying old or adding new configuration sets and browsing to select a new system target file. Then, you can interactively select an active configuration from among these sets (only one configuration set can be active at a given time).

自动化系统目标文件选择的脚本必须模仿此过程。

To program system target file selection:

  1. 获取带有调用的活动配置集的手柄getActiveConfigSet功能。

  2. 定义特征向量对应的变量to the required system target file, toolchain or template makefile, and/ormake命令设置。例如,对于ERT系统目标文件,您将定义字符向量的变量'ert.tlc',,,,'ert_default_tmf',,,,and'make_rtw'

  3. 选择系统的目标文件,并呼叫switchTarget功能。在函数调用中,为活动配置集和系统目标文件指定句柄。

  4. 设置TemplateMakefileandMakeCommandconfiguration parameters to the corresponding variables created in step 2.

例如:

cs = getActiveconfigset(model);stf ='ert.tlc';tmf ='ert_default_tmf';mc ='make_rtw';SwitchTarget(CS,STF,[]);set_param(cs,'templatemakefile',tmf);set_param(cs,'makecommand',mc);

有关以编程方式选择系统目标文件的更多信息,请参见switchTarget

开发自定义系统目标文件

您可以创建与外部代码或操作环境连接的系统目标文件。

有关如何使自定义系统目标文件显示在系统目标文件浏览器中并显示相关控件中的更多信息,请参见关于嵌入式目标发展and the topics it references.

也可以看看

|

Related Topics