Technical data

1
Using the Target Language Compiler with Real-Time Workshop
1-10
Files
The Target Language Compiler works with various sets of files to produce its
results. The complete set of these files is called a TLC program. This section
describes the TLC program files.
Target Files
Target files are the set of files that are interpreted by the Target Language
Compiler to transform the intermediate RTW code (
model.rtw) produced by
Simulink into target-specific code.
Target files provide you with the flexibility to customize the code generated by
the Compiler to suit your specific needs. By modifying the target files included
with the Compiler, you can dictate what the compiler produces. For example,
if you use the available
mdlwide.tlc, you produce generic C code from your
Simulink model. This executable C code is not platform specific. By modifying
mdlwide.tlc, or creating a completely new target file, you could output C code
specific to a particular piece of hardware, or for that matter, output code in
another language.
All of the parameters used in the target files are read from the
model.rtw file
and looked up using block scoping rules. You can define additional parameters
within the target files using the
%assign statement. The block scoping rules
and the
%assign statement are discussed in Chapter 2.
Target files are written using target language directives. Chapter 2, “Working
with the Target Language,” provides complete descriptions of the target
language directives.
Appendix A contains a thorough description of the
model.rtw file, which is
useful for creating and/or modifying target files.
System Target Files
System target files are used on a model-wide basis and provide basic
information to the Target Language Compiler, which transforms the RTW file
into target-specific code. The system target file is the “entry point” for the TLC
program, which is analogous to the
main() routine of a C program. System
target files oversee the entire code generation process. For example, the system
target file,
grt.tlc, sets up some variables for mdlwide.tlc and includes