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.

Finding the line-of-code with the error?

Dear Members,

I'm debugging an application written for AM335x using CCS. I know there is a bug in my code because every now and then when the application stops behaving as it should, I click the "suspend" button (the yellow pause button) in the Debug Window and I get 'No source available for "0x80035b28" '

Is there a way to figure out what line in my source code raised the error? I'm kind of new to the CCS environment and any help would be appreciated.

P.S. I'm using CCS v.5.3.0.00090.

Thanks

  • Hi,

    that simply means it was paused in the runtime library.  

    In order to debug you code I would recommend using

    - single stepping

    - breakpoints 

    http://processors.wiki.ti.com/index.php/Breakpoint

    You may also be interested in our training materials:

    http://processors.wiki.ti.com/index.php/Category:CCSv5_Training

    Best Regards,

    Lisa

  • Lisa,

    Thank you for your suggestions but single-stepping a firmware with a few thousand lines of code is cumbersome. Shouldn't there be another way to figure out which line of code is causing an exception (like in MS' Visual Studio)? 

    Is it a hardware limitation or a CCS limitation? I'm currently using "Blackhawk USB100v2" to debug my code; if I buy the top of the line "USB560 v2 System Trace", will it help me better debug my code?

    Thanks again,

  • Z Ha said:
    I'm debugging an application written for AM335x using CCS. I know there is a bug in my code because every now and then when the application stops behaving as it should, I click the "suspend" button (the yellow pause button) in the Debug Window and I get 'No source available for "0x80035b28" '

    Is there a way to figure out what line in my source code raised the error?

    The address 0x80035b28 is in the SDRAM address space of the AM335x, so is an expected address for the Cortex-A8 core to be executing code from.

    While the debug window may report "No source available for "0x80035b28"":

    1) Is there a stack backtrace shown? (in the [Code Composer Studio - Device Debugging] window)

    If a stack backtrace is shown does it show any functions from your program, and can you select the different functions in the stack backtrace to identify where the program "got stuck"?

    2) In the Linker .map file in the CCS project, is the address 0x80035b28 in-between the address of any other functions in the .map file?

    This should give a clue if the program is in an expected function in your project, or has "crashed" and jumped to an invalid program address.

  • Chester,

    First of all, thanks for looking into my problem. Now to answer your questions,

    1) The stack backtrace only shows "no symbols are defined for 0x80035b28" which is making it impossible to figure out the function causing the crash.

    2) and No the address 0x80035b28 is not in-between the addresses of any other functions.


    but here's what the Diassembler is showing at that specific address:
    80035b28: loop0+0                EAFFFFFE B               loop0
     43                                                { /* compute ceil(x) */


    I'm suspecting there's a memory exception crashing the application and jumping to an infinite loop.


    Any other suggestions/pointers that'll help me figure out what function (or line of code) is causing the crash?
    Thanks Again!

  • Z Ha said:
    Any other suggestions/pointers that'll help me figure out what function (or line of code) is causing the crash?

    Can you provide a screen dump of the CCS debugger when stuck in that loop, with the dis-assembly and core registers displayed to try and give more context to the error.

    Some other questions:

    1) Which compiler version is being used?

    2) Is this a "bare metal" application using only your own code and the compiler run time library, or is a RTOS such as SYS/BIOS in use?

    3) Can you post the linker .map file for the project?

  • Chester,

    Attached is a screen dump and the linker.map file. To answer your questions:

    1) I'm using TI v.5.0.1

    2) No RTOS is being used. Everything is our code with the help of libraries from Starterware

    3) attached.

    I didn't want to drag you (or anyone else) into helping me debug my own application. I was hoping there is a way in CCS, like in Visual Studio, that clearly shows where the crash is. Anyway, thanks for helping me out and hope it points me in the right direction.

    Regards

  • Z Ha said:
    Attached is a screen dump and the linker map file

    The linker map file seems out of step with the executable being debugged (since the symbols addresses in the linker map file don't match those shown in the debugger screen shot).

    From the debugger screen shot the program has encountered either a Prefetch Abort, Data Abort or Undefined Instruction exception. This is because the program counter  has got to the following loop0 within the StarterWare exceptionhandler.asm source file:

    ;******************************************************************************
    ;*             Function Definition of Abort/Undef Handler
    ;******************************************************************************    
    ;
    ; The Abort handler goes to the C handler of abort mode. Note that the undefined
    ; instruction is not handled separately.
    ; if nothing is done in the abort mode, the execution enters infinite loop.
    ;
    AbortHandler:
    UndefInstHandler:
    ;
    ; Disable all the interrupts
    ;
            MRS     r0, cpsr                  ; Read from CPSR
            ORR     r0, r0, #0xC0             ; Clear the IRQ and FIQ bits    
            MSR     cpsr_c, r0                ; Write to CPSR
            ADD     r14, pc, #0               ; Store the return address
            LDR     pc, _CPUAbortHandler      ; Go to C handler
    ;
    ; Go to infinite loop if returned from C handler
    ;
    loop0:
            B       loop0                      
    

    StarterWare doesn't taken any action on these exceptions except to enter an infinite loop.

    See http://e2e.ti.com/support/development_tools/code_composer_studio/f/81/t/259587.aspx and http://e2e.ti.com/support/development_tools/code_composer_studio/f/81/t/315454.aspx for some some ideas on how to debug the cause of the exception.

  • Thanks again Chester. I found the bug and as I suspected it had to do with memory allocation. 

  • Z Ha said:
    Is there a way to figure out what line in my source code raised the error?

    I haven't had a chance to try, but the Embedded Trace Buffer in the AM335x may be used to produce a trace of the program flow leading up to an exception.

  • Hi Z Ha,  i am facing abosullty the same probelm as you were in few months back.Could you explain me, how did you fix it?

     

    thanks in advance

     

    terrance

     

  • Terrance,

    All I did was displaying excess messages over UART until I narrowed down on the few lines of code that were causing the problem. It's not an ideal solution but it did the job.

  • Hi Ha,  Thanks for yoru response. I just import demo project in CCS and run vis XDS100v2 USB

    1. It runs ok

    then add  

    struct tcp_pcb * pcb;

      ip_addr_t ip_addr_dest, ip_addr_client;   

    err_t status;

        pcb =tcp_new();

        IP4_ADDR(&ip_addr_client, 10,1,36,06);

        IP4_ADDR(&ip_addr_dest, 10,1,36,62);

        status =tcp_bind(pcb, &ip_addr_client, 20003);

       if(status != ERR_OK)

    tcp_arg(pcb, NULL);

        status =tcp_connect(pcb,&ip_addr_dest,20003,tcp_client_connected);

    before while(1), then put a brake point at tcp_bind(), it jump into exception handler. I increase my heap size to 0x4000 but still sampe probelm.

    any help will be appriciate?