| Contents | Index |
Embedded Coder software supports AUTomotive Open System ARchitecture (AUTOSAR), an open and standardized automotive software architecture. Automobile manufacturers, suppliers, and tool developers jointly develop AUTOSAR.
The AUTOSAR standard addresses:
Architecture – Three layers, Application, Runtime Environment (RTE), and Basic Software, enable decoupling of AUTOSAR Software Components from the execution platform. Standard interfaces between AUTOSAR Software Components and the Runtime Environment allow reuse or relocation of components within the Electronic Control Unit (ECU) topology of a vehicle.
Methodology – Specification of code formats and description file templates, for example.
Application Interfaces – Specification of interfaces for typical automotive applications.
For more information, see:
www.autosar.org for details on the AUTOSAR standard.
Simulink Modeling Patterns for AUTOSAR to model AUTOSAR Software Components and related concepts in Simulink.
Workflow for AUTOSAR to use Embedded Coder software to generate code and description files that are compliant with AUTOSAR.
Technical Solution 1–DTNVZ to learn about the AUTOSAR Target Production Package. It offers advanced production capabilities for Simulink and Embedded Coder.
http://www.mathworks.com/automotive/standards/autosar.html to learn about using MathWorks products and third-party tools for AUTOSAR.
This section describes how you model AUTOSAR Software Components and related concepts in Simulink.
In AUTOSAR, application software consists of separate units, AUTOSAR Software Components.
Note An AUTOSAR Software Component is sometimes referred to as atomic because it is never split across more than one Electronic Control Unit (ECU). Do not confuse atomic in this context with the concept of Simulink atomic subsystems. |
The behavior of an AUTOSAR Software Component is implemented by a single or multiple runnable entities (runnables), which expose well-defined connection points, ports.
In Simulink, you can represent an AUTOSAR Software Component using a model or a subsystem. For example, the following figure shows modeling patterns for AUTOSAR Software Components (ASWC) labeled ASWC1, ASWC2, ASWC3, and ASWC4.

Runnables. AUTOSAR Software Components contain runnables that are directly or indirectly scheduled by the underlying AUTOSAR operating system.
The following figure shows an AUTOSAR Software Component with two runnables, Runnable 1 and Runnable 2. Each runnable is triggered by RTEEvents, events generated by the AUTOSAR Runtime Environment (RTE). For example, TimingEvent is an RTEEvent that is generated periodically.

The components ASWC1, ASWC2 and ASWC4 contain single runnables. These components are represented by a subsystem or a model, and can be single- or multirate. However, the software implements each component as a single-tasking operation.
Note The software generates an additional runnable for the initialization function regardless of the modeling pattern. |
ASWC2 is modeled as a single-rate, single-tasking atomic subsystem.

You can generate the ASWC2 runnable, which corresponds to the step function of the subsystem. Use the Configure AUTOSAR Interface dialog box to specify the names of the initial and periodic runnables, as shown by the following figure.

The software generates TimingEvents for the runnables. The TimingEvent period for the periodic runnable is the fundamental sample time of the model or atomic subsystem. Specify this sample time in the Subsystem Parameters dialog box, in the Sample time (-1 for inherited) field.
The component ASWC3 contains multiple runnables.

Use the Export Functions feature to map the runnables to Simulink function-call subsystems. See Configuring Multiple Runnables and Exporting AUTOSAR Software Component. The software also generates an initialization runnable for the initialization function.
Use the Configure AUTOSAR Interface dialog box to specify the names of the multiple runnables and the periods of TimingEvents.

Multiple Instantiation. AUTOSAR supports multiple instantiations of software components. However, Simulink supports multiple instantiations (reentrant code) only if a model is configured as a server operation. See Configuring a Server Operation.
To generate reentrant code for a model configured as a server operation, on the Code Generation > Interface pane, select the Generate reusable code check box.
AUTOSAR Software Components provide well-defined connection points, ports. There are two types of AUTOSAR ports:
Require
Provide
In addition, these AUTOSAR ports can reference two kinds of interfaces:
Sender-Receiver
Client-Server
The following figure shows an AUTOSAR Software Component with four ports representing all port and interface combinations.

Sender-Receiver Interface. A Sender-Receiver Interface consists of one or more data elements. Although a Require or Provide port may reference a Sender-Receiver Interface, the AUTOSAR Software Component does not necessarily access all the data elements. For example, consider the following figure.

The AUTOSAR Software Component has a Require and Provide port that references the same Sender-Receiver Interface, interface1. Although this interface contains data elements DE1, DE2, DE3, DE4, and DE5, the component does not utilize all the data elements.
The following figure is an example of how you model, in Simulink, an AUTOSAR Software Component that accesses data elements.

ASWC accesses data elements DE1 and DE2. You model data element access as follows:
For Require ports, use Simulink inports. For example, RPort1_DE1 and RPort1_DE2.
For Provide ports, use Simulink outports. For example, PPort1_DE1 and PPort1_DE2.
ErrorStatus is a value that the AUTOSAR Runtime Environment (RTE) returns to indicate errors that the communication system detects for each data element. You can use a Simulink inport to model error status, for example, RPort1_DE1 (ErrorStatus).
Use the Configure AUTOSAR Interface dialog box to specify the AUTOSAR settings for each inport and outport. The following figure shows settings for ASWC.

For example, the Data Access Mode for RPort1_DE1 is set to ImplicitReceive. For information on how you specify settings, see Using the Configure AUTOSAR Interface Dialog Box.
Client-Server Interface. A Client-Server Interface consists of one or more operation prototypes. An operation prototype contains one or more arguments of specific data types. A Client-Server Interface can be referenced by either a Require or Provide port.
The following figure shows an AUTOSAR Software Component with Require ports (RPort2 and NvM ) that reference Client-Server Interfaces (Interface2 and NvM).

Simulink provides the following modeling patterns for Client-Server Interfaces:
If you want to invoke a Basic Software interface with operations that have only one argument, for example, Client-Server Interface: NvM, use an inport or outport.
If you want to invoke Basic Software or application software interfaces that contain operations with any number of arguments, for example, Client-Server Interface: Interface2, use the Invoke AUTOSAR Server Operation block. See Configuring the Invoke AUTOSAR Server Operation Block
The following figure shows the use of the Invoke AUTOSAR Server Operation block in modeling an AUTOSAR Software Component in Simulink.

Use the Configure AUTOSAR Interface dialog box to specify the AUTOSAR settings for each inport and outport. See Using the Configure AUTOSAR Interface Dialog Box.
The following figure shows an AUTOSAR Software Component with a Provide port that references a Client-Server Interface.

