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
Further reading:
Connected without limits: An engineering perspective on Altron Arrow’s wireless ecosystem
Altron Arrow
Editor's Choice Design Automation
Wireless connectivity is no longer a supporting technology, but rather, a core design consideration that underpins modern electronic systems across industries.
Read more...
Next-gen robotic systems initiative
EBV Electrolink
Design Automation
EBV Elektronik recently introduced MOVE – Driving Robotics Forward, a new initiative designed by EBV Elektronik‘s Embedded Solutions team to support the development of next-generation robotic systems.
Read more...
Reference design for NB-IoT plus GNSS
Altron Arrow
Design Automation
ST Microelectronics’ STDES-ST87M01IGN is a reference design for the ST87M01 NB-IoT + GNSS module, implemented on a 2-layer FR4 PCB (90 x 60 x 1,6 mm).
Read more...
ST welcomes STM32Cube AI Studio
Design Automation
STMicroelectronics has introduced STM32Cube AI Studio, a new desktop software environment designed to simplify the deployment of artificial intelligence on STM32 microcontrollers.
Read more...
NeoCortec introduces new NeoGW software
Design Automation
This is a powerful multiplatform open-source solution designed to streamline integration between the NeoMesh network and upper-level systems, whether deployed in the cloud or on-premise environments.
Read more...
Keil Studio now in VSCode
Design Automation
Keil Studio, Arm’s latest IDE, now integrates embedded development tools directly into Visual Studio Code providing features like seamless industry tool integration, version control, and a CLI for CI workflows.
Read more...
Quad-Apollo MxFE reference design
Design Automation
The Quad-Apollo MxFE reference design exemplifies a complete, high-performance platform for every-element direct-RF sampling digital beamforming using Analog Devices’ Apollo mixed-signal front-end technology.
Read more...
MIKROE signs multi-year deal with Renesas
Dizzy Enterprises
Design Automation
MIKROE has signed a multi-year MCU development tool support deal with Renesas, which commits MIKROE to providing development tools for 500 of Renesas’ most popular MCUs.
Read more...
Future Electronics and SnapMagic announce CAD model integration to support faster design cycles
Future Electronics
Design Automation
Engineers can now download verified symbols, footprints, and 3D models directly from supported product pages, enabling a smoother transition from component selection to PCB layout.
Read more...
Pulsonix 14.0 advances design
Design Automation
Pulsonix’s latest PCB design software platform further strengthens simulation and brings significant enhancements in mechanical-electrical 3D integration, smarter comparison tools, and enhanced usability features.
Read more...