Real-Time Workshop User's Guide    

Choosing a Code Format for Your Application

Your choice of code format is the most important code generation option. The code format specifies the overall framework of the generated code and determines its style.

When you choose a target, you implicitly choose a code format. Typically, the system target file will specify the code format by assigning the TLC variable CodeFormat. The following example is from ert.tlc.

If the system target file does not assign CodeFormat, the default is RealTime (as in grt.tlc).

If you are developing a custom target, you must consider which code format is best for your application and assign CodeFormat accordingly.

Choose the real-time or real-time malloc code format for rapid prototyping. If your application does not have significant restrictions in code size, memory usage, or stack usage, you may want to continue using the generic real-time (GRT) target throughout development. The real-time format is the most comprehensive code format and supports almost all the built-in blocks.

If your application demands that you limit source code size, memory usage, or maintain a simple call structure, then you should choose the Real-Time Workshop Embedded Coder target, which uses the embedded C format.

Finally, you should choose the S-function format if you are not concerned about RAM and ROM usage and want to:

Table 4-1 summarizes the various options available for each code format/target available in the Real-Time Workshop.

Table 4-1: Features Supported by Real-Time Workshop Targets and Code Formats  
Feature
GRT
Real-
Time malloc

RTW Embedded Coder
DOS
Ada
Tornado
S-
Func

RSIM
RTWin
xPC
TI
DSP

Static memory allocation
X

X
X
X
X
X

X
X
X
Dynamic memory allocation

X



X
X
X



Continuous time
X
X

X

X
X
X
X
X

C MEX S-functions
(noninline)
X
X

X

X
X
X
X
X
X
Any S-function (inlined)
X
X
X
X
X
X
X
X
X
X
X
Optimized for min.
RAM/ ROM usage


X

X






Supports external mode
X
X



X


X
X
X
Intended for rapid prototyping
X
X

X

X


X
X
X
Intended for production code


X

X




X
X
Batch parameter tuning and Monte Carlo methods







X



Executes in hard real time
X
X
X
X
X
X


X
X
X
Non real-time executable included
X
X
X

X


X



Multiple instances of one model (if no Stateflow blocks in model)

X




X





 Introduction Real-Time Code Format