Generate C++ Code from Simulink Models
This example shows you how to generate C++ code from a Simulink® model of a key ignition system 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, simulate, initiate code generation, and review the generated code.
Example Model
This tutorial uses the example models CppClassWorkflowKeyIgnition
and CppClassWorkflowHarness
.
The CppClassWorkflowKeyIgnition
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
.
The CppClassWorkflowHarness
model is a test harness that supplies input and monitors output for CppClassWorkflowKeyIgnition
. This tutorial provides steps for creating a harness model, or you can follow along with CppClassWorkflowHarness
.
By using this tutorial, you will learn how to:
Generate C++ code by using the Embedded Coder Quick Start tool.
Configure the C++ class interface.
Simulate and verify the generated C++ code.
Deploy the generated C++ code.
For the first task, see Generate C++ Code by Using Embedded Coder Quick Start.
Copyright 2022 The MathWorks, Inc.