Main Content

coder.profile.StackDriver

Specify driver to obtain stack usage data from target hardware

Description

Specify a driver implementation that obtains stack usage data from the target hardware during processor-in-the-loop (PIL) execution

Creation

stackUsageDriver = coder.profile.StackDriver() returns an object. Specify the driver implementation by providing values for these properties:

  • ptrDataType

  • headerFile

  • SourceFile

  • IncludePaths

  • driverFunction

Properties

expand all

Data type of pointer that the driver function returns. If the target hardware is your development computer, use 'uint64'.

Example: stackUsageDriver.ptrDataType = 'uint64';

Data Types: char

Name of the header file that must be included in the compilation of the driver function.

Example: stackUsageDriver.headerFile = 'myHeaderFile.h';

Data Types: char

Name of the source file for the driver function.

Example: stackUsageDriver.SourceFile = 'mySourceFile.c';

Data Types: char

Paths to folders that must be included in the compilation of the driver function.

Example: stackUsageDriver.IncludePaths = {'path/To/myFolder1', ... 'path/To/myFolder2', ... 'path/To/myFolder3'};

Data Types: char

Name of the driver function.

Example: stackUsageDriver.driverFunction = 'myDriverFunction';

Data Types: char

Examples

Obtain Stack Usage Data From Target Hardware.

A PIL execution requires a driver implementation that obtains stack usage data from the target hardware.

When you set up PIL target connectivity, specify the driver through an rtw.connectivity.Config subclass. This code provides an example.

classdef overheadConnectivityConfig < rtw.connectivity.Config
  methods
    function this = customConnectivityConfig(componentArgs)
            
      % Create builder
      targetApplicationFramework = ...
        mypil.TargetApplicationFramework(componentArgs);
      builder = rtw.connectivity.MakefileBuilder(componentArgs, ...
        targetApplicationFramework, '');
            
      % Create launcher
      launcher = mypil.Launcher(componentArgs, builder);
            
      % Set up communication       
      hostCommunicator = rtw.connectivity.RtIOStreamHostCommunicator(...
                         componentArgs, ...
                         launcher, ...
                         rtiostreamLibTCPIP);     

      % Call super class constructor to register components
        this@rtw.connectivity.Config(componentArgs,...
                                     builder,...
                                     launcher,...
                                     hostCommunicator);
            
      % Specify driver implementation that obtains stack usage
      % data from the target hardware
      stackUsageDriver = coder.profile.StackDriver();

      stackUsageDriver.ptrDataType = 'uint64';
      stackUsageDriver.headerFile = 'myHeaderFile.h';
      stackUsageDriver.SourceFile = 'mySourceFile.c';
      stackUsageDriver.IncludePaths = {'path/To/myFolder1', ...
                                       'path/To/myFolder2', ...
                                       'path/To/myFolder3'};
      stackUsageDriver.driverFunction = 'myDriverFunction';
      this.setStackDriver(stackUsageDriver);
    end
  end
end

For more information about setting up PIL target connectivity, see:

Version History

Introduced in R2022a