| Real-Time Workshop® Embedded Coder™ | ![]() |
The Generate an example main program option controls whether or not ert_main.c or ert_main.cpp is generated for your Simulink® model. This option is located in the Templates pane of the Configuration Parameters dialog box, as shown in this figure.
Options for Generating a Main Program

By default, Generate an example main program is on. When Generate an example main program is selected, the Target operating system pop-up menu is enabled. This menu lets you choose the following options:
BareBoardExample: Generate a bareboard main program designed to run under control of a real-time clock, without a real-time operating system.
VxWorksExample: Generate a fully commented example showing how to deploy the code under the Wind River Systems VxWorks® real-time operating system.
Regardless of which Target operating system you select, ert_main.c or .cpp includes
The main() function for the generated program
Task scheduling code that determines how and when block computations execute on each time step of the model
The operation of the main program and the scheduling algorithm employed depend primarily upon whether your model is single-rate or multirate, and also upon your model's solver mode (SingleTasking vs. MultiTasking). These are described in detail in Program Execution Overview.
If you turn the Generate an example main program option off, the Real-Time Workshop® Embedded Coder™ software provides a static version of the file ert_main.c as a basis for your custom modifications (see Static Main Program Module).
Note Once you have generated and customized the main program, you should take care to turn Generate an example main program off to prevent regenerating the main module and overwriting your customized version. |
You can use a custom file processing (CFP) template file to override the normal main program generation, and generate a main program module customized for your target environment. To learn how to do this, see Customizing Main Program Module Generation.
![]() | Code Modules | Program Execution Overview | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |