Part Number: TMS320F280037
Tool/software:
I am running MISRA 2012 compliance on a motor project we are doing and have found that the code provided as example in the motorcontrolsdk seems to violate MISRA 11.8. For example:
motorVars_M1 is defined as volatile MOTOR_Vars_t motorVars_M1; and declared as extern volatile MOTOR_Vars_t motorVars_M1;
But when this variable is accessed in motor1_drive.c is always done like this:
This cast effectively ignores/removes the 'volatile' from the newly created pointer which is a MISRA 11.8 violation. I am wondering why the code is written in this way? The C2000 compiler seems to be treating the original object as volatile in some instances, or not in other instances, depending on the optimization level and the code in question; this makes bringing the code into MISRA compliance much more difficult - or maybe I am missing something?
thanks,