Main Content

本页的翻译已过时。点击此处可查看最新英文版本。

数据和函数配置

为数据和函数配置代码生成,以便于软件集成

要为快速原型生成代码,请为代码生成配置模型数据元素的表示。您可以通过将模型数据元素映射到产品预定义的代码定义(存储类)来对其进行配置。

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

对象

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
setDataDefaultSet default storage class and storage class property values for model data category

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

getInportGet code and calibration configuration from code mappings for root-level inport
getOutportGet code and calibration configuration from code mappings for root-level outport
setInportConfigure root-level inports for code and calibration file (a2l) generation
setOutportConfigure root-level outport for code and calibration file (a2l) generation

参数配置

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

编码器字典配置

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

工具

Code Mappings 编辑器Associate model elements with code definitions

主题

配置基础

模型接口元素的 C 代码生成配置

控制生成的 C 代码中模型数据元素的表示。

Code Definition and Mapping Limitations and Considerations

Restrictions, constraints, and considerations that apply to code definitions and code mappings.

Manage Multiple Code Mappings for a Model

Design models that are platform-neutral and ready to deploy to different run-time environments.

Migration of Model Data Configurations to Code Mappings

How Simulink® migrates code definitions for models created before release R2020b to code mappings and related information to consider.

数据配置

Choose Data Configuration Approach

Make decisions about the design data used by your model based on your code generation requirements.

Configure Root-Level Inport Blocks for C Code Generation

Set the storage class and other relevant code generation properties for root-level Inport blocks.

Configure Root-Level Outport Blocks for C Code Generation

Set the storage class and other relevant code generation properties for root-level Outport blocks.

Configure Signal Data for C Code Generation

Set the storage class and other relevant code generation properties for signal data.

Configure Parameters for C Code Generation

Set the storage class and other relevant code generation properties for parameters.

Configure Block States for C Code Generation

Set the storage class and other relevant code generation properties for block states.

Configure Data Stores for C Code Generation

Set the storage class and other relevant code generation properties for data stores.

Choose Storage Class for Controlling Data Representation in Generated Code

Choose a storage class to apply to data elements in a model, such as signals, states, and block parameters.

函数配置

为模型入口函数配置 C 代码生成

了解生成的 C 入口函数、配置选项以及如何与它们对接。

Control Data and Function Interface in Generated Code

Control how generated code exchanges data with a calling environment.

Rapid Prototyping Model Functions

Generate rapid prototyping code.

从顶层模型生成可重入代码

从顶层模型生成可重用的可重入代码。

特色示例