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: variable requires to delare as volitle if used in different tasks CLA

Part Number: TMS320F280049

Dear CCS/C2000 expert,

Currently I'm debuging CLA code, and found an phenomenon that the varialbe should be delared as volatile if used in different tasks.

Below code is my test code, there are 2 tasks, one is Cla1Task1 which is hardware interrupt triggered, the other is Cla1BackgroundTask.

The variable, claBG_started will be set if the condition are meet, and this varible will be checked if it's set in Cla1BackgroundTask.

I found that if this variable wihout delearing as volatile, background will never know this variable has been set because there is no software breakpoint triggered. And this issue is gone if it's declared as volatile. Can you please help me know why? And what's the criterial of declaring variables? When to use volatile?

My optimization level is O2 global optimization, speed vs size is set 5.