Main Content


Manage platform-specific properties for elements in interface dictionary mapped to AUTOSAR Classic Platform

Since R2022b


    The autosar.dictionary.ARClassicPlatformMapping object provides methods that help you manage the platform-specific properties in an interface dictionary mapped to the AUTOSAR Classic Platform.


    To create an autosar.dictionary.ARClassicPlatformMapping object, use the addPlatformMapping function.

    % after creating a Simulink.interface.dictionary object, dictAPI,
    % you can create a platformMapping object 
    platformMapping = dictAPI.addPlatformMapping('AUTOSARClassic');

    If you already have an interface dictionary mapped to the Classic Platform, you can represent an autosar.dictionary.ARClassicPlatformMapping object by using the getPlatformMapping function.

    platformMapping = dictAPI.getPlatformMapping('AUTOSARClassic');

    Object Functions

    exportDictionaryExport interface, data type, and platform-specific definitions from interface dictionary
    getPlatformPropertiesGet AUTOSAR platform properties from interface dictionary
    getPlatformPropertyGet AUTOSAR platform property from interface dictionary
    setPlatformPropertySet AUTOSAR properties for data interface or element in interface dictionary


    collapse all

    This example creates a Simulink.interface.dictionary object, configures the dictionary contents, and then adds platform-specific elements.

    Create interface dictionary.

    dictName = 'MyInterfaces.sldd';
    dictAPI = Simulink.interface.dictionary.create(dictName);

    Add data types, including an enumeration, an alias type, a value type, and a structure.

    % Enum Types
    myEnumType1 = addEnumType(dictAPI,'myColor');
    myEnumType1.addEnumeral('RED','0','Solid Red');
    myEnumType1.addEnumeral('BLUE','1','Solid Blue');
    myEnumType1.StorageType = 'int16';
    % set base type of an alias type to enum object
    myAliasType1 = addAliasType(dictAPI,'myAliasType1');
    myAliasType1.BaseType = myEnumType1;
    % ValueType
    myValueType1 = addValueType(dictAPI,'myValueType1');
    myValueType1.DataType = 'int32';
    myValueType1.Dimensions = '[2 3]';
    myValueType1.DataType = myEnumType1; % can also use interface dict type objs
    % StructType
    myStructType1 = addStructType(dictAPI,'myStructType1');
    structElement1 = myStructType1.addElement('Element1');
    structElement1.Type.DataType = 'single';
    structElement1.Type.Dimensions = '3';
    structElement2 = myStructType1.addElement('Element2');
    structElement2.Type = myValueType1;
    % or
    structElement2.Type = 'ValueType: myValueType1';

    Add data interfaces, and configure data elements.

    dataInterface1 = addDataInterface(dictAPI,'DataInterface');
    dataElm1 = addElement(dataInterface1,'DE1');
    dataElm1.Type = myValueType1;
    dataElm2 = addElement(dataInterface1,'DE2');
    dataElm2.Type = myStructType1;
    dataElm2.Dimensions = '4';
    dataElm2.Description = 'I am a data element with datatype = array of struct type';
    % data element with owned type
    dataElm3 = addElement(dataInterface1,'DE3');
    dataElm3.Type.DataType = 'single';
    dataElm3.Type.Dimensions = '10';
    dataElm3.Type.Minimum = '-5';
    dataInterface2 = addDataInterface(dictAPI,'DataInterface2');

    Add AUTOSAR Classic mapping.

    platformMapping = addPlatformMapping(dictAPI,'AUTOSARClassic');

    Configure interface properties for a classic component, including package path and nonvolatile data communication.

    setPlatformProperty(platformMapping, dataInterface1,...

    Get the platform properties.

    [pNames, pValues] = getPlatformProperties(platformMapping,dataInterface1);

    Add VAR1 software address method to the dictionary and set AUTOSAR platform-specific properties for data element DE1 in data interface DataInterface.

    arObj = autosar.api.getAUTOSARProperties(dictName);
    addPackageableElement(arObj,'SwAddrMethod', ... 
    setPlatformProperty(platformMapping,dataElm1, ...
        'SwAddrMethod','VAR1','SwCalibrationAccess', ... 

    Version History

    Introduced in R2022b