In Simulink, you can model a single operation of an AUTOSAR Software Component that is referenced by a Client-Server Interface. Consider the following model.

Use the Configure AUTOSAR Interface dialog box to map the inports and outports to the arguments of the operation prototype. For example, the inports map to arguments upper, input, and lower.

For more information, see Configuring a Server Operation .
About Calibration Parameters. A calibration parameter is a value in an Electronic Control Unit (ECU). You tune or modify these parameters using a calibration data management tool or an offline calibration tool.
The AUTOSAR standard specifies the following types of calibration parameters:
Calibration parameters that belong to a calibration component, which can be accessed by all AUTOSAR Software Components.
You define calibration components using an AUTOSAR authoring tool.
Internal calibration parameters, which are defined and accessed by only one AUTOSAR Software Component.
The software supports import, export, and code generation for both types of calibration parameters.
Importing and Exporting Calibration Parameters. You can import calibration parameters into the MATLAB base workspace.
For example, to import parameters from an AUTOSAR calibration component description, use arxml.importer.createCalibrationComponentObjects.
To provide your Simulink model with access to these parameters, assign the imported parameters to block parameters.
For more information, see Importing an AUTOSAR Software Component.
You can specify the type of calibration parameter exported by configuring properties of the corresponding block parameter in the base workspace. See Configuring Calibration Parameters and rtwdemo_autosar_legacy_script.
In AUTOSAR, inter-runnable variables are used to communicate primitive type data between runnables in the same component. You define these variables in a Simulink model by the signal lines that connect subsystems (runnables). For example, in the following figure, irv1, irv2, irv3, and irv4 are inter-runnable variables.

You can specify the names and data access modes of the inter-runnable variables that you export. See Configuring Inter-Runnable Variables.
AUTOSAR specifies data types that apply to:
Data elements of a Sender-Receiver Interface
Operation arguments of a Client-Server Interface
Calibration parameters
Inter-runnable variables
The data types fall into two categories:
Primitive data types, which allow a direct mapping to C intrinsic types.
Composite data types, which map to C arrays and structures.
You can use Simulink data types to define AUTOSAR primitive types.
| AUTOSAR Data Type | Simulink Data Type |
|---|---|
| UInt4 | uint8 |
| SInt4 | int8 |
| UInt8 | uint8 |
| SInt8 | int8 |
| UInt16 | uint16 |
| SInt16 | int16 |
| UInt32 | uint32 |
| SInt32 | int32 |
| Float_with_NaN | single |
| Float | single |
| Double_with_NaN | double |
| Double | double |
| Boolean | boolean |
| Char8 | uint8 |
| Char16 | Not supported |
AUTOSAR composite data types are arrays and records, which are represented in Simulink by wide signals and bus objects, respectively. In the Inport or Outport Block Parameters dialog box, use the Signal Attributes pane to configure wide signals and bus objects.
The following figure shows how to specify a wide signal, which corresponds to an AUTOSAR composite array.

The following figure shows how to specify a bus object, which corresponds to an AUTOSAR composite record.

You can use the Data Type Assistant on the Signal Attributes pane of the Inport or Outport Block Parameters dialog box to specify the data types of data elements and arguments of an operation prototype. If you select Mode to be Built in, then you can specify the data type to be, for example, single or boolean. Alternatively, if you select Mode to be Expression, you can specify an (alias) expression for data type. As an example, the following figure shows an alias UInt4 in the Data type field.

Enumerated Data Types. AUTOSAR supports enumerated data types. For the import process, if there is a corresponding Simulink enumerated data type, then the software uses this data type. The software checks that the two data types are consistent. However, if there is no corresponding Simulink data type, then the software automatically creates the enumerated data type using the Simulink.defineIntEnumType class. This automatic creation of data types is useful when you want to import a large number of enumerated data types.
Consider the following example:
<SHORT-NAME>BasicColors</SHORT-NAME>
<COMPU-INTERNAL-TO-PHYS>
<COMPU-SCALES>
<COMPU-SCALE>
<LOWER-LIMIT>0</LOWER-LIMIT>
<UPPER-LIMIT>0</UPPER-LIMIT>
<COMPU-CONST>
<VT>Red</VT>
....The software creates an enumerated data type using:
Simulink.defineIntEnumType( 'BasicColors', ...
{'Red', 'Green', 'Blue'}, ...
[0;1;2], ...
'Description', 'Type definition of BasicColors.', ...
'HeaderFile', 'Rte_Type.h', ...
'AddClassNameToEnumNames', false);
Structure Parameters. Before exporting an AUTOSAR Software Component, MathWorks recommends that you specify the data types of structure parameters to be Simulink.Bus objects. See Structure Parameters and Generated Code in Simulink Coder documentation. Otherwise, the software displays the following behavior:
When you validate the AUTOSAR interface, the software issues a warning.
When you build the model, the software defines each data type to be an anonymous struct and generates a random, nondescriptive name for the data type.
When importing an AUTOSAR Software Component, if a parameter structure has a data type name that corresponds to an anonymous struct, the software sets the data type to struct. However, if the component has data elements that reference this anonymous struct data type, the software generates an error.
AUTOSAR supports per-instance memory, which allows you to specify instance-specific global memory within a software component. An AUTOSAR run-time environment generator allocates this memory and provides an API through which you access this memory.
In Simulink, you can model per-instance memory through the use of Data Store Memory and Data Store Read/Write blocks together with an AUTOSAR.Signal data object that specifies, for example, the PerInstanceMemory custom storage class.
AUTOSAR also allows you to use per-instance memory as a RAM mirror for data in non-volatile RAM (NVRAM), which enables you to access and use NVRAM in your AUTOSAR application.
Once an AUTOSAR.Signal data object specifies the PerInstanceMemory custom storage class, you can configure this per-instance memory to be a mirror block for a specific NVRAM block by setting the attribute needsNVRAMAccess to true.
For detailed information about how you model per-instance memory, see the demo rtwdemo_autosar_PIM_script. For an outline, see Using Data Store Memory Blocks to Specify Per-Instance Memory.
| Term | Notes |
|---|---|
| AUTOSAR Runtime Environment (RTE) |
|
| AUTOSAR Software Component |
|
| Characteristics | Values of characteristics can be changed on an ECU through a calibration data management tool or an offline calibration tool. |
| Client-Server Interface |
|
| Composite data types | Category of data types, such as one of the following:
|
| ComSpec | Defines specific communication attributes. |
| DataElementPrototype (data element) | Data value (signal) exchanged between a sender and a receiver. |
| Data types |
|
| ErrorStatus | Indicates errors detected by communication system. Runtime
Environment defines the following macros for sender-receiver communication:
|
| OperationPrototype (operation) |
|
| PortInterface |
|
| Primitive data types | Category of data types that allow a direct mapping to C intrinsic types. |
| Provide port (PPort) | Port providing data or service of a server. |
| Require port (RPort) | Port requiring data or service of a server. |
| RTEEvent | Event or situation that triggers execution of a runnable by
the Runtime Environment (RTE). The software supports the following
RTEEvents:
|
| Runnable entity (runnable) | Part of AUTOSAR Software-Component that can be executed and scheduled independently of other runnable entities (runnables). |
| Sender-Receiver Interface |
|
| Sender Receiver Annotation | Annotation of data elements in a port that implements Sender-Receiver Interface. |
| Sensor Actuator Software Component | AUTOSAR Software Component dedicated to the control of a sensor or actuator. |
| Service | Logical entity of Basic Software that offers functionality, which is used by various AUTOSAR Software Components. |
This section describes how you use Embedded Coder software to generate AUTOSAR-compliant code.
The following diagram shows a workflow that you can follow.

