Main Content

C Service Interfaces

Map model elements and functions to service interfaces defined in an Embedded Coder Dictionary
Since R2022b

When generating code from a component model that uses a C service code interface configuration, you map model data elements to service interfaces. A service interface specifies function prototype information and a data communication method (direct access, outside execution, or during execution) for the generated code as required by the target platform services. The code generator applies constraints when producing service interface code so that it is easier to integrate the code for use in a specific target environment. The list of service interfaces available for mapping is determined by interfaces defined in the shared Embedded Coder Dictionary that is attached to the model. If dictionary default service interfaces align with your target platform service requirements, you need not make mapping changes and can skip to generating and reviewing the component interface code.

Tools

Code Mappings Editor – Service InterfaceAssociate model elements with code interface definitions

Objects

coder.mapping.api.CodeMappingModel data and function interface configuration for C code generation

Functions

expand all

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

Create and Find Code Mappings

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

Function Configuration

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

Root-Level Inport and Outport Configuration

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

Parameter Configuration

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

Signal, State, and Data Store Configuration

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

Data Transfer Configuration

getDataTransferGet code configuration from code mappings for signal representing data transfer
setDataTransferSet code configuration in code mappings for signal representing data transfer

Topics

Configuration Fundamentals

Callable Function Configuration

Service Interface Configuration

Data Access and Initialization

Related Information

Featured Examples