Electronics Technology


Tool warns of potential stack overflow

11 November 2009 Electronics Technology

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

The 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. 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:

140 W USB-C PD reference design
Altron Arrow Electronics Technology
The design has a wide input range of 90 to 264 V AC, 50-60 Hz, and supports an output voltage range of 5 to 28 V (USB-PD 3.1 specification).

Read more...
Nanometre-precision piezo actuators
RS South Africa Electronics Technology
TDK Corporation has announced two new piezo actuators that are characterised by a wide dynamic range, a high force-to-volume ratio, but with precision in the nanometre range.

Read more...
Webinar: The evolving electrification of the power distribution system
Infineon Technologies Electronics Technology
New connected car functionality, along with the necessity to reduce the cost, weight and complexity associated with wire harnesses, has led to the transformation of the power distribution system in automotive engineering.

Read more...
Improved MnZn material for power conversion industry
Sivan Electronic Supplies Electronics Technology
Cosmo Ferrites Ltd, a leading manufacturer of soft ferrites, has launched an improved version of CF295 for the power conversion industry.

Read more...
Common mode filter for automotive Ethernet
Avnet Abacus Electronics Technology
TDK Corporation has announced the introduction of its new ACT1210E Series common mode filter for automotive Ethernet 10BASE-T1S.

Read more...
Energising the industrial edge
Electronics Technology
As if the drive to decarbonise energy as part of sustainability and climate change efforts was not enough, the recent rise in energy prices has brought into sharp contrast the need to re-examine how we generate, distribute, and consume electricity.

Read more...
Samsung begins chip production using 3 nm process technology
EBV Electrolink Electronics Technology
The optimised 3 nm process with GAA architecture achieves 45% lower power usage, 23% improved performance and 16% smaller surface area compared to 5 nm process.

Read more...
Panasonic releases its updated touch-sensitive knob
Altron Arrow Electronics Technology
Panasonic, in conjunction with Microchip, has launched an update to its existing Magic Knob, a capacitive knob ready for standard touch sensors for use in controlling automotive information displays.

Read more...
Microchip’s new IC to replace Hall effect position sensors
Altron Arrow Electronics Technology
The LX34070 IC from Microchip is set to help accelerate the global move away from expensive and less accurate magnet-based solutions for safety-critical EV motor position monitoring.

Read more...
A brief history of HBTs
Conical Technologies Electronics Technology
In 1947 the engineers at Bell Labs were tasked with developing a transistor. This development heralded the beginning of the semiconductor industry which changed the world forever. Transistors would have ...

Read more...