Real-Time Workshop Embedded Coder    

Controlling Stack Space Allocation

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 the Code Generation and the Build Process chapter of the Real-Time Workshop documentation.

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. Select 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 TLC variables:

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

We recommend 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 documentation.


  Generating Block Comments Generating a Code Generation Report