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.

TMS320F280049: C compiler for a while loop.

Part Number: TMS320F280049
Other Parts Discussed in Thread: SYSCONFIG, C2000WARE

Tool/software:

Hello everyone,

i have a question with C compiler, i m using f280049 and compiler TI v.22.6.1. I have simple while loop:

// .. 
int myFlag = 0;
// ..
while (!myFlag) NOP;

// .. other code

the disassembly is:

105         while (!myFlag) NOP;
        C$L1:
008a86:   761F02AD    MOVW         DP, #0x2ad
008a88:   9211        MOV          AL, @0x11
008a89:   6004        SB           C$L3, NEQ
        C$L2:
008a8a:   7700        NOP          
008a8b:   5200        CMPB         AL, #0x0
008a8c:   61FE        SB           C$L2, EQ

the problem is that, when myFlag becames 1, set in an interrupt routine, the while loop does not break, and continue looping.

In the disassembled code i see that once the value of myFlag has been loaded into AL ( istructions from C$L1 to C$L2), it will never be reloaded, and the loop below C$L2 never exits.

What am i missing?? What i what is something like:

while(1) {
  if (myFlag) break;
}

my compiler options are:

-v28 -ml -mt --cla_support=cla2 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu0 --opt_for_speed=5 --include_path="C:/DE/PROGETTI/DE1240/software" --include_path="C:/DE/PROGETTI/DE1240/software/sysconfig" --include_path="C:/ti/c2000/C2000Ware_5_01_00_00/driverlib/f28004x/driverlib" --include_path="C:/ti/c2000/C2000Ware_5_01_00_00/device_support/f28004x/common/include" --include_path="C:/ti/c2000/C2000Ware_5_01_00_00/driverlib/f28004x/driverlib/inc" --include_path="C:/ti/c2000/C2000Ware_5_01_00_00/device_support/f28004x/headers/include" --include_path="C:/ti/ccs1230/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --include_path="C:/ti/c2000/C2000Ware_5_01_00_00/driverlib/f28004x/driverlib" --advice:performance=all -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --include_path="C:/DE/PROGETTI/DE1240/software/Debug/syscfg"

what am i missing??

Thank You

Kind Regards

Emanuele Peruzzi