Advice About TLC Tutorials
The fastest and easiest way to understand the Target Language
Compiler (TLC) is to run it, paying attention to how TLC scripts transform
compiled Simulink® models (
files)
into source code. The tutorials highlight the principal reasons for
and techniques of using TLC. The tutorials provide a number of TLC
exercises, each one organized as a major section.model
.rtw
The example models, S-functions, and TLC files for the exercises
are located in the folder
(open).
In this chapter, this folder is referred to as matlabroot
/toolbox/rtw/rtwdemos/tlctutorialtlctutorial
.
Each example is located in a separate subfolder within tlctutorial
.
Within that subfolder, you can find solutions to the problem in a solutions
subfolder.
Note
Before you begin the tutorial, copy the entire tlctutorial
folder
to a local working folder. The files are together, and if you make
mistakes or want fresh examples to try again, you can recopy files
from the original tlctutorial
folder.
Each tutorial exercise is limited in scope, requiring just a small amount of experimentation. The tutorial explains details about TLC that will help customize and optimize code for code generation projects.
Note
You should not customize TLC files in the folder
even
though the capability exists to do so. Such TLC customizations might
not be applied during the code generation process and can lead to
unpredictable results.matlabroot
/rtw/c/tlc
The tutorials progress in difficulty from basic to more advanced. To get the most out of them, you should be familiar with
Working in the MATLAB® environment
Building Simulink models
Using the code generator to produce code for target systems
High-level language concepts (for example, C or Fortran programming)
If you encounter terms in the tutorials that you do not understand, it may be helpful to read Code Generation Concepts to acquaint yourself with the basic goals and methods of TLC programming. Similarly, if you see TLC keywords, built-in functions, or directives that you would like to know more about, see the corresponding topics on Target Language Compiler.
The examples used in the tutorial are:
Example | Description |
---|---|
guide | Illustrative record file |
timesN | An example C file S-function for multiplying an input by N |
tlcdebug | An example using TLC Debugger |
wrapper | Example TLC file for S-function wrapsfcn.c |