Main Content

target.XCP class

Package: target

Describe XCP protocol stack for target hardware

Description

Use the target.XCP class to describe the XCP protocol stack for the target hardware.

To create a target.XCP 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

Specify the XCP transport protocol layer through a target.XCPTCPIPTransport or a target.XCPSerialTransport object.

Attributes:

GetAccess
public
SetAccess
public

Optional property to specify the XCP platform abstraction layer. If you do not specify a value, the software uses the default platform abstraction layer.

Attributes:

GetAccess
public
SetAccess
public

Examples

collapse all

This code snippet from Customise Connectivity for XCP External Mode Simulations shows how you can provide a description of the XCP 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);

Note

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

xcpConfiguration = target.create('XCP', ...
       'Name', 'XCP TCP/IP Configuration', ...
       'XCPTransportLayer', 'TCP', ...
       'Defines', {'XCP_CUSTOM_PLATFORM'}, ...
       'SourceFiles', {fullfile('pathToImplementationFolder', 'myXCPPlatform.c'}, ...
       'IncludePaths', {'pathToImplementationFolder'});

Introduced in R2021a