Main Content

Generate C++ Code from Simulink Models

This tutorial provides instructions for generating C++ code from a Simulink® model by using the Embedded Coder® product.

To generate and review code for deployment to an embedded system, you can prepare your model for code generation by using the Embedded Coder Quick Start tool. Then, using code tools accessible from the Simulink Editor, you configure code interfaces, initiate code generation, and review the generated code.

Example Model

This tutorial uses the rtwdemo_cppclass_workflow example model.

The rtwdemo_cppclass_workflow model represents a key ignition system in the greater control system of a vehicle engine. When the ignition is turned on, the keyState input signal changes state and the control system waits a delay before switching the output engineState.

View of the rtwdemo_cppclass_workflow model

You learn how to:

  • Generate C++ code by using the Embedded Coder Quick Start tool.

  • Configure the C++ class interface.

  • Deploy the generated C++ code.

For the first task in this tutorial, see Generate C++ Code by Using Embedded Coder Quick Start.