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.

TMS320F28377D: a critical vulnerability of compiler

Part Number: TMS320F28377D

Hi Team,

There's an issue from the customer need your help:

Compiler V22.6.0.LST optimizations are turned on to O2.

In the following code, the bitfield form start-stop command gInv.CsBit.RunStop is updated in a slow non-interrupt task, and this start-stop command reads the change state in the status machine in my main interrupt.

The disassembly found that the assignment process cleared the bitfield before assigning the value, and no intermediate variables were used. This causes the clearance bitfield amount to be interrupted and read before it is assigned, and the interrupt state machine gets the wrong zeroed command and switches to the error state. This is a critical vulnerability, please fix it.

#if 01//Not disabling optimizations will cause occasional errors, compiler problems, do not use intermediate variable registers, directly clear bits in the assignment update, and run the command gInv.CsBit.RunStop=RunStop in the
middle of the interrupt;
#else//Avoid interrupt cases when calling this bitfield, the compiler optimizes bugs
caused by unused intermediate variables if (RunStop==D_Run)
{
gInv.CsBit.RunStop=D_Run;
}
else
{
gInv.CsBit.RunStop=D_Stop;
}
#endif

Could you help check this case?

Thanks & Regards,

Ben