Tool/software: Code Composer Studio
Gents,
I have the following small function:
/*
* Holds program execution until the amount
* of mili-seconds pass.
*/
void SystemUtilitiesDelayms(uint32_t delayms)
{
uint32_t timeLimit;
timeLimit = systemUtilities.systemElapsedMS + delayms;
while(timeLimit > systemUtilities.systemElapsedMS);
}
The element systemUtilities.systemElapsedMS is increased elsewhere, on a Timer interrupt.
Code gets stuck on the while() loop, despite timeLimit being lesser than .systemElapsedMS. I believe the problem is because of optimization on the function, which generates an assembly code that compares two registers:
Because of other indirect access elsewhere, I can't make the structure volatile.
Shall I "pragmatize" the function so that it does not get optimized? Any other way out of this one?
Thanks!
Bruno
