| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Real-Time Workshop |
| Contents | Index |
| Learn more about Real-Time Workshop |
| On this page… |
|---|
The Real-Time Workshop software generates C code only or generates the C code and produces an executable image, depending on the level of processing you choose. By default, a Build button appears on the Real-Time Workshop pane of the Configuration Parameters dialog box. This button completes the entire build process and an executable image results. If you select the Generate code only check box to the left of the button, the button label changes to Generate code.
When you click the Build or Generate code button, the Real-Time Workshop software performs the following build process. If the software detects code generation constraints for your model, it issues warning or error messages.
For more information, see Generating a Report. You can also view an HTML report in Model Explorer.
After generating the code, the Real-Time Workshop software generates a customized makefile, model.mk. The generated makefile instructs the make system utility to compile and link source code generated from the model, as well as any required harness program, libraries, or user-provided modules.
The Real-Time Workshop software creates model.mk from a system template file, system.tmf (where system stands for the selected target name). The system template makefile is designed for your target environment. You have the option of modifying the template makefile to specify compilers, compiler options, and additional information used during the creation of the executable.
The Real-Time Workshop software creates the model.mk file by copying the contents of system.tmf and expanding lexical tokens (symbolic names) that describe your model's configuration.
The Real-Time Workshop software provides many system template makefiles, configured for specific target environments and development systems. Selecting a Target in the Real-Time Workshop documentation lists all template makefiles that are bundled with the Real-Time Workshop software. To see an example template makefile, navigate to matlabroot/rtw/c/grt, and open with an editor the file grt_msvc.tmf. You can fully customize your build process by modifying an existing template makefile or providing your own template makefile.
The following figure shows how the Real-Time Workshop software controls automatic program building.

During the final stage of processing, the Real-Time Workshop build process invokes the generated makefile, model.mk, which in turn compiles and links the generated code. On PC platforms, a batch file is created to invoke the generated makefile. The batch file sets up the proper environment for invoking the make utility and related compiler tools. To avoid unnecessary recompilation of C files, the make utility performs date checking on the dependencies between the object and C files; only out-of-date source files are compiled. Optionally, the makefile can download the resulting executable image to your target hardware.
This stage is optional, as illustrated by the control logic in the preceding figure. You might choose to omit this stage, for example, if you are targeting an embedded microcontroller or a digital signal processing (DSP) board.
To omit this stage of processing, select the Generate code only check box on the Real-Time Workshop pane of the Configuration Parameters dialog box. You can then cross-compile your code and download it to your target hardware. Building Executables in the Real-Time Workshop documentation discusses the options that control whether or not the build creates an executable image.
If you select Create code generation report on the Real-Time Workshop > Report pane, a navigable summary of source files is produced when the model is built. The report files occupy a directory called html within the build directory. The report contents vary depending on the target, but all reports feature links to generated source files. The following display shows an example of an HTML code generation report for a generic real-time (GRT) target.

![]() | Reducing Build Time for Referenced Models | Relocating Code to Another Development Environment | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |