Use the Embedded Coder® product to generate C or C++ code that is optimized for deployment on rapid-prototyping boards, embedded processors, or microprocessors. If you are new to Embedded Coder or your application code customization requirements are minimal, you can use graphical tools and default code configuration settings to quickly generate production-quality code. If you need to produce customized code for integration with existing external code or you want to meet code guidelines and standards, tooling is available to configure the code generator to meet requirements for interfacing, code appearance, packaging, and optimizations.
Generating and reviewing code for deployment to an embedded system can be as simple as preparing the model for code generation with the Quick Start tool. Then, with code tools accessible from the Simulink Editor, you can configure code interfaces, initiate code generation, and review the generated code.
To complete this tutorial, you must have:
The tutorial uses example models
rtwdemo_roll_harness. The models have been verified for simulation.
This model implements a basic roll axis autopilot algorithm, which controls the aileron position of an aircraft.
The model represents one component in the greater control system of an aircraft. Through
HDG_Mode signal, the control system places the model in one of two
operating modes: roll attitude hold or heading hold. The
calculate a roll attitude setpoint that supports one of the operating modes. Then, the
BasicRollMode subsystem, a PID controller, calculates an aileron
position command based on the setpoint and on feedback that indicates the measured roll
attitude and rate of change. The model is designed to operate at 40 Hz.
The tutorial uses model
rtwdemo_roll_harness to test
You will learn how to:
Generate code by using the Embedded Coder Quick Start tool.
Configure the data interface.
Configure a model parameter as a global variable for tuning during run time.
Compare model simulation and generated code results for numeric equivalency.
Deploy the generated code.
To start the tutorial, see Generate Code by Using Embedded Coder Quick Start.