In this round-trip workflow, you perform the following tasks:
Import previously specified AUTOSAR Software Components, including definitions of calibration parameters, into Simulink. See Importing an AUTOSAR Software Component and Configuring Calibration Parameters.
Incorporate your Simulink design into the skeleton model or subsystem created by the import process.
Export, generating code and description files. This process involves configuring the AUTOSAR interface, validating this interface, and then building your Simulink models. See:
You can also verify your generated code in a simulation. See Verifying the AUTOSAR Code with SIL and PIL Simulations.
Merge generated code and description files with other systems using an AUTOSAR authoring tool. See demo rtwdemo_autosar_roundtrip_script.
You can use the authoring tool to export specifications, which can be imported back into Simulink.
Use the arxml.importer class to:
Parse an AUTOSAR Software Component description file produced, for example, by an authoring tool.
Import the software component into a Simulink model for configuration, code generation, and XML export
For a complete list of methods, see AUTOSAR in the Embedded Coder Function Reference documentation.
Use arxml.importer methods in the following order:
Call the constructor arxml.importer, for example, arxml.importer('mySoftwareComponentFile.arxml'), to create an importer object that looks for atomic software components in the specified XML file. In the Command Window, you see reports describing identified atomic software components. You can have multiple components. For example:
The file "mySoftwareComponentFile.arxml" contains:
1 Atomic-Software-Component-Type:
'/ComponentType/complex_type_component'
3 CalPrm-Component-Type:
'/ComponentType/MyCalibComp1'
'/ComponentType/MyCalibComp2'
'/ComponentType/MyCalibComp3'To change the main file and update the list of components, use arxml.importer.setFile.
Each software component requires an arxml.importer object. For each arxml.importer object, specify the file that contains the software component that you want.
Use arxml.importer.setDependencies if you need to specify additional dependent XML files containing the information that completes the software component description (for example, data types, interfaces). You can specify a cell array of files or a single file.
Complete specifying dependencies only for components that you intend to import into Simulink.
To import a parsed atomic software component into a Simulink model, call one of the following methods. If you have not specified all dependencies for the components, you will see errors.
arxml.importer.createComponentAsSubsystem — Creates and configures a Simulink subsystem skeleton corresponding to the specified atomic software component description.
arxml.importer.createComponentAsModel — Creates and configures a Simulink model skeleton corresponding to the specified atomic software component description.
For example:
importer_obj.createComponentAsModel('/ComponentType/complex_type_component')arxml.importer.createCalibrationComponentObjects — Creates Simulink calibration objects corresponding to the specified AUTOSAR calibration component description.
For example:
[success] = createCalibrationComponentObjects(importer_obj, 'CreateSimulinkObject', true)
See also the limitation, Cannot Import Internal Behavior.
After you import your software component into Simulink, you can modify the skeleton model or subsystem. For parameters from a calibration component, after importing the parameters into the MATLAB workspace, assign the calibration parameters to block parameters in your model.
To configure AUTOSAR code generation options and XML export options, see:
To see how to import, modify, and export AUTOSAR Software Components, view the demo Import and Export an AUTOSAR Software Component.
Configuring Ports for Basic Software and Error Status Receivers
Using Data Store Memory Blocks to Specify Per-Instance Memory
Use the Configure AUTOSAR Interface dialog box to configure your AUTOSAR code generation and XML import and export options. Alternatively, you can control all AUTOSAR options programmatically. See Configuring AUTOSAR Options Programmatically.
In any model using the autosar.tlc system target file, you can open the Configure AUTOSAR Interface dialog box by right-clicking a subsystem and selecting Code Generation > AUTOSAR Single or Multi-Runnable Component > Configure.
Single-Runnable menu options are enabled for only atomic or function-call subsystems.
Multi-Runnable menu options are enabled for only virtual subsystems.

To configure your AUTOSAR options:
If the Configure I/O for server operation check box is selected, clear it. Select this check box only when you want to configure your Simulink model as a server operation (see Configuring a Server Operation).
Specify Component type. From the drop-down list, select one of the following:
Application — For an AUTOSAR application software component
Sensor Actuator — For an AUTOSAR sensor/actuator software component.
The key difference between a sensor/actuator component and an application component is that a sensor/actuator component can access the I/O hardware abstraction part within the ECU abstraction layer.
Click Get Default Configuration to populate the controls for your model.
The runnable names, XML properties, and I/O configuration are initialized. If you click Get Default Configuration again later, only the I/O configurations are reset to default values.
Under Configure AUTOSAR Interface, use the controls to change your AUTOSAR code generation options and XML export options. For example, send and receive communication options such as port and interface names, data access modes, and initial and periodic runnable names.
On the Input/Output tab, designate inports and outports as data sender/receiver ports, error status receivers, or as access points to basic software.
To designate inports and outports as sender or receiver ports, set each port's Data Access Mode to one of the following:
Implicit (recommended). Data is buffered by the Run-Time Environment (RTE).
Explicit. Data is not buffered.
Under Properties, use the port interface settings to reflect your AUTOSAR port best practices. For example, some AUTOSAR users like to group related data into the same AUTOSAR port. You can achieve this arrangement by duplicating AUTOSAR port names. Alternatively, you can use the AUTOSAR port to group information individually. In this case, a common approach is to set all Data element settings to something neutral, for example, 'data', and leave the AUTOSAR port names as they are. You can also use the AUTOSAR Interface name for any best practices that you might have. For example, you can set up interfaces for individual AUTOSAR ports by ensuring that the interface names change when the AUTOSAR port name changes, for example, by prefixing the AUTOSAR interface of the corresponding AUTOSAR port name with an 'if_'.
Under Properties, specify Interface type, which sets the isService attribute of the port interface. From the drop-down list select one of the following:
Application software — When data is provided by AUTOSAR Software Component
Basic software — When data is provided by AUTOSAR Services
For more information on all these options, see AUTOSAR in the Embedded Coder Function Reference documentation.
You also use Data Access Mode to designate ports to access basic software or error status. See Configuring Ports for Basic Software and Error Status Receivers.
On the Runnables tab, specify the names of your initial and periodic runnables, for example, Runnable_Init and Runnable_Step.

