Generate AUTOSAR compliant C or C++ code and export ARXML descriptions for processors used in automotive systems
Use the AUTOSAR Component Designer app to generate C or C++ code and ARXML descriptions from an AUTOSAR component model. When you open the app, an AUTOSAR tab is added to the toolstrip. The AUTOSAR tab represents groups of tasks in the AUTOSAR Blockset workflow.
Use the app to perform these tasks:
If you are new to AUTOSAR Blockset, use the Embedded Coder® Quick Start to prepare your model for AUTOSAR code generation. The Quick Start chooses fundamental code generation settings based on your goals and application. Click Quick Start. For code generation output, select either C code compliant with AUTOSAR or C++ code compliant with AUTOSAR Adaptive Platform.
Set code generation objectives and prepare your model for code generation. Click C/C++ Code Advisor.
Configure model configuration parameters. Select Settings > C/C++ Code generation settings or Settings > Hardware Implementation.
Opening the AUTOSAR Component Designer app opens the AUTOSAR Code perspective, which contains the Code Mappings editor and the Property Inspector. Use the Code Mappings editor and the Property Inspector to map model entry-point functions, data, and other elements to AUTOSAR elements and properties that are defined in the AUTOSAR standard. Select Code Interface > Individual Element Code Mappings.
Configure AUTOSAR elements from an AUTOSAR component perspective by using the AUTOSAR Dictionary. Select Code Interface > AUTOSAR Dictionary or, from the Code Mappings editor, click . In the XML Options view, configure settings for ARXML export.
Generate AUTOSAR code and ARXML descriptions for testing or integration. Click Generate Code.
Open the Code view to view the generated code alongside your model. Click View Code. In the Code view, you can trace between model elements and the code by clicking hyperlinked lines of code. To remove traceability highlighting, click Remove Highlighting.
Open the latest HTML code generation report by clicking Open Report. To configure HTML report generation options, from the Open Report menu, select Report Options.
Create a protected model to share with a third party for simulation and code generation. Select Share > Generate Protected Model.
Package the model code and build artifacts in a ZIP file, for example, for relocation and integration. Select Share > Generate Code and Package. Optionally, you can modify the name of the generated ZIP file.
In the Apps gallery, under Code Generation, click AUTOSAR Component Designer. The AUTOSAR tab opens.
If you are working with a model hierarchy, open the AUTOSAR Component Designer app in the Simulink® Editor window for the top model of the hierarchy that you are generating code for. On the AUTOSAR tab, the functionalities apply to the top model of the hierarchy that is open in the editor.
To configure and view code for a referenced model, navigate to the model in the hierarchy and use the AUTOSAR Dictionary, Code Mappings editor, Property Inspector, and Code view. These views apply to the active model, which can be the top model or a referenced model.