I have the following code:
for(cc3=0; cc3<9; cc3++)
{
rfAddr = (Uint32)rfPreviousEnergy;
while (1)
{
if ((*((Uint32 *)rfPreviousEnergyCount)) == 0xFF) break;
}
for (cc2 = 0; cc2<40; cc2++)
{
// other codes
}
*((Uint32 *)rfPreviousEnergyCount) = cc3+1;
}
When I compile and build my project, the codes runs as exepected if I do not use optimization, i.e. --opt_level=0 or 1. However, when I use --opt_level=2 or 3, this piece of codes do not run normally. Specifically, it halts at the "rfAddr = (Uint32)rfPreviousEnergy", and do not go to the next line "while loop". When I checked the optimized disassembly codes, I found that the "while loop" dose not follow " rfAddr = (Uint32)rfPreviousEnergy". Thus I wonder how I can make the execution of the code jumps to while loop? Thanks!