%% Introduction
% This example shows how to use the Embedded Coder® product to generate code for a supplied Simulink® control algorithm model, integrate the generated code with an existing system, and validate simulation and executable results.
%% Format
% This example consists of the following seven modules:
% Understanding the Model
% Configuring the Data Interface
% Function Partitioning within the Generated Code
% Calling External C Code from the Simulink® Model and Generated Code
% Integrating the Generated Code into the External Environment
% Testing the Generated Code
% Evaluating the Generated Code
% Each module provides the following information and builds on what you learned and generated in previous modules:
% Estimated completion time
% Goals
% Background information, models, tasks, and task activation links that help you achieve the module goals
% Links to the previous and next modules
% Links to more information about module topics, including alternative methods for completing tasks
% This example uses scripts that simplify use of the example. Everything that is done by script can be done from the MATLAB® prompt or from Simulink® menus.
%% Prerequisite Knowledge
% This example assumes the following prerequisite knowledge:
% MathWorks® products
% How to read, write, and apply MATLAB scripts
% How to create a basic Simulink® and Stateflow® model
% How to run Simulink® simulations and evaluate the results
% C programming
% C data types and storage classes
% Function prototypes and methods of calling functions
% How to compile a C function
% Metrics for evaluating embedded software
% Basic code readability issues
% RAM/ROM usage
%% Using This Example
% Each module focuses on a specific aspect of code generation or integration. You can complete the modules independently, during different sessions, or in a single session. The total estimated completion time is four hours.
% For most tasks, you have the option of completing the task on your own by following the instructions, or you can execute a script by clicking its Task: link. Some scripts require time to run. In such cases, a dialog box appears when the task is complete. If the link fails, error messages appear in the MATLAB Command Window.
% Each module has a unique model and data set. As a result, the modules are independent and do not have to run in a specific order. When you transition between modules, the example saves the current model locally, capturing your modifications to the model and model data.
% To recover a model in its original state, delete the local copy of the model and model data. The model data is saved as PCG_Demo_#_data.mat.
%% Third-Party Software
% The modules Integrating the Generated Code into the External Environment and Testing the Generated Code use the Eclipse™ IDE and the Cygwin™/gcc compiler. Instructions on how to install and use Eclipse™ and Cygwin™/gcc appear at the end of the example in Installing and Using Cygwin™ and Eclipse™.
% Copyright 2007-2015 The MathWorks, Inc.