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.

how to backtrace in bios6 by C programming

Other Parts Discussed in Thread: SYSBIOS

Hi, all!

We are using DVRRDK_04.00.00.03 and TI8168.

I found Crash_Dump_Analysis doesn't work before completion of sys initilization,
so I have the following question:

By now, are there any functions like backtrace in linux,
which we could use to get call stack in bios6, and print manually by C programming?
Just like function SIGSEGV_handler in demos/mcfw_api_demos/mcfw_demo/demo.c.

Thanks!

  • There is no library for getting backtrace on M3. The M3 doesn't have access to its own  DWARF debug info which can be used by libelf to create symbolic info for backtrace.Due to this any backtrace you get will not be accurate.Only an offline CCS crash dump analyzer which has access to PC/SP as well as symbolic debug info can get reasonable backtrace info.

    If you want to pursue stack unwinding below code was provided by Alan Demars from sysbios team for experimental purpose.It gives reasonable backtrace .It is based on http://www.mcternan.me.uk/ArmStackUnwinding/

    Note that this unwind code is not supported and will not work in several cases.

    Add all of the attached files to your project, then add the following to one of your application C files:
     
     #include <ti/sysbios/family/arm/m3/Hwi.h>
     
     extern Void Unwind(Int32 spValue, Int32 lr, Int32 pc);
     
     Void myExcHook(Hwi_ExcContext *excp)
     {
         Unwind((Int32)excp->sp, (Int32)excp->lr, (Int32)excp->pc);
     }
    And add this to your config file:
     
     var m3Hwi = xdc.useModule('ti.sysbios.family.arm.m3.Hwi');
     m3Hwi.excHook = '&myExcHook';
     
    When an exception occurs, you should get a stack back trace something like this embedded in the exception dump:
     
     Begin stack back trace...
     PC: 0x00001234
     Called from: 0x00008596
     Called from: 0x0000859e
     Called from: 0x0000858e
     Called from: 0x00006fa0
     Called from: 0x00007b52
     Called from: 0x000040a8
     End of stack back trace...

    You will then have to use nm470 or map file to map these addresses to functions.

    4162.unwind.zip