Target Language Compiler | ![]() ![]() |
You can configure TLC from the RTW Options dialog box or from the TLC command line, which is also accessible from the RTW Options dialog box. To use the RTW Options dialog box, select Tools -> Real-Time Workshop -> Options from the Simulink menu. Alternatively, you can select Simulation -> Simulation Parameters and then select the Real-Time Workshop tab from the resulting dialog box.
From the Category drop down list, select TLC Debugging. This provides options for configuring the build process, including activating the TLC debugger and an option to retain the RTW file. This is covered in more detail in Chapter 6, Debugging TLC.
Another way of configuring the TLC code generation process is by using the -a
flag on the TLC command line. Using -amyVar=1
on the command line is equivalent to saying
%assign myVar = 1
in your target file. You can repeat the -a
parameter, and it can be specified in the System Target File field in the Real-Time Workshop (Category: Target Configuration) dialog box.
For an example of how this process works, consider the following TLC code fragment
%if !EXISTS(myConfigVariable) %assign myConfigVariable = 0 %endif %if (myConfigVariable == 1) code fragment 1 %else code fragment 2 %endif
If you specify -amyConfigVariable=1
in the command line, code fragment 1
is generated; otherwise code fragment 2
is generated. The if
block starting with
%if !EXISTS(myConfigVariable)
serves to set the default value of myConfigVariable
to 0, so that TLC does not error out if you forget to add -amyConfigVariable
to the command line.
![]() | Writing Target Language Files: A Tutorial | Contents of model.rtw | ![]() |