On the XML Options tab, specify:
The form of your Exported XML file packaging. Select Modular (default) if you want to publish the XML descriptions as separate files. If you want to combine the XML descriptions, select Single file.
The names and package paths of the XML files that you publish when you generate code.

After configuring your options, click Validate, which calls runValidation. If there are problems, you see messages describing why the configuration is invalid. See also Modifying and Validating an Existing AUTOSAR Interface.
If validation succeeds, click OK to return to the Configuration Parameters dialog box.
Save your model and then generate code (Ctrl+B) to export your AUTOSAR component.
Configuring Single Runnables for DataReceivedEvents. The AUTOSAR Runtime Environment uses the event type DataReceivedEvent to trigger a runnable only when the value of a received data element is updated.
The software supports two data access modes that enable DataReceivedEvents to act as triggers, ExplicitReceive and QueuedExplicitReceive. The latter, in principle, allows the queuing of events. However, by default, the software restricts the queue length to one event only. If you want a different queue length, you must edit the generated XML file.
To create a runnable trigger with a DataReceivedEvent:
Under Configure AUTOSAR Interface, select the Input/Output tab.
If you want an input data signal to be a trigger (for example, Input) set Data Access Mode for the corresponding inport to ExplicitReceive or QueuedExplicitReceive.

Select the Runnables tab. To create a new trigger event, click Add Event. By default, from the Event Type drop-down list, the software selects DataReceivedEvent.

In the Event Name column, specify an event name.
In the Trigger Port column, from the drop-down list, select the Simulink port, for example, Input.
To create an additional trigger event, repeat steps 3 – 5. You can remove a trigger event by selecting the event row and clicking Delete Event.
To verify that you have configured the event triggers, click Validate.

Note If you define a DataReceivedEvent in a top-model or right-click build configuration, MathWorks recommends that you specify sample time independance for the model, that is, you set the Periodic sample time constraint on the Solver configuration parameters dialog pane to Ensure sample time independent. This action checks that the generated code can be executed at non-periodic rates, for example, asynchronously. However, if you know the execution context, for example, the data triggers periodically, then you do not have to specify sample time independence. |
You can configure ports to access AUTOSAR services and device drivers (AUTOSAR basic software), and to access communication error status in your model. You can configure ports programmatically or by using the AUTOSAR Model Interface dialog box. To open the dialog box, right-click a subsystem and select Code Generation > AUTOSAR Single or Multirunnable Component > Configure.
In the dialog box, you can specify the Data Access Mode of every port.
Designate inports and outports as access points to basic software.
If you select Basic Software, specify the service name, operation, and interface. The service name and operation must be valid AUTOSAR identifiers, and the service interface must be a valid path of the form AUTOSAR/Service/servicename.

After you export your AUTOSAR components, you must include your service interface definition XML file to import these components into an authoring tool.
Designate inports to receive error status.
If you select Error Status for an inport, you must select the other port (of mode Implicit or Explicit Receive) to listen for error status. Error status ports must use uint8 data type (or an alias).

Creating Configurable Subsystems from a Client-Server Interface
Simulating and Generating Code for Client-Server Communication
AUTOSAR allows client-server communication between:
Application software components
An application software component and Basic Software
An AUTOSAR Client-Server Interface defines the interaction between a software component that provides the interface and a software component that requires the interface. The component that provides the interface is the server. The component that requires the interface is the client.
In Simulink, you can:
Configure your model to implement a server operation. When you build your model, you generate AUTOSAR-compliant code and XML description files, including a client-server interface. See Configuring a Server Operation.
Configure a client port for your model using an Invoke AUTOSAR Server Operation block that references a client-server interface. When you build your model, you generate AUTOSAR-compliant code and XML description files for your client port. See Configuring the Invoke AUTOSAR Server Operation Block.
Once you create a client-server interface, you can generate a Simulink library of configurable, client-server subsystems that reference the:
Invoke AUTOSAR Server Operation block for code generation
Server operation model block for simulation
For information on how to generate this library, see Creating Configurable Subsystems from a Client-Server Interface
You can deploy the client-server subsystem in a Simulink model and, using the Mode Switch for Invoke AUTOSAR Server Operation, run the model in either a simulation or code-generation mode. See Simulating and Generating Code for Client-Server Communication.
For a demo on generating and using an AUTOSAR Client-Server Interface, see rtwdemo_autosar_clientserver_script.
Configuring a Server Operation. In the Configure AUTOSAR Interface dialog box, you can configure your Simulink model as a server operation. Then you can generate AUTOSAR-compliant code and XML files, including the client-server interface.
Select the Configure I/O for server operation check box. The Input/Output tab becomes the Server Operation tab.

Click Get Default Configuration to populate the controls for your model.
The runnable names, XML properties, and I/O configuration are initialized. If you click Get Default Configuration again later, only the I/O configurations are reset to default values.
On the Configure AUTOSAR Interface pane, use the controls to change your AUTOSAR code generation options and XML export options.
On the Server Operation tab, specify the following:
Server port name. Use a valid AUTOSAR short-name identifier.
Operation prototype . The names of the prototype and its arguments must be valid AUTOSAR short-name identifiers, for example, rtwdemo_autosar_server_operation(IN double upper, IN double input, IN double lower, OUT double output).
Interface name. The path reference of the client-server interface. Use a valid AUTOSAR short-name path, for example, csinterface.
Server type. From the drop-down list, select either Application software or Basic software.
On the Runnables tab, specify the names of your initial and periodic runnables, for example, Runnable_Init and Runnable_Step.

On the XML Options tab, specify:
The form of your Exported XML file packaging. Select Modular (default) if you want to publish the XML descriptions as separate files. If you want to combine the XML descriptions, select Single file.
The names and package paths of the XML files that you publish when you generate code.

After you configure your options, click Validate, which calls runValidation. If there are problems, you see messages describing why the configuration is invalid. See also Modifying and Validating an Existing AUTOSAR Interface.
If validation succeeds, click OK to return to the Configuration Parameters dialog box.
Save your model.
To generate AUTOSAR-compliant code and XML files, select Tools > Code Generation > Build Model.
Configuring the Invoke AUTOSAR Server Operation Block. You can use the Invoke AUTOSAR Server Operation block in your Simulink model to configure a client port (that accesses either application software or AUTOSAR Basic Software). You can then build the model to generate AUTOSAR-compliant code and XML files.
Drag an Invoke AUTOSAR Server Operation block into your model.

