Microcontrollers (MCU)

Design Support

Getting Started

Selection Tool

Training & Events

Developer Network



A stack overflow in an embedded DSP application generally produces a catastrophic software crash due to data corruption, lost return addresses, or both. Traditional off-line approaches to sizing a stack during development, such as filling with a know value, or estimating based on code content, are not 100% reliable. Therefore, programmers often feel compelled to reserve larger stack sizes than are actually needed. This wastes valuable memory resources. Facilities exist on the TMS320C28x™ DSP that, when properly configured, allow for runtime detection of a stack overflow before it occurs. Detection of an impending stack overflow triggers a maskable interrupt, and software can then take whatever corrective action is desired before a software crash occurs. This application report presents the methodology for online stack overflow detection on the TMS320C28x DSP. C-source code is provided that contains functions for implementing the overflow detection on both DSP/BIOS™ and non-DSP/BIOS applications.

Associated Files: