In Simulink®, you can use the Code Mappings editor and the AUTOSAR Dictionary separately or together to graphically configure an AUTOSAR adaptive software component and map Simulink model elements to AUTOSAR component elements. For more information, see AUTOSAR Component Configuration.
Use the Code Mappings editor to map Simulink model elements to AUTOSAR component elements from a Simulink model perspective. The editor display consists of tabbed tables, including Inports and Outports. Use the tables to select Simulink elements and map them to corresponding AUTOSAR elements. The mappings that you configure are reflected in generated AUTOSAR-compliant C++ code and exported ARXML descriptions.
To map Simulink model elements to AUTOSAR adaptive software component elements:
Open a model for which AUTOSAR system target file
autosar_adaptive.tlc is selected.
Create or open a mapped view of the AUTOSAR model. In the model window, do one of the following:
From the Apps tab, open the AUTOSAR Component Designer app.
Click the perspective control in the lower-right corner and select Code.
If the model has not yet been mapped to an AUTOSAR software component, the AUTOSAR Component Quick Start opens. To configure the model for AUTOSAR component development, work through the quick-start procedure and click Finish. For more information, see Create Mapped AUTOSAR Component with Quick Start.
The model opens in the AUTOSAR code perspective. This perspective displays a help panel, a Property Inspector dialog box, and, directly under the model, the Code Mappings editor.
The Code Mappings editor provides in-canvas access to AUTOSAR mapping information, with batch editing, element filtering, easy navigation to model elements and AUTOSAR properties, and model element traceability.
Use the Code Mappings editor Inports and Outports tabs to map each Simulink inport or outport to an AUTOSAR required or provided port and a service interface event.
Use the Filter contents field (where available) to selectively display some elements, while omitting others, in the current view.
After mapping model elements, click the Validate button to validate the AUTOSAR component configuration. If errors are reported, address them and then retry validation.
The Inports and Outports tabs of the Code Mappings editor support modeling AUTOSAR service interface communication in Simulink. After using the AUTOSAR Dictionary to create AUTOSAR required and provided service ports, service interfaces, and service interface events in your model, open the Code Mappings editor. Use the Inports and Outports tabs to map Simulink root inports and outports to AUTOSAR required and provided service ports and AUTOSAR service interface events.
For more information, see Model AUTOSAR Adaptive Service Communication.
The Inports tab of the Code Mappings editor maps each Simulink root inport to an AUTOSAR required port and a service interface event. To map a Simulink inport, select the inport and then select menu values for an AUTOSAR port and an AUTOSAR event, among values listed for the component.
The Outports tab of the Code Mappings editor maps each Simulink root outport to an AUTOSAR provided port and a service interface event. In the Outports tab, you can:
Map a Simulink outport by selecting the outport and then selecting menu values for an AUTOSAR port and an AUTOSAR event, among values listed for the component.
Use the code attribute
AllocateMemory to configure
memory allocation for AUTOSAR adaptive service data. Specify whether to send
event data by reference (the default) or by
allocated memory. To send event data by
allocated memory, select the value
true. To send
event data by reference, select
false. For more
information, see Configure Memory Allocation for AUTOSAR Adaptive Service Data.