Real-Time Workshop User's Guide    

Controlling Stack Space Allocation

The Real-Time Workshop offers a number of options that let you control how signals in your model are stored and represented in the generated code. This section discusses options that:

For a complete discussion of signal storage options, see Signals: Storage, Optimization, and Interfacing.

If you want to store signals in stack space, you must turn the Local block outputs option on. To do this:

  1. Select the Advanced tab of the Simulation Parameters dialog box. Make sure that the Signal storage reuse is on. If Signal storage reuse is off, the Local block outputs option is not available.
  2. Click Apply if necessary.
  3. Select the Real-Time Workshop tab of the Simulation Parameters dialog box.
  4. From the Category menu, select General code generation options.
  5. Check the Local block outputs option. Click Apply if necessary.

Your embedded application may be constrained by limited stack space. When the Local block outputs option is on, you can limit the use of stack space by using the following Target Language Compiler variables:

To set either of these variables, use assign statements in the system target file (ert.tlc), as in the following example.

It is recommended that you write your %assign statements in the Configure RTW code generation settings section of the system target file. The %assign statement is described in the Target Language Compiler Reference Guide.


 Generating a Code Generation Report Advanced Code Generation Options