Design Automation


Tool warns of potential stack overflow

22 July 2009 Design Automation

Express Logic has introduced a new development tool that helps developers avoid stack overflow problems in embedded systems.

The new tool, StackX, performs a comprehensive analysis of a complete application at the executable code level, computing the worst-case stack usage the application can experience.

In the C programming language, the stack – a region of memory on which local variables are created and function arguments are passed – is allocated memory 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 computes 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. The tool analyses a program’s executable file (.elf), mapping all function calls, interrupt service routines, local variables and any other factors related to stack usage. This enables it to calculate each thread’s maximum stack memory requirements and produce a ‘call tree’ that shows the maximum stack usage for each thread. Developers can see their program flow and are better able to optimise their code.

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 recognises 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.

For more information visit www.rtos.com





Share this article:
Share via emailShare via LinkedInPrint this page

Further reading:

MPLAB PICkit Basic
ASIC Design Services Design Automation
To make its robust programming and debugging capabilities accessible to a wider range of engineers, Microchip Technology has launched the MPLAB PICkit Basic in-circuit debugger.

Read more...
Accelerating RF PCB design in a 5G world
ASIC Design Services Editor's Choice Design Automation
Billions of IoT devices coming online in the coming years will require RF design capabilities that support ultra-fast 5G speeds.

Read more...
NECTO Studio has been updated
Design Automation
NECTO Studio V7.1 IDE from MIKROE now includes full programmer and debug support for Microchip tools and also adds support for Microchip’s SAM MCU and STMicroelectronics’ STM32L4 series of ultra-low-power MCUs.

Read more...
Altium provides free training
Design Automation
There is no longer any excuse not to master Altium Designer with the company now offering both advanced instructor-led three-day training and an on-demand video series.

Read more...
Altium syncs your design and PCB programming software
EDA Technologies Design Automation
Altium Designer and Altium 365 can keep track of everything needed in PCB design, PCB programming language, component sourcing, and much more, as an embedded application is developed.

Read more...
New Studio 6 SDK
Design Automation
New Simplicity Studio 6 SDK opens development environment, and opens developers to Series 3.

Read more...
New camera module targets AI and computer vision
Vepac Electronics Design Automation
Innodisk has announced its shift towards the AI industry with half of its AI development related to image recognition.

Read more...
Engineering the future of automation
Design Automation
As the next great leap forward in mechanisation, industrial automation integrates data into the manufacturing equation through high-input sensors and sensor infrastructures.

Read more...
Fusion 360 gains Ultra Librarian electronics CAD library
Design Automation
Autodesk collaborated with Ultra Librarian to generate this Fusion 360-compatible app that provides users with free verified schematic symbols, PCB footprints, 3D STEP models, and reference designs.

Read more...
ST releases new reference designs for STM32
Altron Arrow Design Automation
ST Microelectronics has released reference designs for the STM32WL5x and STM32WLEx, allowing new applications to be quickly prototyped.

Read more...