my system has sporadic hard faults, this means, working over night, or crashes within minutes and all between.
I use the suggested code:
void prvGetRegistersFromStack( uint32_t pulFaultStackAddress )
/ These are volatile to try and prevent the compiler/linker optimising them
away as the variables never actually get used. If the debugger won’t show the
values of the variables, make them global my moving their declaration outside
of this function. /
volatile uint32_t r0;
volatile uint32_t r1;
volatile uint32_t r2;
volatile uint32_t r3;
volatile uint32_t r12;
volatile uint32_t lr; / Link register. /
volatile uint32_t pc; / Program counter. /
volatile uint32_t psr;/ Program status register. */
r0 = pulFaultStackAddress[ 0 ]; r1 = pulFaultStackAddress[ 1 ]; r2 = pulFaultStackAddress[ 2 ]; r3 = pulFaultStackAddress[ 3 ]; r12 = pulFaultStackAddress[ 4 ]; lr = pulFaultStackAddress[ 5 ]; pc = pulFaultStackAddress[ 6 ]; psr = pulFaultStackAddress[ 7 ]; /* When the following line is hit, the variables contain the register values. */ for( ;; );
Now I need some help to analyse the reason for the crash. All registers except psr were 0. Even pc is 0.
Any idea how to get closer to the problem?
Thanks again for helping.
With best regards