Main Content

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

C 数据接口和函数接口

将模型数据元素和函数映射到独立于模型的代码定义

为了遵守代码标准和规范,将生成的代码与外部代码集成,并满足内存要求,需要针对代码生成配置模型数据元素和入口函数的表示。您可以将模型数据元素和函数映射到由产品预定义或使用 Embedded Coder 字典创建的代码定义。对于数据元素,您还可以选择将它们映射到使用 Custom Storage Class Designer 在包中创建的代码定义。

有关介绍,请参阅模型接口元素的 C 代码生成配置

工具

Code Mappings 编辑器 - CAssociate model elements with code interface definitions

对象

coder.mapping.api.CodeMappingModel data and function interface configuration for C code generation
coder.mapping.api.CoderDictionaryQuery and set the code settings of dictionary defaults in an Embedded Coder dictionary within a Simulink data dictionary

函数

全部展开

model_initializeGenerated C/C++ entry-point function that contains initialization code for a Simulink model
model_resetGenerated C/C++ entry-point function that contains reset code for a Simulink model
model_stepGenerated C/C++ entry-point function that contains execution code for each step in a Simulink model
model_terminateGenerated C/C++ entry-point function that contains termination code for a Simulink model

创建和查找代码映射

coder.mapping.api.getGet code mappings for model
coder.mapping.utils.createCreate code mappings object for configuring data and function interface for C and C++ code generation
findGet model elements for the category of model code mappings

默认配置

getDataDefaultGet default storage class or storage class property setting for model data category
getFunctionDefaultGet default function customization template or memory section for model functions category
setDataDefaultSet default storage class and storage class property values for model data category
setFunctionDefaultSet default function customization template and memory section for model functions category

函数配置

getFunctionGet code configuration from code mappings for model function
setFunctionSet code mapping information for model function

根级输入端口和输出端口配置

getInportGet code and calibration configuration from code mappings for root-level inport
getOutportGet code and calibration configuration from code mappings for root-level outport
getDeploymentTypeGet deployment type of model
setInportConfigure root-level inports for code and calibration file (a2l) generation
setOutportConfigure root-level outport for code and calibration file (a2l) generation
setDeploymentTypeSet deployment type of model

参数配置

getModelParameterGet code and calibration configuration from code mappings for model parameters
setModelParameterConfigure model parameter for code and calibration file (a2l) generation

信号、状态和数据存储配置

addSignalAdd block output signal to model code mappings
getDataStoreGet code and calibration configuration from code mappings for local or shared local data store
getSignalGet code and calibration configuration from code mappings for block output signal
getStateGet code and calibration configuration from code mappings for block state
removeSignalRemove block output signal from model code mappings
setDataStoreConfigure local or shared local data store for code and calibration file (a2l) generation
setSignalConfigure block signal data for code and calibration file (a2l) generation
setStateConfigure block states for code and calibration file (a2l) generation

编码器字典配置

setDataDefaultSet default code settings for data category
getDataDefaultGet default code settings for data category
setFunctionDefaultSet default function customization template and memory section for model functions category
getFunctionDefaultGet default function customization template or memory section for model functions category

主题

配置基础

C 数据配置

C 函数配置

数据访问和初始化

相关信息