Embedded Coder - Generate readable, compact, and fast C and C++ code for embedded processors used in
mass production - MATLAB ([original](https://www.mathworks.com/help/ecoder/ref/embeddedcoder-app.html)) ([raw](?raw))
Generate readable, compact, and fast C and C++ code for embedded processors used in mass production
Description
Use the Embedded Coder app to generate C or C++ code from a model that represents a discrete-time system. The app extends the Simulink Coder app capabilities with advanced optimizations for precise control of the generated functions, files, and data. When you open the app, a C Code tab is added to the toolstrip. The C Code tab represents groups of tasks in the Embedded Coder workflow.
Use the app to perform these tasks:
- If you are new to Embedded Coder, use the Embedded Coder Quick Start to prepare your model for code generation. The Embedded Coder Quick Start chooses fundamental code generation settings based on your goals and application. Open the Embedded Coder Quick Start by clicking Quick Start.
- Set code generation objectives and prepare your model for code generation by clicking the C/C++ Code Advisor.
- For a model hierarchy, specify the deployment type of each model by using theDeployment Type drop-down. If you have not configured deployment types, the drop-down says Automatic because Embedded Coder determines the deployment types automatically.
- To set model configuration parameters, select > or > .
- Opening the Embedded Coder app opens the Code perspective. The Code perspective contains an integrated help pane, the Code Mappings editor, and the Property Inspector or Code view. Use the Code Mappings editor to configure data elements and entry-point functions in a model. Select > .
- To create custom code definitions, open the Embedded Coder Dictionary by selecting > .
- Generate code only by selecting > . Build the model and generate code by selecting > .
- To view the generated code alongside your model, use the Code view. You can trace between model elements and the code by clicking hyperlinked lines of code in the Code view. Open the latest code generation report by selecting Open Report.
- Verify the equivalence of the simulation and the code execution results by opening the SIL/PIL app. Select > .
- Create a protected model for simulation and code generation to share with a third party by selecting > .
- Package the code and artifacts by selecting > .
Open the Embedded Coder App
In the Apps gallery, under Code generation, click Embedded Coder. The C Code tab opens.
Examples
- Generate Code by Using the Quick Start Tool
- Generate C Code from Simulink Models
- Code Mappings Editor — C
- Embedded Coder Dictionary
- Map Embedded System Architecture to Simulink Modeling Environment
Tips
- If you are working with a model hierarchy, the Embedded Coder app automatically determines the deployment type of each model based on the position in the hierarchy. The top model is the component and referenced models are subcomponents. On theC Code tab, the functionalities apply to the component model. To configure the deployment types of the models in the hierarchy:
- Specify simulation only models, such as test harnesses, by clicking the down arrow in the Output section of the toolstrip and selecting . When you view a simulation only model in the Embedded Coder app, the toolstrip hides the code generation options.
- Specify component and subcomponent models by using the Deployment Type drop-down.
- To configure and view code for a referenced model, navigate to the model in the hierarchy and use the Code Mappings editor, Model Data Editor, Property Inspector, and Code view. These views apply to the active model, which can be the top model or a referenced model.
Version History
Introduced in R2019b