Double-click the block to open the Invoke AUTOSAR Server Operation dialog box. Specify the following:
Client port name. A valid AUTOSAR short-name identifier.
Operation prototype. The names of the prototype and its arguments must be valid AUTOSAR short-name identifiers, for example, rtwdemo_autosar_server_operation(IN double upper, IN double input, IN double lower, OUT double output).
Interface path. The path reference of the client-server interface. You must use a valid AUTOSAR short-name path, for example, /AUTOSAR/Interface.
Server type. From the drop-down list, select either Application software or Basic software.
Show error status. If you want the client port to receive the error status of client-server communication, select this check box.
Sample time. Set this parameter to -1 to inherit the sample time.
Click OK. Your Invoke AUTOSAR Server Operation block is updated.
Connect the updated Invoke AUTOSAR Server Operation block to your model.

Select Tools > Code Generation > Build Model. AUTOSAR-compliant code and XML files for the client port are generated.
Creating Configurable Subsystems from a Client-Server Interface. You can generate a Simulink library of configurable subsystems by applying the createOperationAsConfigurableSubsystems method to the arxml.importer object with the client-server interface. For example:
% Create an AUTOSAR importer object
obj = arxml.importer('rtwdemo_autosar_csinterface.arxml');
% Create the client-server operation configurable subsystem library
obj.createOperationAsConfigurableSubsystems('/PortInterface/csinterface', ...
'CreateSimulinkObject', false);
yield the following PortInterface_csinterface library.

Simulating and Generating Code for Client-Server Communication. Use the Template block from the client-server subsystem library to construct a model that can be run in either code-generation or simulation mode.
Drag the Template block from the subsystem library into your model window and connect it to other blocks.
Place the Mode Switch for Invoke AUTOSAR Server Operation in your model window.

To simulate the model:
Double-click the Mode Switch for AUTOSAR Server Operation to change the current mode from code generation to simulation.
Select Simulation > Start.
To generate code for the model:
Double-click the Mode Switch for AUTOSAR Server Operation to change the current mode from simulation to code generation.
Select Tools > Code Generation > Build Model.
You can use function-call subsystems within a wrapper subsystem to represent multiple runnables in a single AUTOSAR Software Component, and export each function-call subsystem as an AUTOSAR runnable.
If you group function-call subsystems within your wrapper subsystem into virtual subsystems, for example, to improve the graphical layout of your model, you can still export the function-call subsystems as AUTOSAR runnables. For information about virtual subsystems, see Creating Subsystems and Virtual Blocks in the Simulink documentation.
The software supports the following blocks within a wrapper subsystem:
Data Store
Display
DocBlock
From
Goto
Merge
Model Info
Scope
Signal Specification
The software also supports the use of Simulink library blocks when creating multiple runnables from subsystems. See Simulink Block Library Support for Multiple Runnables.
Use the Configure AUTOSAR Interface dialog box to specify an AUTOSAR interface for each function-call subsystem that you want to export as a runnable. To open this dialog box, right-click the top-level wrapper subsystem and select Code Generation > AUTOSAR Multi-Runnable Component > Configure. For information on how you configure multiple runnables, see:
See also the AUTOSAR Code Generation for Multiple Runnable Entities demo.
Configuring Inter-Runnable Variables. Inter-runnable variables communicate primitive type data between runnables in a component. You define these inter-runnable variables by the signal lines that connect subsystems. For an example, see Inter-Runnable Variables.
By default, the software assigns the signal name to the exported inter-runnable variable. If you want to edit the name, before generating code, double-click the signal name and enter a new name. However, you can specify a different name for the exported variable. In addition, you can specify the data access mode of the inter-runnable variable.
To configure an inter-runnable variable:
In the Configure AUTOSAR Interface dialog box, select the Inter-Runnable Variables tab. You see Simulink signals with (default) inter-runnable names and data access modes.

For each signal that you want to configure:
In the Inter-Runnable cell, specify your AUTOSAR name for the exported variable.
In the Data Access Mode cell, from the drop-down list, select either Explicit or Implicit (recommended).
Click OK.
When you select a signal, links appear under Source ports for signal .

Each link corresponds to an instance of the signal and is associated with a source port in the Simulink model. Click a link to go to the corresponding model signal. For example, clicking rtw.../ASWC/Runnable1/2 takes you to the following.

Specifying Execution Period. You may need to use blocks that depend on time for a software component with multiple runnables, for example, the Discrete-Time Integrator block. In this case, you can specify a timer for each AUTOSAR runnable. The timer increments at each execution of the runnable.
Use the Configure AUTOSAR Interface dialog box to specify the execution period:
Select the Runnables tab.
Under Runnable, select a runnable, for example, Runnable1.
In the Execution Period cell for the runnable's TimingEvent, enter the execution period.
Click OK.
Note The timer value in an AUTOSAR runnable is valid only if the runnable runs at a periodic rate that corresponds to the execution period that you specify. If the runnable runs at different rate, or does not begin executing at t = 0, then the timer value will be incorrect. |
The timer data type generated depends on the execution period and the application life span. To specify the application life span:
Select Configuration Parameters > Optimization.
In the Application lifespan (days) field, enter the required value.
Configuring Multiple Runnables for DataReceivedEvents. The AUTOSAR Runtime Environment uses the event type DataReceivedEvent to trigger runnables only when the value of a received data element is updated.
The software supports two data access modes that enable DataReceivedEvents to act as triggers, ExplicitReceive and QueuedExplicitReceive. The latter, in principle, allows the queuing of events. However, by default, the software restricts the queue length to one event only. If you want a different queue length, you must edit the generated XML file.
To create runnable triggers with DataReceivedEvents:
Under Configure AUTOSAR Interface, select the Input/Output tab.
If you want an input data signal to be a trigger, for example, RPort_DE1, from the corresponding Data Access Mode drop-down list, select either ExplicitReceive or QueuedExplicitReceive.

Select the Runnables tab. Under Runnable, select the runnable that you want to configure, for example, Runnable1.

Click Add Event to create a new trigger event. By default, from the Event Type drop-down list, the software selects DataReceivedEvent .
In the Event Name column, specify an event name.
In the Trigger Port column, from the drop-down list, select the Simulink port, for example, RPort_DE1.
To create an additional trigger event, for example, using NvM_ReadBlock, repeat steps 4 – 6. You can remove a trigger event by selecting the event row and clicking Delete Event.
To verify that you have configured the trigger events, click Validate.

