Main Content

target.ExternalMode Class

Namespace: target

Represent external mode protocol stack

Since R2021a

Description

Use the target.ExternalMode class, which is a subclass of target.CommunicationProtocolStack, to specify the external mode protocol stack for your target hardware.

To create a target.ExternalMode object, use the target.create function. Create the object and then use separate steps to specify properties. Or, using name-value arguments, create the object and specify properties in a single step.

Properties

expand all

Provide connectivity options for the external mode protocol stack. The array can contain only one target.ExternalModeConnectivity object for a specific transport protocol. For example, the array can contain one object for XCP on TCP/IP and another object for XCP on Serial.

Attributes:

GetAccess
public
SetAccess
public

Examples

collapse all

This code snippet from Customise Connectivity for XCP External Mode Simulations shows how to specify the external mode protocol stack for your target hardware.

xcpPlatformAbstraction = target.create('XCPPlatformAbstraction', ...
                'Name', 'XCP Platform Abstraction');

xcpPlatformAbstraction.BuildDependencies.Defines = {'XCP_CUSTOM_PLATFORM'};
customPlatformAbstractionPath = 'pathToImplementationFolder';
xcpPlatformAbstraction.BuildDependencies.SourceFiles = ...
                {fullfile(customPlatformAbstractionPath, 'myXCPPlatform.c')};
xcpPlatformAbstraction.BuildDependencies.IncludePaths = ...
                {customPlatformAbstractionPath};

xcpTransport = target.create('XCPTCPIPTransport', ...
                'Name', 'XCP Transport');

xcpConfiguration = target.create('XCP', ...
                'Name', 'XCP Configuration', ...
                'XCPTransport', xcpTransport, ...
                'XCPPlatformAbstraction', xcpPlatformAbstraction);

extModeTCPConnectivity = ... 
             target.create('XCPExternalModeConnectivity', ...                
             'Name', 'External Mode TCP Connectivity', ...
             'XCP', xcpConfiguration);

externalMode = target.create('ExternalMode', ...
                'Name', 'External Mode', ...
                'Connectivities', extModeTCPConnectivity);

board.CommunicationProtocolStacks = externalMode;

Note

You can create the target.ExternalMode object in a single step.

externalMode = target.create('ExternalMode', ...
          'Name', 'External Mode', ...
          'XCPTransportLayer', 'TCP', ...
          'Defines', {'XCP_CUSTOM_PLATFORM'}, ...
          'SourceFiles', {fullfile('pathToImplementationFolder', 'myXCPPlatform.c'}, ...
          'IncludePaths', {'pathToImplementationFolder'});

Version History

Introduced in R2021a