Download Real-Time Workshop®

Transcript
3
Code Generation and the Build Process
When you declare a parameter tunable, you specify:
• The storage class of the parameter.
In the Real-Time Workshop, the storage class property of a parameter
specifies how the Real-Time Workshop declares the parameter in generated
code.
Note that the term “storage class,” as used in the Real-Time Workshop, is not
synonymous with the term storage class specifier, as used in the C language.
• A storage type qualifier, such as const or volatile. This is simply an string
that is included in the variable declaration, without error checking.
• (Implicitly) the symbolic name of the variable or field in which the parameter
is stored. The Real-Time Workshop derives variable and field names from
the names of tunable parameters.
The Real-Time Workshop generates a variable or struct storage declaration
for each tunable parameter. Your choice of storage class controls whether the
parameter is declared as a member of rtP or as a separate global variable.
You can use the generated storage declaration to make the variable visible to
your code. You can also make variables declared in your code visible to the
generated code. You are responsible for properly linking your code to generated
code modules.
You can use tunable parameters or expressions in your root model and in
masked or unmasked subsystems, subject to certain restrictions (See “Tunable
Expressions” on page 3-61.)
To declare tunable parameters, you must first enable the Inline parameters
option. You then use the Model Parameter Configuration dialog to remove
individual parameters from inlining and declare them to be tunable. This
allows you to improve overall efficiency by inlining most parameters, while at
the same time retaining the flexibility of run-time tuning for selected
parameters.
The mechanics of declaring tunable parameters is discussed in “Using the
Model Parameter Configuration Dialog” on page 3-57.
3-54