Note If a runnable contains blocks that use absolute time, for example, a discrete-time integrator, then MathWorks recommends that you:
|
Simulink Block Library Support for Multiple Runnables. The software supports the use of Simulink library blocks when creating multiple runnables from subsystems. This support allows you to use:
A wrapper subsystem (containing function-call subsystems) that is a link to a library block
Function-call subsystems (within the wrapper subsystem) that are links to library blocks
Use the Configure AUTOSAR Interface dialog box to configure the linked subsystem. When you save the configured subsystem, the software saves the AUTOSAR configuration in the model file of the subsystem. The software does not store the AUTOSAR configuration of the subsystem as a parametrized link — see Modifying Linked Blocks.
For information about Simulink library blocks, see Working with Block Libraries in the Simulink documentation.
As an example, consider the demo model rtwdemo_autosar_multirunnables where the wrapper subsystem ASWC is replaced by MRB_instance, a link to a block from my_autosar_lib.

You can go to the block library by selecting MRB_instance and typing Ctrl+L.

You can specify the type of calibration parameter that you export by configuring properties of the corresponding block parameter in the base workspace.
For example, to configure an internal calibration parameter for your AUTOSAR model:
Create an AUTOSAR.Parameter object.
Open the Model Explorer (Ctrl+H).
In the Model Heirarchy view, under Simulink Root, select Base Workspace.
Select Add > Add Custom. The Model Explorer – Select Object dialog box opens.
Specify a value in the Object Name(s) field, for example, myPrm.
From the Object class drop-down list, select AUTOSAR.Parameter.
Click OK. A new object myPrm appears in the base workspace.
In the Contents pane, select the object, for example, myPrm.
Using the Dialog pane, configure the following properties of this data object:
Value — Specify a value for the calibration parameter. For an internal calibration parameter, this value represents the initial value.
Data type. For information about a creating data type, for example, a bus object data type, see Using the Data Type Assistant in the Simulink documentation.
Storage class — To specify an internal calibration parameter, from the drop-down list, select InternalCalPrm. You must then specify Per instance behavior. Select one of the following:
Parameter shared by all instances of the Software Component
Each instance of the Software Component has its own copy of the parameter
For information about the Dialog pane, see The Model Explorer: Dialog Pane in the Simulink documentation.
In the Block Parameters dialog box, assign the data object to your model, for example:

