Debug -> Trace function that generate the error

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Debug -> Trace function that generate the error

Jump to solution
1,631 Views
ypkdani
Contributor III

Hello i have the MCUXpresso 10.0.2 and i have to trace the function that generate the hard fault but using my segger j-link i can see only the last 4 functions called:

pastedImage_2.png

how i can increase the tree for see the function at lower level?

0 Kudos
1 Solution
1,342 Views
ypkdani
Contributor III

Solved, 

i didn't free memory after a malloc.

View solution in original post

4 Replies
1,343 Views
ypkdani
Contributor III

Solved, 

i didn't free memory after a malloc.

1,342 Views
BlackNight
NXP Employee
NXP Employee

Your stack trace might not necessarily show the truth, as the hard fault could be caused by some stack corruption too.

It seems that your hard fault was caused during a context switch in FreeRTOS.

I would set a breakpoint in xPortStartScheduler() and step through the code to see what is happening. It could be that your stack runs into FLASH/ROM code?

If you want to see if other theads/tasks are running, have a  read at Troubleshooting Tips for FreeRTOS Thread Aware Debugging in Eclipse | MCU on Eclipse  which provides some checkpoints.

As for the hardfault itself, you could install a custom handler which reports you the last PC/access point (see that interrrupt handler at the end of Debugging Hard Faults on ARM Cortex-M | MCU on Eclipse ).

I hope this helps,

Erich

0 Kudos
1,342 Views
ypkdani
Contributor III

Hello,

i have already tryed but the Thread Aware crash when i stop the debugger with this error, it say Ignoring Packet Error, continue...

I have update the segger driver but nothing.

I can debug without the Thread Aware enable but i can only see this

pastedImage_1.png

pastedImage_2.png

Thanks

0 Kudos
1,342 Views
ypkdani
Contributor III

I have tried to understand watching the CFSR register. It has the value 0x400 so i have an INVPC error.
What can generate this error in the code?

Thanks

0 Kudos