Technical data
1
Using the Target Language Compiler with Real-Time Workshop
1-2
Using the Target Language Compiler
Introduction
The Target Language Compiler™ is a tool that is included with Real-Time
Workshop
®
(RTW) and enables you to customize the C code generated from any
Simulink
®
model. Through customization, you can produce platform-specific
code or incorporate algorithmic changes for performance, code size, or
compatibility with existing methods that you prefer to maintain.
Notes: This book describes the Target Language Compiler, its files, and how
to use them together. This information is provided for those users who need to
customize target files in order to generate specialized output. Or, in some
cases, for users who want to inline S-functions so as to improve the
performance of the generated code. If you simply need to generate ANSI C
code from your Simulink model, you can find everything you need to know in
the Real-Time Workshop User’s Guide.
This book refers to the Target Language Compiler either by its complete
name, Target Language Compiler, or TLC, or simply, Compiler.
As an integral component of Real-Time Workshop, the Target Language
Compiler is used to transform an intermediate form of a Simulink block
diagram, called
model.rtw, into C code. The Compiler generates its code based
on “target files,” which specify particular code for each block, and “model-wide
files,” which specify the overall code style. The Compiler works like a text
processor, using the target files and the
model.rtw file to generate ANSI C
code.
In order to create a target-specific application, Real-Time Workshop also
requires a template makefile that specifies the appropriate C compiler and
compiler options for the build process. A target-specific version of the generic
rt_main file (or grt_main) must also be modified to conform to the target’s
specific requirements such as interrupt service routines. A complete
description of the template makefiles and
rt_main is included in the Real-Time
Workshop User’s Guide.