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.

Linux/TDA2SX: How to debug spl code after relocate

Part Number: TDA2SX


Tool/software: Linux

Dear ti,

With the help of , I can now debug C code in the spl image before relocate. i.e. the board_init_f part.

After that spl relocate itself to 0x82000000 by the function call spl_relocate_stack_gd as:

Then i cannot step into board_init_r part after this operation.

I have tried to load symbol with the 'code offset' & 'data offset' filled with 0x82000000 and then set hardware breakpoint at the entry of function board_init_r.

But it would not stop at the breakpoint. It seem that the relocate address is wrong. I got no souce files available in the ccs.

How should i solve this?

Regards,

Liu Gan

  • Hi Liu,

    Do you have access to CCS? If yes you can halt on the first instruction of SPL (in "arch/arm/cpu/armv7/start.S" by looping in the reset function) and step through the code. You can then load the symbols add the necessary breakpoints and then step out of the reset function, following which the code will halt at the necessary function.

    Regards

    Shravan

  • Hi, Shravan

    Yes i have access to CCS. And the code can start execute from the entry reset. But then it will stop at v7_arch_cp15_set_l2aux_ctrl so that the debug process cannot continue. I descirbed this in this link. 

    Then i try to dodge this problem by enable the call to wait_for_debugger() in board_init_f() in the file arch/arm/cpu/armv7/omap-common/hwinit-common.c.
    After that i can debug the code between boart_init_f and spl_relocate_stack_gd.

    In my opinion, the spl code was been relocate after the spl_relocate_stack_gd. That's why i can't continue step over the remain code.

    So, my question is how to debug the code after the relocation operation.i.e. the board_init_r() function call.

    Regards,

    Liu Gan

  • Hi Shravan,

    I solved this problem by enable the call to wait_for_debugger() in spl_board_init() instead of in board_init_r(). Then i load spl/u-boot-spl without the code offset and data offset being set.After that i can debug step by step the code start from spl_board_init().

    But i am still confused of how this could be work. So i got another two questions to confirm.

    1. Does the spl relocate itself after call the function spl_relocate_stack_gd or just the gd structure been relocated to DDR?

    2. What's the difference in calling the wait_for_debugger() from the board_init_r() and spl_board_init()?

    More information if you need, please let me know.

    Regards,

    Liu Gan

  • Hi Liu,

    1. Yes, there is relocation of the binary to DDR which happens. Specifically this happens in the mem_malloc_init function present in board_init_r.

    2. The code should halt in SRAM too, however, when you halt at spl_board_init, the code is executing from DDR. 

    Can you work off halting in DDR with spl_board_init.

    Regards

    Shravan

  • Hi Shravan,

    I have double checked question 2: What's the difference in calling the wait_for_debugger() from the board_init_r() and spl_board_init()?

    Hear is some details:

    1. My program can be halt at the funtion wait_for_debugger() if i call it from the entry of board_init_r().

    2. I can debug the code if i modify ccs_dbg_flag to 0 in the CCS expressions window. But the CCS has no respone once the infinite loop is exit.It just stoped at the end of the function no matter i try to step in or step over.

    Regards,

    Liu Gan

  • Hi Shravan,

    I can debug all the spl code now.

    Thanks for your help!

    Regards,

    Liu Gan