Page 1 of 1
callstack and _unhandled_exception
Posted: Tue Mar 26, 2013 11:16 am
by alex31
When something goes really wrong, mcu branches on _unhandled_exception, unfortunately
i cannot know using gdb where is the code which trig the error :
#0 _unhandled_exception () at ../../ChibiOS/os/ports/GCC/ARMCMx/STM32F4xx/vectors.c:211
#1 <signal handler called>
#2 0x55555554 in ?? ()
#3 0x55555554 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
is there a method to have a valid callstack without running program step by step ?
i use gdb over swd (texane st-link)
Alexandre
Re: callstack and _unhandled_exception
Posted: Tue Mar 26, 2013 11:45 am
by Giovanni
Hi,
GDB is able to backtrace but in that case the CPU jumped there directly because an exception, the exceptions stack is a whole different stack and it is not possible to know where the exception has been triggered by backtracing.
There are registers in the NVIC that can give you detailed info about the exception, you have to look there.
Giovanni
Re: callstack and _unhandled_exception
Posted: Tue Mar 26, 2013 1:31 pm
by Tectu
It's also worth to check the BusFault register of the core. It will tell you what exactly happened when there was a core-internal problem and from there the ways to procede split.
http://infocenter.arm.com/help/index.js ... 05s01.html~ Tectu
Re: callstack and _unhandled_exception
Posted: Tue Mar 26, 2013 2:55 pm
by alex31
thanks both of you for this precious information !
i will declare global variable to alias SCBBase, because gdb cannot handle define and is no able to interpret
print SCB_BFAR
Alexandre
Re: callstack and _unhandled_exception
Posted: Tue Mar 26, 2013 3:04 pm
by Giovanni
Good approach.
You could also redefine _unhandled_exception as a function and put code there to inspect the CPU status.
Giovanni
Re: callstack and _unhandled_exception
Posted: Fri Apr 04, 2014 2:41 pm
by chrismerck
Alexandre,
Wasn't it you who posted your _unhandled_exception() code here back in September?
http://forum.chibios.org/phpbb/viewtopic.php?uid=1176&f=16&t=1410&start=0 Was this approach not working for you?
-Chris