User`s guide
Open Architecture of the Real-Time Workshop
1-15
S-Functions
S-functions allow you to add custom code to your Simulink model. You can
embed the code directly into the generated code or, by default, allow the
S-function Application Program Interface (API) to call the S-function.
Embedding the S-function code directly into the generated code is called
inlining the S-function. The default is called noninlined.
For more information on S-functions, see Using Simulink. For information on
inlining S-functions see the Target Language Compiler Reference Guide.
The Target Language Compiler is the key for customizing the generated code.
Customizations usually involve inlining S-functions.
The Build Procedure
The open and modular structure of the Real-Time Workshop allows you to
configure the Real-Time Workshop for your environment, or use an existing
environment, such as dSPACE or Wind River Systems Tornado Development
Environment, provided by a third-party vendor.
The Real-Time Workshop build procedure first creates the
model.rtw file,
which is an intermediate representation of a Simulink block diagram that
contains information such as the parameter values, vector widths, sample
times, and execution order for the blocks in your model. This information is
stored in a language-independent format.
After creating the
model.rtw file, the build procedure invokes the Target
Language Compiler to transform it into target-specific code. The Target
Language Compiler begins by reading in the
model.rtw file. It then compiles
and executes the commands in the target files. The target files (referred to as
.tlc or TLC files) specify how to transform the model.rtw file into
target-specific code. The Target Language Compiler starts execution with the
system target file. It then loads the individual block target files to transform
the block information in the
model.rtw file into target-specific code for the
blocks. The output of the Target Language Compiler is a source code version of
the Simulink block diagram.
The Target Language Compiler includes a Target Language Compiler function
library, which is a set of routines for use by the various target files.
The next step of the build procedure is to create a system makefile (
system.mk)
from a template makefile (
system.tmf). system.tmf is the template makefile
for your target environment; it allows you to specify compilers, compiler