Hauptinhalt

C Daten- und Funktionsschnittstellen

Zuordnen von Modelldaten-Elementen und -Funktionen zu modellunabhängigen Codedefinitionen

Konfigurieren Sie die Darstellung von Modelldatenelementen und Einstiegspunktfunktionen für die Codegenerierung, um Codestandards und -Richtlinien einzuhalten, generierten Code in externen Code zu integrieren und Speicheranforderungen zu erfüllen. Um Modelldatenelemente und -Funktionen zu konfigurieren, ordnen Sie diese den entsprechenden Codedefinitionen zu, die entweder vom Produkt vordefiniert sind oder sich über das Embedded Coder Dictionary erstellen lassen. Bei Datenelementen können Sie diese zudem optional den Codedefinitionen zuzuordnen, die mit dem Custom Storage Class Designer in Paketen erstellt wurden.

Eine Einführung finden Sie unter C Data Code Interface Configuration for Model Interface Elements.

Tools

Code Mappings Editor – CAssociate model elements with code interface definitions

Objekte

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

Funktionen

alle erweitern

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

Erstellen und Suchen von 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

Standardkonfigurationen

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

Funktionskonfiguration

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

Inport- und Outport-Konfiguration auf Rootebene

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 (Seit R2022a)
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 (Seit R2022a)

Parameterkonfiguration

getModelParameterGet code and calibration configuration from code mappings for model parameters
getModelVariantControlGet code configuration from code mappings for Simulink.VariantControl object (Seit R2025a)
getModelVariantVariableGet code configuration from code mappings for Simulink.VariantVariable object (Seit R2025a)
setModelParameterConfigure model parameter for code and calibration file (a2l) generation
setModelVariantControlConfigure Simulink.VariantControl object for code generation (Seit R2025a)

Signal-, Zustands- und Datastore-Konfiguration

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

Coder-Dictionary-Konfiguration

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

Themen

Grundlagen der Konfiguration

C Datenkonfiguration

C Funktionskonfiguration

Anpassen der generierten C Funktionen

Datenzugriff und Initialisierung

Verwandte Informationen

Enthaltene Beispiele