Embedded Coder

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.

  • To set model configuration parameters, select Settings > C/C++ Code generation settings or Settings > Hardware Implementation.

  • 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 and the Property Inspector to configure data elements and entry-point functions in a model. Select Code Interface > Individual Element Code Mappings.

  • To create custom code definitions, open the Embedded Coder Dictionary by selecting Code Interface > Embedded Coder Dictionary.

  • Generate code only by selecting Build > Generate Code. Build the model and generate code by selecting Build > Build.

  • 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 Verify Code > SIL/PIL Manager.

  • Create a protected model for simulation and code generation to share with a third party by selecting Share > Generate Protected Model.

  • Package the code and artifacts by selecting Share > Generate Code and Package.

Embedded Coder app

Open the Embedded Coder App

In the Apps gallery, under Code generation, click Embedded Coder. The C Code tab opens.

Tips

  • If you are working with a model hierarchy, open the Embedded Coder app in the Simulink Editor window for the top model of the hierarchy that you are generating code for. On the C Code 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 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.

See Also

Functions

Introduced in R2019b
Для просмотра документации необходимо авторизоваться на сайте