Before you generate code, you must:
Select Configuration Parameters > Optimization > Signals and Parameters > Inline parameters.
Clear Configuration Parameters > Code Generation > Ignore custom storage classes.
Specifying these parameters allows the software to export the calibration parameters. See Generating Code with Custom Storage Classes.
For calibration component parameters, after you export your AUTOSAR components, you must include your calibration interface definition XML file to import the parameters into an authoring tool.
You can model per-instance memory through the use of Data Store Memory blocks together with an AUTOSAR.Signal data object. For a detailed example, see the rtwdemo_autosar_PIM_script demo. The following is an outline of the required steps:
In the base workspace, create an AUTOSAR.Signal object.
Set the storage class of this object to PerInstanceMemory.
If required, set needsNVRAMAccess property to true.
Create a Data Store Memory block that references the AUTOSAR.Signal object. See Data Store Memory in the Simulink Reference documentation.
When you build your model, the XML files that are generated define an exclusive area for each Data Store Memory block that references per-instance memory. Every runnable that accesses per-instance memory runs inside the corresponding exclusive area. If multiple AUTOSAR runnables have access to the same Data Store Memory block, the exported AUTOSAR specification enforces data consistency by using an AUTOSAR exclusive area. With this specification, the runnables have mutually exclusive access to the per-instance memory global data, which prevents data corruption.
If you set needsNVRAMAccess to true, then a SERVICE-NEEDS entry (schema version 3.0) or NVRAM-MAPPINGS entry (schema version 2.1) is declared in XML files to indicate that the per-instance memory is a RAM mirror block and must be serviced by the NvM manager module.
Creating an AUTOSAR.Signal Object. To create an AUTOSAR.Signal object in the base workspace:
Open the Model Explorer (Ctrl+H).
In the Model Heirarchy view, under Simulink Root, select Base Workspace.
Select Add > Add Custom. The Model Explorer – Select Object dialog box opens.
Specify a value in the Object Name(s) field, for example, nvmImplicitRW.
From the Object class drop-down list, select AUTOSAR.Signal.
Click OK. A new object nvmImplicitRW appears in the base workspace.
You can validate your AUTOSAR interface using the Configure AUTOSAR Interface dialog box. See Using the Configure AUTOSAR Interface Dialog Box. The following steps show how you can modify and validate your AUTOSAR interface programmatically:
Get the handle to an existing model-specific RTW.AutosarInterface object that is attached to your loaded Simulink model. Enter:
obj = RTW.getFunctionSpecification(modelName)
modelName is a string specifying the name of a loaded Simulink model, and obj returns a handle to an RTW.AutosarInterface object attached to the specified model.
Test the AUTOSAR interface object. Enter:
isa(obj,'RTW.AutosarInterface')
This test must return 1. If the model does not have an AUTOSAR interface object, the function returns [].
To view and change items, use the AUTOSAR get and set functions listed in AUTOSAR in the Embedded Coder Function Reference documentation.
Validate the function prototype using RTW.AutosarInterface.runValidation.
If validation succeeds, save your model and then generate code.
The default AUTOSAR schema version is 3.1. If you need to change the schema version, you must do so before exporting your AUTOSAR Software Component. Embedded Coder supports the following AUTOSAR schema versions:
3.2 (3.2.1)
3.1 (3.1.4)
3.0 (3.0.2)
2.0 (XSD build 49632)
2.1 (XSD rev 0017)
To select a schema version:
Open the Configuration Parameters dialog box. In any model that uses the autosar.tlc system target file, AUTOSAR Code Generation Options appears in the tree.
Click AUTOSAR Code Generation Options to open the AUTOSAR Code Generation Options pane.
From the Generate XML file for schema version drop-down list, select the schema version that you require.
The AUTOSAR standard specifies that SHORT-NAME XML elements must not be greater than 32 characters in length. However, your authoring tool may support the use of longer elements, for example, to name ports and interfaces. The software allows you to specify the maximum length of your SHORT-NAME elements.
Before you build your model, on the Code Generation > AUTOSAR Code Generation Optionspane, in the Maximum SHORT-NAME length field, specify the maximum length of your SHORT-NAME elements. You may specify a maximum length of up to 128 characters. The default is 32 characters.
Compilers for 16-bit platforms (for example, Cosmic and Metrowerks for S12X or Tasking for ST10) use special keywords to deal with the limited 16-bit addressing range. The location of data and code beyond the 64 k border is selected explicitly by special keywords. However, if such keywords are used directly within the source code, then software must be ported separately for each microcontroller family, that is, the software is not platform-independent.
AUTOSAR specifies C macros to abstract compiler directives (near/far memory calls) in a platform-independent manner. These compiler directives, derived from the 16-bit platforms, enable better code efficiencies for 16-bit micro-controllers without separate porting of source code for each compiler. This approach allows your system integrator, rather than your software component implementer, to choose the location of data and code for each software component.
For more information on AUTOSAR compiler abstraction, see www.autosar.org
Configuring AUTOSAR Compiler Macro Generation. Before you build your model, on the Simulink Coder AUTOSAR Code Generation Options pane, select the Use AUTOSAR compiler abstraction macros check box.
When you build the model, the software applies compiler abstraction macros to global data and function definitions in the generated code.
For data, the macros are in the following form:
CONST(consttype, memclass) varname;
VAR(type, memclass) varname;
where
consttype and type are data types
memclass is a macro string SWC_VAR (SWC is the software component identifier)
varname is the variable identifier
For functions (model and subsystem), the macros are in the following form:
FUNC(type, memclass) funcname(void)
where
type is the data type of the return argument
memclass is a macro string. This string can be either SWC_CODE for runnables (external functions), or SWC_CODE_LOCAL for internal functions (SWC is the software component identifier).
Example
If you do not select the Use AUTOSAR compiler abstraction macros check box, the software generates the following code:
/* Block signals (auto storage) */ BlockIO rtB; /* Block states (auto storage) */ D_Work rtDWork; /* Model step function */ void Runnable_Step(void)
However, if you select the Use AUTOSAR compiler abstraction macros check box, the software generates macros in the code:
/* Block signals (auto storage) */ VAR(BlockIO, SWC1_VAR) rtB; /* Block states (auto storage) */ VAR(D_Work, SWC1_VAR) rtDWork; /* Model step function */ FUNC(void, SWC1_CODE) Runnable_Step(void)
The software supports matrix I/O at the root-level by generating code that implements matrices as one-dimensional arrays. However, this behavior is not the default. Before you build your model, on the AUTOSAR Code Generation Options pane, select the Support root-level matrix I/O using one-dimensional arrays check box.
After configuring your AUTOSAR export options, generate code to export your AUTOSAR Software Component.
To generate code and XML files:
For a single runnable from a top model, build the model (Ctrl+B).
For multiple runnables from subsystems:
Right-click the top-level subsystem.
Select Code Generation > AUTOSAR Multi-Runnable Component > Export Functions. The Build Code for Subsystem dialog box opens.
Click Build.
This command builds code for an AUTOSAR runnable for each subsystem. The build also creates an additional runnable to aggregate the initialization functions for each of the function-call subsystems.
The software component C code and the following XML files are exported to the build folder.
| When Configure AUTOSAR Interface > XML Options > Exported XML file packaging is set to ... | File Name | Description |
|---|---|---|
Modular | modelname _behavior.arxml | Specifies the software component internal behavior |
modelname _implementation.arxml | Specifies the software component implementation | |
modelname _interface.arxml | Specifies the software component interfaces, including extra interfaces | |
modelname _component.arxml | Specifies the software component type, including additional ports added to the Simulink model | |
modelname _datatype.arxml | Specifies the software component data types, including any modified or additional data types | |
Single file | modelname.arxml | Contains all specifications |
Note In addition to the AUTOSAR software component C code, Embedded Coder creates the following header files in the stub subfolder of the build folder:
These files contain dummy implementations of AUTOSAR functions, which the software uses for SIL and PIL simulations. You must not use these files outside Simulink. Your AUTOSAR RTE generator should produce the equivalent files. |
You can merge the software component information back into an AUTOSAR authoring tool. This software component information is partitioned into separate files to facilitate merging. The partitioning attempts to minimize the number of merges that you must do. You do not need to merge the data type file into the authoring tool because data types are usually defined early in the design process. You must, however, merge the internal behavior file because this information is part of the model implementation.
For examples of how to generate AUTOSAR-compliant code and export AUTOSAR Software Component description XML files from a Simulink model, see the following demos.
To control AUTOSAR options programmatically, use the AUTOSAR functions listed in the following tables in the Embedded Coder Function Reference documentation.
You can carry out model-based verification of AUTOSAR software components using software-in-the-loop (SIL) and processor-in-the-loop (PIL) simulations. Use SIL for verification of generated source code on your host computer, and PIL for verification of object code on your production target.
You can run a top model or Model block that is configured for the AUTOSAR target (autosar.tlc) using the Software-in-the-Loop (SIL) and Processor-in-the-Loop (PIL) simulation modes.
For more information, see Top-Model SIL or PIL Simulation and Model Block SIL or PIL Simulation.
AUTOSAR Top Model SIL and PIL Support. For a top model running in SIL or PIL simulation mode, the software does not support the following AUTOSAR features:
AUTOSAR calibration parameters
Client-server operations
Logging Invariant Output Signals.
Through signal logging, you can configure your top model to log invariant output signals. However, the software will log these invariant signals as periodically sampled data.
AUTOSAR Model Block SIL and PIL Support. The software supports testing of AUTOSAR components that are modeled as model reference components. These model reference components are implemented as standard model reference Simulink Coder targets and do not contain any special AUTOSAR behavior.
To verify source code, you create a SIL block, which wraps the generated code in an S-function. The AUTOSAR target automatically configures the generated S-function to route simulation data using AUTOSAR run-time environment (RTE) API calls.
To verify the behavior of production-intent object code, you create a PIL block. You must provide an implementation of the target connectivity API for this block.
To carry out a verification using a SIL or PIL block:
In the Configuration Parameters dialog box, select Code Generation, and clear the check box Generate code only. If you select Generate code only, the software does not create a SIL or PIL block.
Select Code Generation > SIL and PIL Verification.
From the Create block drop-down list, select either SIL or PIL. Click OK.
To create your SIL or PIL block, generate code in the usual way. See Exporting AUTOSAR Software Component and Configuring Multiple Runnables.
Once the SIL or PIL block is built, replace the existing component in your model with the new block.
Simulate the model and check the output to verify that the code produces the same data as the original subsystem.
Note The software does not propagate non-zero outport initialization inside an AUTOSAR model to the outports (via the RTE) until the step function executes. When you run the generated code in a SIL simulation, you do not see the outport initialization until the SIL wrapper executes the step function for the first time. |
For more information about configuring and running simulations with SIL or PIL blocks, see Using a SIL or PIL Block.
AUTOSAR SIL and PIL Block Support. The following features are not supported:
AUTOSAR calibration parameters
Server operations
Runnable with Stateflow Chart Using Absolute Time.
Consider a runnable (function-call subsystem) in a model, which contains a Stateflow chart using absolute-time temporal logic. Replace the runnable with a SIL block and run a simulation with the model. If the SIL block is executed conditionally in the model, then the results of the SIL simulation differ from the results of the Normal mode simulation.
Runnables in Feedback Loops.If your model has function-call subsystems and you export a runnable that has context-dependent inputs (for example, feedback signals), then the results of a SIL/PIL simulation with the generated code may not match the results of the Normal mode simulation of your model. See Exported Functions in Feedback Loops.
Cannot Copy Subsystem Blocks Without Losing Interface Information
Source of Initial Output Value for Function-Call Subsystem Outport
Internal behavior is not parsed. This means any I/O information stored at the runnable level (for example, implicit or explicit) is not imported, and all internal I/O settings default to implicit. You can subsequently configure these I/O ports with the setIODataAccessMode method or in the Configure AUTOSAR Interface dialog box.
If you copy and paste a subsystem block to create a new block in either a new model or the same model, the software does not copy the AUTOSAR interface information stored with the original subsystem block to the new subsystem block.
Before exporting a runnable from a function-call subsystem with an outport, you must set the Outport block parameter SourceOfInitialOutputValue to Dialog. Otherwise, when you try to export the runnable, the software generates an error indicating this requirement. See Outport in the Simulink Reference.
If you do not configure your model using the Get Default Configuration button or the RTW.AutosarInterface.getDefaultConf method, when you build the model the software produces an error message indicating this.
If you do not select the Generate code only check box, the software produces an error message when you build the model. The message states that you can build an executable with the AUTOSAR target only if you:
Configure the model to create a software-in-the-loop (SIL) or processor-in-the-loop (PIL) block
Run the model in SIL or PIL simulation mode
Provide a custom template makefile
For a server operation model, MathWorks recommends that you set the Periodic sample time constraint on the Solver configuration parameters dialog pane to Ensure sample time independent. With this parameter, you can specify the sample time of the client model that invokes the server model (through an Invoke AUTOSAR Server Operation block) independently of the server model. If you do not specify this parameter, you need to check that the client block calls the server block at the same sample time. Otherwise, the data returned from the server model may be invalid.
The software does not support the use of the Invoke AUTOSAR Server Operation block in a referenced model.
If you try to save an arxml.importer object in a MAT-file, you lose all the information. If you reload the MAT-file, then the object is null (handle = –1), because of the Java™ objects that compose the arxml.importer object.
You can use the Merge block to merge inter-runnable variables. However, you must do the following:
Connect the output signal of the Merge block to either one root outport or one or more subsystems.
If the output signal of the Merge block is connected to the inputs of one or more subsystems, assign the same signal name to the Merge block's output and inputs.
In addition, the signal from the function-call subsystem outport that enters a Merge block must not be conditionally computed. Consider the following example.

