Content originally posted in LPCWare by frame on Sun Apr 07 08:30:49 MST 2013
Quote:
How can I detect if I have stack overflow ?
First, you can single-step into the offending printf() (probably need to step
through the assembler code...), and watch the stack.
For better visibility, you can modify the startup code to fill the stack
with a specific pattern. As a side info, Visual C used 0xDDDD.DDDD here ...
Or you can catch the error - probably the hardfault handler - and unwind/check
the stack and system registers there. There is a famous code from Joseph Yiu around
(definitive guide to cortex M3 ...)
Or, you can just increase the reserved stacksize and see if the problem goes away.
Choosing a less-consumptive lib, avoiding floats and/or writing a small
special purpose function yourself could also help.