This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Code/stack tracing



When a task has been pre-empted, or has blocked, its current Program Counter must be stored somewhere, presumably on the stack. We would like to be able to extract this information, preferably in the field, but if this is too difficult, at least in the lab with an emulator connected to CCS. We would like to be able to see where each task was when it was last pre-empted, and how it got there.

I know that CCS is able to extract a stack trace for the current running task, but I have never been able to get a way to "unroll" the stack in the field to produce a stack trace for post mortem analysis, nor has anybody been able to give me a good reason why this can't be done.

The reason we need to be able to do this is that the “Abort” function (bios.SYS.ABORTFXN) has been entered, but there is no useful information available. We need to find out why this function is being called, so we would like to see what tasks were running recently, and where they were in their execution.

We are aware that the TSK_Handle for the task points to a structure that contains, amongst other thing, a Stack Pointer, but this is of little use if we can’t decode the stack.

 For a little background, our units reset in the field after they have been running for (almost exactly) 5 days.

This doesn’t happen in the lab.

We do have one set-up in the lab which more closely mimics the situation in the field, and which exhibits the problem, but this means that we need to make the absolute most use of this set-up, and so we would really We understand the differences at a functional level, but these translate to too many differences at the code level to be able to figure out what is happening in the code.

  • This looks like more of a BIOS issue than a compiler issue.  I'll move this thead to the BIOS forum.  In the meantime, one of the tips here might help out: http://processors.wiki.ti.com/index.php/DSP_BIOS_Debugging_Tips .

    Thanks and regards,

    -George

     

  • Can you tell me what version of BIOS you are using?

    And what chip and platform you are running on?

  • Stuart is on vacation this week.
    We are using DSP BIOS 5_33_06 on C6424
    And his previous post does contain one small mistake: the product crashes (and lands at sys_abort) both at the customer site and in the lab.
    We can inspect the product once sys_abort() has been hit. The kernel object view reports the state of each task, but not what its program counter is. We'd like to be able to get that information.
    Regards, Jeff

  • SYS_abort() will in turn call UTL_doAbort() and you can see that code in the file C:\Program Files\Texas Instruments\bios_5_33_06\packages\ti\bios\src\misc\utl_doab.c (if you installed in the default location).


    /*
     *  ======== UTL_doAbort ========
     */
    Void UTL_doAbort(String fmt, va_list ap)
    {
    #if UTL_USESYS
        SYS_vprintf(fmt, ap);
    #else
        LOG_error("SYS abort called with message '%s'", (Arg)fmt);
    #endif
        UTL_halt();
    }

    By default, a message will be written out with some error info, and you will want to take a look at this.  The messages will be written to the symbol SYS_PUTCBEG.  You may also be able to see it by opening the Execution Graph Detail window.  Yet another way to do this might be to put a breakpoint  on 'UTL_doAbort()' and look at 'A4' which should contain a string with a clue.

    I will be out for a week, but hopefully if you post more questions, others will pick it up.  Good luck.

  • Hi,
    Looks like we have our own abort function:

    bios.SYS.ERRORFXN = prog.extern("My_doError");
    bios.SYS.ABORTFXN = prog.extern("My_doAbort");
    bios.SYS.EXITFXN = prog.extern("My_doExit");

    And the source code is:
    void My_doAbort(String fmt, va_list ap)
    {
        
    char buffer[500];
        
    SYS_vprintf(fmt, ap);
        
    SYS_sprintf (buffer, fmt, ap);
    }

    But this really doesn't help any, as all the string says is "Run-time exception detected, aborting ..."

    What we'd like to do is understand better the information we can get from CCS once we've crashed and hit the breakpoint:

    ----

    We'd like to understand what the meaning of these fields are in the hopes that it can help us back-track to the cause.

  • You might be able to get that same information about TSK context using the TSK hook functions is DSP/BIOS.  These hook functions allows for setting  custom functions into the create, delete, exit switch, and ready phase of TSKs.  For more information on the TSK function hook, see the DSP/BIOS API Guide Section 2.32 - Task module  (http://www-s.ti.com/sc/techlit/spru403 )
     

    In summary, you'll need to configure your custom functions into the TSK hooks via the DSP/BIOS configuration.  By default the TSK hooks call FXN_F_nop function which currently does nothing.  You'll need to also enable the TSK hook function for switch and ready.  This can be done as follows in the configuration (*.tcf file):

    bios.TSK.CALLSWITCHFXN = 1;
    bios.TSK.CALLREADYFXN = 1;
    bios.TSK.SWITCHFXN = prog.extern("mySwithFucntion");
    bios.TSK.READYFXN = prog.extern("myReadyFunction");

    In these functions, you can opt to do any logging to allow you to adequately trace your program flow.  The TSK switch function signature will get you a handle to both the previous and current running TSK.

    There is an example of using the TSK switch hook function on the TI external wiki.

    http://processors.wiki.ti.com/index.php/DSP_BIOS_Debugging_Tips#Cause:__Stack_overflow (see How to diagnose (Method 2) in the Stack overflow section)

  • Hi,

    We were able to find our bug. By putting a breakpoint at _EXC_Dispatch, we identified the last running task, and that gave us a clue as to what the issue was.

    Regards,

    Jeff