The output from the subsystem F_condition is the conditional output from Enabled Subsystem. When you try to validate or build the model, the software generates an error.
If you use an S-Function block instead of the Enabled Subsystem block, the software generates a warning when you validate or build the model.
If your wrapper subsystem contains Goto and From blocks, you can generate code and XML files for multiple runnables. However, you must:
Set the scope of the Goto block tag to local.
Label, unambiguously, signals entering and leaving Goto and From blocks that connect subsystems. If the signal into the Goto block and the signal out of the corresponding From block connect two subsystems (runnables), then these signal segments represent an inter-runnable variable. You must provide a label for at least one signal segment, for example, the signal into the Goto block. In addition, if there are labels for other segments of the same signal, you must check that these labels are the same.
The software does not generate AUTOSAR compiler abstraction macros for data or functions arising from the following:
Model blocks
Stateflow
MATLAB Coder
Shared utility functions
Custom storage classes
Local or temporary variables
The software does not support operation prototype arguments with intrinsic fixed-point data types. For example, ufix5 shown in the following figure.

The software produces an error when you build the model.
To work around this limitation, before building the model, create a Simulink.NumericType base workspace object with the required property values. For example, to create a Simulink.NumericType object ufix5, enter the following in the Command Window:
>> ufix5 = Simulink.NumericType; >> ufix5.DataTypeMode = 'Fixed-point: binary point scaling'; >> ufix5.Signedness = 'Signed' >> ufix5.WordLength = 16 >> ufix5.FractionLength = 0 >> ufix5.IsAlias = 1; >> ufix.HeaderFile = 'Rte_Type.h'
For more information, see Simulink.NumericType in the Simulink documentation.
The software does not provide AUTOSAR support for a model that is configured as a server operation and has tunable parameters with storage class set to SimulinkGlobal (Auto).
Use the autosar_adk_migrate function to migrate an AUTOSAR Development Kit (ADK) model (from releases before R2008a) to the AUTOSAR interface.
Enter:
autosar_adk_migrate(PATHNAME)
to migrate the ADK model/system specified by the full path name PATHNAME from the ADK settings to the new AUTOSAR interface. The model must be open before you invoke this function. MathWorks recommends that you save the migrated model to a different file name.
For detailed explanations of AUTOSAR workflows with Embedded Coder software, see the demos in the following table.
| Demo | How to ... |
|---|---|
| AUTOSAR Code Generation: rtwdemo_autosar_legacy_script | Generate AUTOSAR-compliant code and export AUTOSAR Software Component description XML files from a Simulink model |
| Using an AUTOSAR Client-Server Interface rtwdemo_autosar_clientserver_script | Configure and generate AUTOSAR-compliant code and export AUTOSAR-compliant XML files for a Simulink model with an AUTOSAR client-server interface |
| AUTOSAR Code Generation for Multiple Runnable Entities: rtwdemo_autosar_multirunnables_script | Configure and generate AUTOSAR-compliant code and export AUTOSAR Software Component description XML files for a Simulink model with multiple runnables. |
| Import and Export an AUTOSAR Software Component: rtwdemo_autosar_roundtrip_script | Use an AUTOSAR authoring tool with Simulink to develop AUTOSAR Software Components. Learn how to import software component interfaces into Simulink, modify and export them, and merge the completed software component back into an AUTOSAR authoring tool. |
| Using Data Stores to Access Per-Instance Memory: rtwdemo_autosar_PIM_script | Publish an AUTOSAR Software Component with per-instance memory |
For more information, see the AUTOSAR Web site: http://www.autosar.org/
![]() | Generating Code Modules | Generating Reentrant Code from MATLAB Code | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |