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/TMS320F28374S: Compiler related issue on "If condition comparision"

Part Number: TMS320F28374S

Tool/software: Code Composer Studio

In the attached screenshot, deltaSpeed, deltaSpeedLimit values can be shown in the expression window. 

In the sw, in "If conition", even the  deltaSpeed is less than the deltaSpeedLimit  value but still break point is coming into inside the if condition. May I know the reason for it.

Is there any problem with the break point?

Current CCS version is : 6.1.0.00104

Current compiler verion is : TI v6.4.2

  • The compiler probably issued a conditional MOV (or MOVB) instruction to implement the source line ...

    encoderfaulty[0] = 1;

    If that is the case, no conditional branch is present.  It is possible to breakpoint at such an instruction, yet due to the condition, the MOV does not occur.

    Thanks and regards,

    -George

  • Hi,
    Thanks for the immediate reply, I did not get what you have written, can you explain in detail?
    Sorry for the inconvenience.
  • Please consider this example code ...

    /* file.c */
    
    extern int array[];
    
    void fxn(int arg1, int arg2)
    {
       if (arg1 > arg2)
       {
          array[0] = 1;
       }
    }

    Build it ...

    cl2000 --src_interlist --opt_level=4 file.c

    The option --src_interlist causes the compiler to keep (not delete) file.asm, which contains the compiler generated assembly code.  The option --opt_level=4 says to optimize at level 4, the highest level.  Inspect file.asm to find these instructions are the core of the function ...

            CMP       AH,AL                 ; [CPU_ALU] |7|
            MOVW      DP,#_array            ; [CPU_ARAU]
            MOVB      @_array,#1,LT         ; [CPU_ALU] |9|
            LRETR     ; [CPU_ALU]

    Note there is no conditional branch.  The third instruction is a conditional MOVB.  If the condition LT is met, then the MOVB occurs.  Otherwise, nothing occurs.  Note the instruction always executes.  Whether the memory location changes depends on the condition.  Now, suppose a breakpoint is set on the MOVB.  Reaching that breakpoint does not mean the memory location is changed.  That depends on the condition.

    Thanks and regards,

    -George