My program works fine with Optimization level 1, but anything higher than that causes it to stop. Here is where:
while(RxDataReady < 1)
{
if(SecondFlag)
{
CmdTimeOutCount++;
SecondFlag = 0;
}
if(CmdTimeOutCount > 60) goto ErrorBail; // wait for a character to come in
}
When it fails, RxDataReady is 1, signifying the receipt of a character. In debug, the MCU steps in circles from if statement to if statement ignoring the fact that (RxDataReady < 1) is false. In Disassembly, the while(RxDataReady < 1) line is missing for the higher optimizations, but present at level 1.
This is not critical to me because the code works well at level 1, but it is troubling. Any suggestions?
I'm using Code composer Studio Version: 10.0.0.00010