[previous] [index] [next]

Example 10: Determining Stack Size

This example shows how to determine the stack size needed for your real-time tasks. So far, we've just used a 1K stack. In general you'll need to determine just how much stack to allocate. Too little, and you'll crash your system when your functions nest too deeply. Here's what you see when that happens:

The "Black Screen of Death". Normal Linux applications won't cause this, since they run in protected mode. RT code runs in privileged kernel space. Too little stack and you'll clobber the kernel, and see this screen. Time to reboot.

Refer to the commented source code of the example for the details.

Principle of Operation

The Gory Details

(This section shows the analysis that led to the example code. You can skip this; the example code contains the functions you'll need.)

Running the Demo

To run the demo, change to the 'ex10_stack' subdirectory of the top-level tutorial directory, and run the 'run' script by typing
./run
Alternatively, change to the top-level tutorial directory and run the 'runall' script there by typing
./runall
and selecting the "Stack Testing" button.

You'll see diagnostics messages printing out.

See the Code


Next: Example 11, Measuring Timing Jitter

Back: Example 9, Displaying Messages on an LED Wand Clock