Stack overflow prevention technology added to Embedded Studio for ARM

23-06-2023 | Segger | Industrial

The latest release of SEGGER's Embedded Studio for ARM comes with STOP technology, designed by SEGGER to prevent stack overflows reliably. With STOP enabled, the compiler adds a call to a stack limit-check routine wherever required before modifying the stack pointer.

The STOP option for the highly optimising SEGGER Compiler can be readily switched on without changing the application code. This way, all stack overflows are prevented. If a stack overflow has been stopped, the system can enter a safe state and recover.

STOP has a surprisingly low impact on size and speed: It adds only about 2-5% to code size and execution time, which generally does not greatly impact the system's performance.

"An undetected stack overflow can be catastrophic," says Rolf Segger, founder of SEGGER. "I recommend the use of STOP for all applications. However, for any safety-critical application, I consider it essential. To the best of my knowledge, SEGGER is the only company offering such technology. Whether you're a software engineer, a student, or a hobbyist, I encourage you to download and try Embedded Studio. It takes less than 15 minutes, is easy and is hassle-free. It is also cost-free for evaluation, education, and non-commercial purposes."

A stack overflow can cause many failures in an embedded system, from hard-to-detect, seemingly random miscomputations to severe malfunctions or crashes.

STOP simply works, protecting all stacks in the system. It protects the process stack and the "main" stack used for interrupts. It can be used with any RTOS, provided it updates the stack-limit variable on a context switch.

The technology is currently available for Thumb-2 architectures such as Cortex-M4, Cortex-M7, Cortex-A9, and Cortex-A15.On ARMv7M architectures, STOP is ready to use in Embedded Studio with a single project option switch.

Visit the website for more information on STOP technology and a project demonstrating the technology in the Embedded Studio simulator.

By Seb Springall