StackX

{title}

StackX™ is a unique, patent pending, development tool that helps developers avoid stack overflow problems that traditionally have plagued embedded systems. StackX performs a comprehensive analysis of a complete application at the executable code level, computing the worst-case stack usage the application can experience. Express Logic is the only RTOS company that can identify how large a stack customers need for each application thread and automatically alerts them if they fail to allocate sufficient memory!

In the C programming language, the stack—a region of memory on which local variables are created and function arguments are passed—is allocated by the programmer, with the amount based on factors such as machine architecture, OS, application design, and amount of memory available. When the program requires more memory for its stack than has been allocated, the stack overflows—without warning in most cases—which can corrupt other memory areas and typically results in a program crash. Such crashes are very difficult to trace back to the stack overflow, causing programmers to expend considerable time and energy to find the overflow. As a result, they tend to over-allocate stack memory as a precaution.

Deciding how much memory to allocate for the stack has been a trial and error process.

As widely respected industry commentator and consultant, Jack Ganssle, has observed:

"With experience, one learns the standard, scientific way to compute the proper size for a stack: Pick a size at random and hope."

StackX solves this problem for embedded developers by computing the required stack size automatically for developers, enabling them to allocate just the amount of memory needed to be safe, and avoid wasting any additional, unnecessary memory. StackX analyzes a program’s executable (.elf) file, mapping all function calls, interrupt service routines, local variables, and any other factors related to stack usage. This enables StackX to calculate each thread’s maximum stack memory requirements. StackX produces a “call-tree” that shows the maximum stack usage for each thread. Developers can see their program flow and are better able to optimize their code.

Call Tree Display

There are four types of nodes in the call tree display presented by StackX, namely, the Program Node, Entry Node, Thread Node, and Root Node. The highest-level callers are shown on the left and each function called is shown beneath the node, and indented slightly to the right.

The nodes are displayed in a particular order. The Program Node is always displayed first, followed by the Entry Node. These nodes are always displayed in this order. Thread Nodes are displayed next, in order of their maximum stack usage (from highest to lowest). Note that Thread Nodes are only detected if ThreadX is being used, since StackX knows how ThreadX threads are created and where to find the created stack size. Finally, Root Nodes are displayed, in order of their maximum stack usage. Root Nodes are simply nodes that are not directly called anywhere else. Typically Root Nodes are Interrupt Service Routines (ISRs) or the target of indirect function calls.

StackX Dialog box

Additional Program Information

In addition to displaying the call tree, StackX also provides the developer additional information about the program. This includes a summary of the program and a detailed view of the ELF sections and functions found in the executable.

StackX Program Information

StackX employs a proprietary, patent-pending algorithm that is accurate, efficient, and only requires an “.elf” file. While it may be used with any .elf file, StackX has particular visibility into ThreadX® RTOS-based applications, with its thread-aware stack size calculation. It recognizes recursion conditions, where infinite memory would be required to avoid potential overflow, so programmers can correct the code, rather than attempt to allocate more memory. StackX costs less than 1 stack overflow!

Section Information

The ELF section information shows very useful information, including the section type (Code or Data), the start address, and the size in bytes. Also note that the information can be sorted by simply clicking on any of the column headings. Below is an example of ELF section information displayed by StackX.

StackX Section Info

Function Information

The function information shows very useful information, including the function start address, code size in bytes, local stack requirements, maximum stack, total calls made, recursive calls, and indirect calls. Also note that the information can be sorted by simply clicking on any of the column headings.

StackX Function Information

Summary

StackX employs a proprietary, patent-pending algorithm that is accurate, efficient, and only requires an “.elf” file. While it may be used with any .elf file, StackX has particular visibility into ThreadX® RTOS-based applications, with its thread-aware stack size calculation. It recognizes recursion conditions, where infinite memory would be required to avoid potential overflow, so programmers can correct the code, rather than attempt to allocate more memory. StackX costs less than 1 stack overflow!

Licensing Overview

StackX is available from Express Logic at a price of $1,000 per developer (3 developer minimum) for a perpetual license. Like all Express Logic tool products, there are no license keys.