Main Content

Data and Function Configuration

Configure code generation for data and functions to facilitate software integration

To generate code for rapid prototyping, configure the representation of model data elements for code generation. You configure model data elements by mapping them to code definitions (storage classes) that are predefined by the product.

介绍,请参阅C Code Generation Configuration for Model Interface Elements.

Objects

coder.mapping.api.CodeMapping Model data and function interface configuration for C code generation
coder.mapping.api.CoderDictionary Query and set the code settings of dictionary defaults in anEmbedded Coderdictionary within a金宝appdata dictionary

Functions

expand all

model_initialize Generated C/C++ entry-point function that contains initialization code for a金宝appmodel
model_reset Generated C/C++ entry-point function that contains reset code for a金宝appmodel
model_step Generated C/C++ entry-point function that contains execution code for each step in a金宝appmodel
model_terminate Generated C/C++ entry-point function that contains termination code for a金宝appmodel

Create and Find Code Mappings

coder.mapping.api.get Get code mappings for model
coder.mapping.utils.create Create code mappings object for configuring data and function interface for C and C++ code generation
find Get model elements for the category of model code mappings

Default Configurations

getDataDefault Get default storage class or storage class property setting for model data category
setDataDefault Set default storage class and storage class property values for model data category

Root-Level Inport and Outport Configuration

getInport Get code and calibration configuration from code mappings for root-level inport
getOutport Get code and calibration configuration from code mappings for root-level outport
setInport Configure root-level inports for code and calibration file (a2l) generation
setOutport Configure root-level outport for code and calibration file (a2l) generation

Parameter Configuration

getModelParameter Get code and calibration configuration from code mappings for model parameters
setModelParameter Configure model parameter for code and calibration file (a2l) generation

Signal, State, and Data Store Configuration

addSignal Add block output signal to model code mappings
getDataStore Get code and calibration configuration from code mappings for local or shared local data store
getSignal Get code and calibration configuration from code mappings for block output signal
getState Get code and calibration configuration from code mappings for block state
removeSignal 删除block output signal from model code mappings
setDataStore Configure local or shared local data store for code and calibration file (a2l) generation
setSignal Configure block signal data for code and calibration file (a2l) generation
setState Configure block states for code and calibration file (a2l) generation

Coder Dictionary Configuration

getDataDefault Get default code settings for data category
setDataDefault Set default code settings for data category
getFunctionDefault Get default function customization template or memory section for model functions category
setFunctionDefault Set default function customization template and memory section for model functions category

Tools

Code Mappings Editor 把模型元素与代码定义

Topics

Configuration Fundamentals

C Code Generation Configuration for Model Interface Elements

Control the representation of model data elementsand functionsin generated C code.

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.

Data Configuration

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-levelInportblocks.

Configure Root-Level Outport Blocks for C Code Generation

Set the storage class and other relevant code generation properties for root-levelOutportblocks.

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.

Function Configuration

Configure C Code Generation for Model Entry-Point Functions

Learn about generated C entry-point functions, configuration options, and how to interface with them.

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.

Generate Reentrant Code from Top Models

Generate reusable, reentrant code from top models.

Featured Examples