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
callstack and _unhandled_exception
Moderators: RoccoMarco, lbednarz, tfAteba
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: callstack and _unhandled_exception
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
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
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
http://infocenter.arm.com/help/index.js ... 05s01.html
~ Tectu
Re: callstack and _unhandled_exception
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
i will declare global variable to alias SCBBase, because gdb cannot handle define and is no able to interpret
print SCB_BFAR
Alexandre
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: callstack and _unhandled_exception
Good approach.
You could also redefine _unhandled_exception as a function and put code there to inspect the CPU status.
Giovanni
You could also redefine _unhandled_exception as a function and put code there to inspect the CPU status.
Giovanni
-
chrismerck
- Posts: 21
- Joined: Fri Mar 14, 2014 12:35 am
- Been thanked: 4 times
Re: callstack and _unhandled_exception
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
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