This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Running function stack trace

Hi,Master:

question:
When the finished product cannot be debugged with jlink, I want to save and trace the function stack information through the firmware. When there are some accidental exceptions, I need to use the function stack to more delicately locate the problem.

My way of implementation:

foo_1 ()
{
    FUNC_TRACK_PUSH (foo_1);    // Push the function address into the stack structure

    ...// dosome thing

    FUNC_TRACK_POP (foo_1);     // Pop this function address from the stack structure
}

foo_2 ()
{
    FUNC_TRACK_PUSH (foo_2);    

    ...// dosome thing

    FUNC_TRACK_POP (foo_2);     
}

.
.
.

foo_x ()
{
    FUNC_TRACK_PUSH (foo_x);    

    ...// dosome thing

    FUNC_TRACK_POP (foo_x);     
}

Disadvantages:
This FUNC_TRACK_PUSH / FUNC_TRACK_POP macro must be added to the entrance and exit of all functions to record the current function stack call, which is cumbersome and inelegant.Is there another more beautiful way to achieve it?

Forgive me for poor English. Thank you!
regards