| 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 |
The following sections discuss
This section lists model.* files created during the code generation and build process for the GRT and GRT malloc targets when used with stand-alone models. Additional directories and files are created to support shared utilities and model references (see Architecture Considerations in the Real-Time Workshop documentation).
The build process derives many of the files from the model.mdl file you create with Simulink. You can think of the model.mdl file as a very high-level programming language source file.
Note Files generated by the Real-Time Workshop Embedded Coder build process are packaged slightly differently. Depending on model architectures and code generation options, the Real-Time Workshop build process might generate other files. |
Descriptions of the principal generated files follow. Note that these descriptions use the generic term model for the model name:
An ASCII file, representing the compiled model, generated by the Real-Time Workshop build process. This file is analogous to the object file created from a high-level language source program. By default, the Real-Time Workshop build process deletes this file when the build process is complete. However, you can choose to retain the file for inspection.
model.c
C source code that corresponds to model.mdl and is generated by the Target Language Compiler. This file contains
Include files model.h and model_private.h
All data except data placed in model_data.c
Model-specific scheduler code
Model-specific solver code
Model registration code
Algorithm code
Optional GRT wrapper functions
Defines model data structures and a public interface to the model entry points and data structures. Also provides an interface to the real-time model data structure (model_rtM) via access macros. model.h is included by subsystem .c files in the model. It includes
Exported Simulink data symbols
Exported Stateflow machine parented data
Model data structures, including rtM
Model entry point functions
model_private.h
Contains local define constants and local data required by the model and subsystems. This file is included by the generated source files in the model. You might need to include model_private.h when interfacing legacy hand-written code to a model. See Header Dependencies When Interfacing Legacy/Custom Code with Generated Code in the Real-Time Workshop documentation for more information. This header file contains
Imported Simulink data symbols
Imported Stateflow machine parented data
Stateflow entry points
Real-Time Workshop details (various macros, enums, and so forth that are private to the code)
model_types.h
Provides forward declarations for the real-time model data structure and the parameters data structure. These might be needed by function declarations of reusable functions. model_types.h is included by all the generated header files in the model.
A conditionally generated C source code file containing declarations for the parameters data structure and the constant block I/O data structure, and any zero representations for structure data types that are used in the model. If these data structures are not used in the model, model_data.c is not generated. Note that these structures are declared extern in model.h. When present, this file contains
Constant block I/O parameters
Include files model.h and model_private.h
Definitions for the zero representations for any user-defined structure data types used by the model
Constant parameters
model.exe (Microsoft Windows platforms) or model (UNIX platforms), generated in the current directory, not in the build directory
Executable program file created under control of the make utility by your development system (unless you have explicitly specified that Real-Time Workshop generate code only and skip the rest of the build process)
Customized makefile generated by the Real-Time Workshop build process. This file builds an executable program file.
Contains #include directives required by static main program modules such as grt_main.c and grt_malloc_main.c. Since these modules are not created at code generation time, they include rt_model.h to access model-specific data structures and entry points. If you create your own main program module, take care to include rtmodel.h.
For GRT targets, a header file that includes simstruc_types.h, which, in turn, includes tmwtypes.h. For Real-Time Workshop Embedded Coder ERT targets, rtwtypes.h itself provides the necessary defines, enums, and so on, instead of including tmwtypes.h and simstruc_types.h. The rtwtypes.h file generated for ERT is an optimized (reduced) file based on the settings provided with the model that is being built. See Header Dependencies When Interfacing Legacy/Custom Code with Generated Code in the Real-Time Workshop documentation for more information.
C source file that declares and initializes global nonfinite values for inf, minus inf, and nan. Nonfinite comparison functions are also provided. This file is always generated for GRT-based targets and optionally generated for other targets.
C header file that defines extern references to nonfinite variables and functions. This file is always generated for GRT-based targets and optionally generated for other targets.
Real-Time Workshop file generated for the make utility to use to determine when to rebuild objects when the name of the current Real-Time Workshop project changes
Windows batch file used to set up the appropriate compiler environment and invoke the make command
List of additional sources that should be included in the compilation.
Optional files:
M-file used by external mode to initialize the external mode connection
model_dt.h
C header file used for supporting external mode. Declares structures that contain data type and data type transition information for generated model data structures.
subsystem.c
C source code for each noninlined nonvirtual subsystem or copy thereof when the subsystem is configured to place code in a separate file
subsystem.h
C header file containing exported symbols for noninlined nonvirtual subsystems. Analogous to model.h.
model_capi.h
An interface header file between the model source code and the generated C API. See Monitoring Signals With the C API in Real-Time Workshop User's Guide for more information.
C source file that contains data structures that describe the model's signals and parameters without using external mode. See Interacting with Target Application Signals and Parameters Using the C API in Real-Time Workshop User's Guide for more information.
rt_sfcn_helper.h, rt_sfcn_helper.c
Header and source files providing functions needed by noninlined S-functions in a model. The functions rt_CallSys, rt_enableSys, and rt_DisableSys are used when noninlined S-functions call downstream function-call subsystems.
In addition, when you select the Create code generation report check box, the Real-Time Workshop software generates a set of HTML files (one for each source file plus a model_contents.html index file) in the html subdirectory within your build directory.
The above source files have dependency relationships, and there are additional file dependencies that you might need to take into account. These are described in Generated Source Files and File Dependencies in the Real-Time Workshop documentation.
The Real-Time Workshop build process places output files in three directories:
If you choose to generate an executable program file, the Real-Time Workshop build process writes the file model.exe (Windows) or model (UNIX) to your working directory.
The build directory — model_target_rtw
A subdirectory within your working directory. The build directory name is model_target_rtw, where model is the name of the source model and target is the selected target type (for example, grt for the generic real-time target). The build directory stores generated source code and all other files created during the build process (except the executable program file).
A subdirectory within your working directory. When models referenced via Model blocks are built for simulation or Real-Time Workshop code generation, files are placed in slprj. The Real-Time Workshop Embedded Coder configuration has an option that places generated shared code in slprj without the use of model reference. Subdirectories in slprj provide separate places for simulation code, some Real-Time Workshop code, utility code shared between models, and other files. Of particular importance to Real-Time Workshop users are:
Header files from models referenced by this model
slprj/target/model/referenced_model_includes
Model reference Real-Time Workshop target files
slprj/target/model
MAT-files used during code generation of model reference
Real-Time Workshop target and stand-alone code generation
slprj/target/model/tmwinternal
Shared (fixed-point) utilities
slprj/target/_sharedutils
See Working with Project Directories for more information on organizing your files with respect to project directories.
The build directory always contains the generated code modules model.c, model.h, and the generated makefile model.mk.
Depending on the target, code generation, and build options you select, the build directory might also include
HTML summary reports of files generated (in the html subdirectory)
Block I/O and parameter tuning information file (model_capi.c)
C API code for parameters and signals
Real-Time Workshop project (model.tmw) files
For additional information about using project directories, see Project Directory Structure for Model Reference Targets and Supporting Shared Utility Directories in the Build Process in the Real-Time Workshop documentation.
![]() | Initiating the Build Process | Rebuilding a Model | ![]() |

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 |