C Data and Function Interfaces - MATLAB & Simulink (original) (raw)

Map model data elements and functions to model-independent code definitions

To comply with code standards and guidelines, integrate generated code with external code, and address memory requirements, configure the representation of model data elements and entry-point functions for code generation. You configure model data elements and functions by mapping them to code definitions that are predefined by the product or created with the Embedded Coder Dictionary. For data elements, you also have the option of mapping them to code definitions created in packages with the Custom Storage Class Designer.

For an introduction, see C Data Code Interface Configuration for Model Interface Elements.

Tools

Objects

Functions

expand all

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

Create and Find Code Mappings

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

Default Configurations

getDataDefault Get default storage class or storage class property setting for model data category (Since R2020b)
getFunctionDefault Get default function customization template or memory section for model functions category (Since R2020b)
setDataDefault Set default storage class and storage class property values for model data category (Since R2020b)
setFunctionDefault Set default function customization template and memory section for model functions category (Since R2020b)

Function Configuration

getFunction Get code configuration from code mappings for model function (Since R2020b)
setFunction Set coder mapping information for model function (Since R2020b)

Root-Level Inport and Outport Configuration

getInport Get code and calibration configuration from code mappings for root-level inport (Since R2020b)
getOutport Get code and calibration configuration from code mappings for root-level outport (Since R2020b)
getDeploymentType Get deployment type of model (Since R2022a)
setInport Configure root-level inports for code and calibration file (a2l) generation (Since R2020b)
setOutport Configure root-level outport for code and calibration file (a2l) generation (Since R2020b)
setDeploymentType Set deployment type of model (Since R2022a)

Parameter Configuration

getModelParameter Get code and calibration configuration from code mappings for model parameters (Since R2020b)
getModelVariantControl Get code configuration from code mappings forSimulink.VariantControl object (Since R2025a)
getModelVariantVariable Get code configuration from code mappings forSimulink.VariantVariable object (Since R2025a)
setModelParameter Configure model parameter for code and calibration file (a2l) generation (Since R2020b)
setModelVariantControl Configure Simulink.VariantControl object for code generation (Since R2025a)

Signal, State, and Data Store Configuration

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

Coder Dictionary Configuration

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

Topics

Configuration Fundamentals

C Data Configuration

C Function Configuration

Data Access and Initialization