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:

ST’s graphical no-code design software
Design Automation
MEMS-Studio is a complete desktop software solution designed to develop embedded AI features, evaluate embedded libraries, analyse data, and design no-code algorithms for the entire portfolio of ST’s MEMS sensors.

Read more...
LibGSM – A powerful, modular GSM library
eiTech Systems Design Automation
Whether you are building SMS, MQTT, HTTP or other GSM-based applications, eiTech’s LibGSM library helps streamline development with its carefully structured design.

Read more...
NECTO Studio V7.2 IDE with code assistant
Design Automation
MIKROE recently announced that NECTO Studio 7.2 IDE now includes NECTO Code Assistant, an AI tool that enables users to create code for multi-Click projects.

Read more...
MPLAB unified compiler licenses
Design Automation
Offering an efficient way to manage multiple licenses, Microchip Technology has launched MPLAB XC unified compiler licenses for its MPLAB XC8, XC16, XC-DSC and XC32 C compilers.

Read more...
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...