Skip to main content
Visitor II
July 4, 2024
Question

unwind stack STM32H7 Free RTOS

  • July 4, 2024
  • 1 reply
  • 853 views

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;

}

    This topic has been closed for replies.

    1 reply

    Technical Moderator
    July 4, 2024

    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.