When you are ready to generate code for a model, you can modify the model configuration parameters specific to code generation. The code generation parameters determine how the code generator produces code and builds an executable program from your model.
The model configuration parameters for code generation are in the Code Generation and pane in the Configuration Parameters dialog box. The content of the Code Generation pane and its subpanes can change depending on the target that you specify. Some configuration options are available only with the Embedded Coder® product.
Your application objectives can include a combination of these code generation objectives: debugging, traceability, execution efficiency, and safety precaution. There are tradeoffs associated with these configuration choices, such as execution speed and memory usage. To help configure a model to achieve your application objectives, use the Model Advisor and the Code Generation Advisor.
To modify the model configuration parameters for code generation, open the Code Generation pane. There are several different ways to open the Code Generation pane from the Simulink editor:
To open the Configuration Parameters dialog box, click the model configuration parameters icon.
Then, click Code Generation in the left pane.
On the C Code tab, select Settings > Code Generation Settings.
On the Modeling tab, click Model
Explorer, or from the MATLAB® command line, type
daexplr and press
Enter. In the left pane of the Model Explorer, expand
the node for the current model and click the Configurations node. In the
Contents pane, right-click the configuration and
select Open from the context menu. Then click
Code Generation in the left pane.
In the Configuration Parameters dialog box, when you change the value of a check box, menu selection, or edit field, the white background of the element changes color to indicate that you made an unsaved change. When you click OK, Cancel, or Apply, the background resets to white.
To help you configure your model for code generation and to check your configuration against your code generation objectives, Simulink® Coder™ and Embedded Coder provide several tools.
|Automate configuration.||At the MATLAB command line, use the ||Configure Code Generation Parameters for Model Programmatically|
|Configure your model for code generation quickly and easily.||Quick Start tool|
|Use a template to create a model configured for code generation, ready for you to add your own blocks.||Code generation templates|
|To configure your model for code generation, use Simulink blocks and predefined or custom MATLAB scripts.||Code Generation Wizards blocks||Configure and Optimize Model with Configuration Wizard Blocks (Embedded Coder)|
|Verify that your model meets standards and guidelines.||Model Advisor||Check Your Model Using the Model Advisor|
|Verify that your model meets your application objectives.||Code Generation Advisor||Application Objectives Using Code Generation Advisor|