cancel
Showing results for 
Search instead for 
Did you mean: 

unwind stack STM32H7 Free RTOS

DCorn
Associate III

Hi

I would like to store the call stack when the STM32H7 crashes. I implemented unwind.h

The code works on a bare metal  simple est code but not with   FreeRTOS is running

Any idea as to why?

 

DCorn_0-1720086462291.png

 

The code

 

 

static uint16_t CallStackAddr;

CALLSTACK_DATA uint32_t Address[MaxCallDepth];

 

_Unwind_Reason_Code trace_func(struct _Unwind_Context *context, void *arg)

{

void *ip = (void *)_Unwind_GetIP(context);

 

Address[CallStackAddr] = (uint32_t) ip;

if(CallStackAddr < MaxCallDepth)

{

CallStackAddr++;

}

 

return _URC_NO_REASON;

}

 

void GetTrace(void)

{

__disable_irq();

 

_Unwind_Reason_Code ret = _Unwind_Backtrace((_Unwind_Trace_Fn)&trace_func, NULL);

 

Address[CallStackAddr] = 0xF0F0F0F0;

}

1 REPLY 1
SofLit
ST Employee

Dear @DCorn ,

Please review these recommendations on how to post a thread in this community mainly on how to share the code.
Thank you for your understanding.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.