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.

CCS/EVMK2H: Code section causes DSP to run into endless loop

Part Number: EVMK2H

Tool/software: Code Composer Studio

Hi,

Recently, I update my dsp code for adding some variable to debug watch,but I find that when dsp run the new code , it will go to dead loop in assembly code

I write code by C ,working on the 66AK2H14  in EVMK2H.   Using CCS 7.3.

It should not  go into dead loop. But I used XDS Pro Emulator to debug , and find code run into dead loop of assembly code.

Here is what  I see in CCS

The function where dead loop is

The code cause dead loop

DSP will  hold  when execute  this line of code ,I  check assembly code  and find it go into dead loop

It always execute this there assembly code, and dsp will hold.

When I  change the name of code section ,code  won't go into dead loop and dsp keep running.

assembly code change

But "ramisr" and "runfastram" code section are in the same memory ,defferent name.

MEMORY{

...................

dsp_L2_ram:       o = 0x00800C00  l = 0x0006F400

.................

}

runfastram : > dsp_L2_ram

ramisr : > dsp_L2_ram

Question:

1,I don't know why assembly code will create dead loop.I don't create any loop in my C code.

2, Why different name of code section will cause different assembly code?

If anyone know anything  ,please tell me .Thanks very much

Best Regards

 

  • The picture don't show ,so I put these again.Sorry

    Here is what  I see in CCS

    The function where dead loop is

    The code cause dead loop

  • DSP will  hold  when execute  this line of code ,I  check assembly code  and find it go into dead loop

    It always execute this there assembly code, and dsp will hold.

    When I  change the name of code section ,code  won't go into dead loop and dsp keep running.

    assembly code change

    But "ramisr" and "runfastram" code section are in the same memory ,defferent name.

    MEMORY{

    ...................

    dsp_L2_ram:       o = 0x00800C00  l = 0x0006F400

    .................

    }

    runfastram : > dsp_L2_ram

    ramisr : > dsp_L2_ram

    Question:

    1,I don't know why assembly code will create dead loop.I don't create any loop in my C code.

    2, Why different name of code section will cause different assembly code?

    If anyone know anything  ,please tell me .Thanks very much

  • I try my code in CCS 8.3 .It still has same problem.DSP will go into dead loop .
    When I change name of code section .It will be right
    I was very confused about that in week,So anyone has any advise or tips,please let me know .
    Thanks very much
  • Hi,

    Whish Processor SDK RTOS example are you running (changing?)?
    Also can you share your linker.cmd & the .cfg files in your project? Maybe there is something wrong with the configuration of your project.

    Best Regards,
    Yordan
  • Hi,Yordan

    I don't change Proceesor SDK.I always use   ti-processor-sdk-rtos-k2hk-evm-04.01.00.06

    Here is my linker .cmd

    Jacky_Linker.zip

    And I didn't see .cfg files in my project. I used to change configure in CCS .Maybe can you show me how to get .cfg file?

    Thanks for reply again.

    Best Regards,

    Jacky

  • Hi Jacky,

    The .cfg file should be part of the project (as in the Processor SDK RTOS examples), see the screenshot bellow:

    Best Regards,
    Yordan

  • Hi , Yordan

    I search my project again.and other example of EVMK2H. I could not find .cfg file .

    I saw your example is running SYSBIOS .Does  only SYSBIOS create the .cfg file ?

    My project didn't run OS on DSP. But if you want other configure of CCS, I would share with you as possible as I could.

    Best Regards

    Jacky

  • Hi,

    Apologies for the late reply.

    I saw your example is running SYSBIOS .Does only SYSBIOS create the .cfg file ?

    My project didn't run OS on DSP. But if you want other configure of CCS, I would share with you as possible as I could.


    That's ok.

    I've checked the linker.cmd file and don't see anything odd. As an example have you tried placing ramisr in different memory (not dsp_L2_ram, but let's say external_ram .

    Also note that ARM does not work well with memory spaces of DDR3B (DDR3B is dedicated mainly for DSP) so beware of that.

    Best Regards,
    Yordan
  • Hi,Yordan

    Thanks for reply.I will try place "ramisr" in external_ram memrory.

    I just don't know why cause different assembly code.

    I am worried about next time I add other code , and it will create other dead loop.

    Do you know some ways or tools to see how CCS create assembly executed code?So I could trace why it happen.

    Best Regards

    Jacky

  • Hi Jacky,

    Let me consult the design team about this issue.

    Best Regards,
    Yordan
  • Hi,Yordan

    Thanks for your help. I will wait for your reply.

    Best Regards

    Jacky

  • Jacky.

    We have looped the DSP compiler experts to comment on this behavior observed using code generated from the compiler. Could you in the meantime provide the compiler version and the flags that you have used for compilation of this code. Also is the code section the only thing that you modified to observe the difference in assembly code generated?

    Our compiler champs might also be interested in the two .asm files in the working and the non-working case to analyze this issue.

    Regards,
    Rahul
  • Hi,Rahul

    I try my code in v8.1.3 compiler version

    And the code section is the only thing I modifed

    Thanks for analyze this issue for me .I am confused about that in a long time

    If you have any advise or need other about my setting, please let me know.

    Best Regards

    Jacky

  • JackyXiaodong said:
    DSP will  hold  when execute  this line of code ,I  check assembly code  and find it go into dead loop

    In the quoted post, this line is followed by a picture which shows disassembly similar to this ...

    00828aa2:    CMPGT.L2    0,B4,B0
    00828aa4:    BNOP.S1     0x828aa2,4

    Note the the destination of the BNOP is the previous instruction.  Thus program control never leaves this code.  

    I would like to know when this bad BNOP instruction first appears.  Please put the project in the state where this endless loop occurs.  Then disassemble the final executable .out file.  Capture that in a text file and attach it to your next post.

    The disassembler is a command line utility named dis6x.  It is in the same directory as the compiler cl6x.  A typical location is ...

    C:\ti\ccsv8\tools\compiler\ti-cgt-c6000_8.3.3\bin\dis6x.exe

    In a command line shell, go to the directory which contains the final executable .out file, and run a command similar to ...

    C:\my\project>dis6x file.out > disassembly.txt 

    Then attach the file disassembly.txt to your next post.

    I need to address an unrelated topic.  It is very rare for me to point out errors in English in these posts.  I admire customers who work so hard to describe their problems in a language so odd as English.  However, you made one mistake which confused me a great deal.  So I hope you don't mind me pointing it out.  We say this situation is an endless loop.  Not a death loop, or a dead loop.  (Sometimes you might see infinite loop.  But endless loop is more common.)  

    Thanks and regards,

    -George

  • George Mock said:
    We say this situation is an endless loop.  Not a death loop, or a dead loop.

    To be fair to the original poster, I have seen the term "dead loop" used in some TI documentation. E.g. in the Device Initialization by ROM Code section of the AM572x TRM:

    George Mock said:
    I would like to know when this bad BNOP instruction first appears.

    It would also be worth comparing the disassembly reported in the CCS debugger against the disassembly of the .out file, in case the code in memory on the target has been overwritten (as opposed to say the compiler generating incorrect instructions).

  • Hi ,George

    I got the disassemble file,and capture where endless loop occurs.

    Here is the txt file

    AssemblyCode.txt
    00828a50             $C$L300:
    00828a50       8e41           ADD.L2        B4,-4,B4
    00828a52       124d           LDH.D2T2      *B4[0],B4
    00828a54   01c52428           MVK.S1        0xffff8a48,A3
    00828a58   018040e8           MVKH.S1       0x810000,A3
    00828a5c   e2830000           .fphead       n, l, W, H, nobr, nosat, 0010100b
    00828a60       2c6e           NOP           2
    00828a62       5227           CMPGT.L2      0,B4,B0
    00828a64   30148120    [!B0]  BNOP.S1       $C$L301 (PC+40 = 0x00828a88),4
    00828a68   0204a35a           MVK.L2        1,B4
    00828a6c   000c0264           LDW.D1T1      *+A3[0],A0
    00828a70       95d1           ADD.L2X       A3,4,B5
    00828a72       4c6e           NOP           3
    00828a74       a53a    [!A0]  BNOP.S1       $C$L301 (PC+40 = 0x00828a88),5
    00828a76       10dd           LDW.D2T2      *B5[0],B5
    00828a78   018c0264 ||        LDW.D1T1      *+A3[0],A3
    00828a7c   e6208800           .fphead       n, l, W, BU, br, nosat, 0110001b
    00828a80       6c6e           NOP           4
    00828a82       bdc9           CMPLTU.L2X    B5,A3,B0
    00828a84   3016a120    [!B0]  BNOP.S1       $C$L302 (PC+44 = 0x00828aac),5
    00828a88             $C$L301:
    00828a88   02815b6e           LDW.D2T2      *+B14[347],B5
    00828a8c   0345222a           MVK.S2        0xffff8a44,B6
    00828a90   030040ea           MVKH.S2       0x810000,B6
    00828a94       136d           LDH.D2T2      *B6[0],B6
    00828a96       0c6e           NOP           1
    00828a98       32dd           LDH.D2T2      *B5[1],B5
    00828a9a       6c6e           NOP           4
    00828a9c   ec230000           .fphead       n, l, W, H, nobr, nosat, 1100001b
    00828aa0   0014ca7a           CMPEQ.L2      B6,B5,B0
    00828aa4   2006a120    [ B0]  BNOP.S1       $C$L302 (PC+12 = 0x00828aac),5
    00828aa8   0200a35a           MVK.L2        0,B4
    00828aac             $C$L302:
    00828aac   0281926e           LDW.D2T2      *+B14[402],B5
    00828ab0   02148ffa           OR.L2         B4,B5,B4
    00828ab4   0201927e           STW.D2T2      B4,*+B14[402]

    00828aa0   0014ca7a           CMPEQ.L2      B6,B5,B0
    00828aa4   2006a120    [ B0]  BNOP.S1       $C$L302 (PC+12 = 0x00828aac),5
    00828aa8   0200a35a           MVK.L2        0,B4

    It seems that it is ok. But I use my XDS pro to trace again. The endless loop still happen

    Here is the part I get from the Disassembly window

    Disassembly_window.txt
    2160                  stop_condition |= ((SectorRwControl.stop_sector < 0) && (SectorRwControl.stop_count != 0)
              $C$L300:
    00828a50:   8E41                ADD.L2        B4,-4,B4
    00828a52:   124D                LDH.D2T2      *B4[0],B4
    00828a54:   01C52428            MVK.S1        0xffff8a48,A3
    00828a58:   018040E8            MVKH.S1       0x810000,A3
    00828a5c:   E2830000            .fphead       n, l, W, H, nobr, nosat, 0010100b
    00828a60:   2C6E                NOP           2
    00828a62:   5227                CMPGT.L2      0,B4,B0
    00828a64:   30148120     [!B0]  BNOP.S1       $C$L301 (PC+40 = 0x00828a88),4
    00828a68:   0204A35A            MVK.L2        1,B4
    00828a6c:   000C0264            LDW.D1T1      *+A3[0],A0
    00828a70:   95D1                ADD.L2X       A3,4,B5
    00828a72:   4C6E                NOP           3
    00828a74:   A53A         [!A0]  BNOP.S1       $C$L301 (PC+40 = 0x00828a88),5
    00828a76:   10DD                LDW.D2T2      *B5[0],B5
    00828a78:   018C0264 ||         LDW.D1T1      *+A3[0],A3
    00828a7c:   E6208800            .fphead       n, l, W, BU, br, nosat, 0110001b
    00828a80:   6C6E                NOP           4
    00828a82:   BDC9                CMPLTU.L2X    B5,A3,B0
    00828a84:   3016A120     [!B0]  BNOP.S1       $C$L302 (PC+44 = 0x00828aac),5
              $C$L301:
    00828a88:   02815B6E            LDW.D2T2      *+B14[347],B5
    00828a8c:   0345222A            MVK.S2        0xffff8a44,B6
    00828a90:   030040EA            MVKH.S2       0x810000,B6
    00828a94:   136D                LDH.D2T2      *B6[0],B6
    00828a96:   0C6E                NOP           1
    00828a98:   32DD                LDH.D2T2      *B5[1],B5
    00828a9a:   6C6E                NOP           4
    00828a9c:   EC230000            .fphead       n, l, W, H, nobr, nosat, 1100001b
    00828aa0:   0014CA7A            CMPEQ.L2      B6,B5,B0
    00828aa4:   0001A120            BNOP.S1       0x828aa2,5
    00828aa8:   0200A35A            MVK.L2        0,B4
              $C$L302:
    00828aac:   0281926E            LDW.D2T2      *+B14[402],B5
    00828ab0:   02148FFA            OR.L2         B4,B5,B4
    00828ab4:   0201927E            STW.D2T2      B4,*+B14[402]

    Besides,I did compile my code again but not change any code . I don't know why

    00828aa2:    CMPGT.L2    0,B4,B0

    Change to

    00828aa0:    CMPEQ.L2    B6,B5,B0

    But it still run into endless loop

    It doesn't matter that you point out my mistake in my English. It is good to use common way to describe

    If you have any concern, please tell me freely

    Thanks for reply and Best Regards

    Jacky 

  • Hi,
    Thanks for point out description of TI documentation. I don't know the term "dead loop" in document before.
    I also capture part of debugger XDS pro Disassemble window
    Disassembly_window.txt in my previous post
  • JackyXiaodong said:
    I also capture part of debugger XDS pro Disassemble window
    Disassembly_window.txt in my previous post

    The contents of AssemblyCode.txt from the disassembled executable contains the following which looks sensible:

    00828aa0   0014ca7a           CMPEQ.L2      B6,B5,B0
    00828aa4   2006a120    [ B0]  BNOP.S1       $C$L302 (PC+12 = 0x00828aac),5
    00828aa8   0200a35a           MVK.L2        0,B4
    00828aac             $C$L302:
    00828aac   0281926e           LDW.D2T2      *+B14[402],B5

    Whereas the Disassembly_window.txt output from the debugger shows the instructions at address 00828aa4 is different:

    00828aa0:   0014CA7A            CMPEQ.L2      B6,B5,B0
    00828aa4:   0001A120            BNOP.S1       0x828aa2,5
    00828aa8:   0200A35A            MVK.L2        0,B4
              $C$L302:
    00828aac:   0281926E            LDW.D2T2      *+B14[402],B5

    I.e. while the address 00828aa4 should have the contents 2006a120 from the executable, the actual value of that address on the target is 0001A120. It is possible that the address 00828aa4 is being overwritten by something in the program. Can you try:

    a. Download the program.

    b. Check the contents of the 00828aa4 in the debugger disassembly view after downloading the program to see if it is correct after the program has been downloaded.

    c. Set a watchpoint to trigger on a write to address 00828aa4.

    d. Run the program. If something in the program is overwriting address 00828aa4, the watchpoint should trap where the overwrite is coming from.

  • Hi, Chester

             Thanks for reply, It is a good advise .But I have something odd in my disassembly window

    I try your way to debug my program.

    I set my breakpoint, check 00828aa4 in the disassembly window after downloading the program .It seems to be right.

    But when I run my code, my program stop at the  00828aa4 again.And I check my disassembly view .The content of 00828aa4  is not changed.

    It is so odd. My program still stop at the 00828aa4.

    Do you see this odd issue before?

    I feel confused and I try several time.I still have some issue

    Maybe something cause my dissembly view doesn't display message on real time?

    Best Regards

    Jacky

  • JackyXiaodong said:
    My program still stop at the 00828aa4.

    The screen shot of the Breakpoints view that a breakpoint has been set at address 0x00828aa4, which stops the program when attempting to execute at that address.

    Since the problem might be caused by the instruction at that address being overwritten by the running program need to set a Hardware Watchpoint for writes to that address. To do that, after downloading the program right click in the Breakpoints view and select Breakpoint (Code Composer Studio) -> Hardware Watchpoint. In the Hardware Watchpoint dialogue:

    a. Set the location to 0x00828aa4

    b. Set the memory to Write.

  • Hi, Chester

    I try as you say. But I have two situation  when I set hardware watchpoint and locate the memory of 0x00828aa4

    First, the content of 0x00828aa4 is correct. But it seems to run into the same endless loop

    And I try some assembly step into. CCS print error message and stop

    Second,when I run my code ,my program can't be started. And program stop the area I don't know.

    So I think  maybe some content cross over the border of memory and cause damage and modification.

    Could the CCS have some tool to catch overflow? Or do you have any idea about that?

    Best Regards

    Jacky 

  • Hi,George

    Do you have methods to get all assembly code in Dissembly window?

    I only can get a little part.

    So I can compare that with dissemble code which generated from .out file. 

    To figure out that  are there  others content of address also being changed  when running my program.

    Thanks and Best Regards

    Jacky

  • Hi, Chester

    Thanks for your advise .You are correct that address 00828aa4 is being overwritten by something in my program.

    I couldn't find what change contents of  the address 00828aa4 when using hardware watchpoint.

    But I monitor the address 00828aa4 on Memory Brower and run program step by step .

    I found the pointer of a array did change the content of  address 00828aa4

    Thanks

    Best Regards

    Jacky

  • Hi, George

    Thanks for your help .

    And I found the pointer of a array did overwrite the content of  address 00828aa4.

    Thanks

    Best Regards

    Jacky