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.
Tool/software: Code Composer Studio
Hi Team,
My customer reported issues for the compiler:
1) different optimization level caused different code execution which make DCDC control algorithm not stable.
2) different compiler version caused different result with same source code.
Could you 6646.Issues with compiler.docxkindly help give comments on item 1) and item 2)? any guidelines for the optimization level configuration? The detailed description can be found in below attached file.
Best Regards
Benjamin
Benjamin Zhou said:1) different optimization level caused different code execution which make DCDC control algorithm not stable.
I'm not sure what causes this problem. Please make sure any variables modified by interrupts are marked volatile. That is often a cause of situations like this.
Benjamin Zhou said:2) different compiler version caused different result with same source code.
In the document which details this problem, it states the problem is somehow related to memcpy. And the fix was to change from using the memcpy routine supplied in the compiler RTS library to a custom implementation of memcpy. Do I summarize that correctly? I doubt that this change directly fixes the problem. It is more likely that this change only masks the problem. While I am not certain, this seems like a problem of timing. And timing problems are often caused by failing to use the volatile keyword where needed.
Thanks and regards,
-George
This response has been modified from the original, in order to correct an error.
Benjamin Zhou said:For "Volatile", do you mean only the variable used or defined in ISR must use the volatile?
Any variable that is read or written by an ISR.
Thanks and regards,
-George
Failure to use volatile correctly can cause problems at any level of optimization, even "off". That said, such problems are more likely at higher levels of optimization.
Thanks and regards,
-George