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: MISRA-C:2004 Rule 10.1 Warning

Part Number: TMS320F280049


Champs,

I am asking this for our customer.

The user got a warning under MISRA-C 2004 Rule 10.1 when using driverlib like below.

#1393-D (MISRA-C:2004 10.1/R) The value of an expression of integer type shall not be implicitly converted to a different underlying type if it is not a conversion to a wider integer type of the same signedness

The user’s codes are like these:

1.     DEVICE_DELAY_US(1000);

2.     HWREG_BP(base + CAN_O_IF2CMD) = CAN_IF2CMD_TXRQST | (objID & CAN_IF2CMD_MSG_NUM_M);

3.     HWREG_BP(base + CAN_O_IF1CMD) = CAN_IF1CMD_CLRINTPND | (intClr & CAN_IF1CMD_MSG_NUM_M);

4.     HWREG_BP(base + CAN_O_IF1CMD) = CAN_IF1CMD_CONTROL | (objID & CAN_IF1CMD_MSG_NUM_M);

5.     CMPSS_configRamp (CMPSS1_BASE, (U16)(0xFFFF), Can_Rx_315h_Data.Buck_Slope_Ramp_Dec_Val_Shadow_Set_U16, (U16)(0x0), (U16)(2), true);

6.     EPWM_setDeadBandOutputSwapMode(EPWM1_BASE, EPWM_DB_OUTPUT_A, false);

7.     EPWM_setDeadBandDelayMode(EPWM1_BASE, EPWM_DB_RED, false);

Our questions are:

1) Does this warning mean the user should have  “explicit casting”?

2) Do you have any suggestion how the user  can modify his codes to avoid this warning?

3) Is it possible the warning is from the underlying drivelib? Is our driver lib compliant to MISRA-C 2004?

Wayne Huang

  • 1. That is my understanding of the rule--either use explicit casting or reevaluate whether or not you're using an appropriate data type in the first place.

    2. It's as I stated in #1--add casting, pick appropriate types for variables, give constants U/L/F suffixes as needed, etc...

    3. The driverlib is not compliant with MISRA-C 2004. The code has undergone some MISRA-C 2012 analysis, but we do not consider it to be compliant.

    Whitney
  • Whitney,

    Would you please make it more clearer?
    "The driverlib is not compliant with MISRA-C 2004. The code has undergone some MISRA-C 2012 analysis, but we do not consider it to be compliant."

    1) Does CCS (8.x, 9.x) support MISRA-C 2012?

    2) Does that mean our driverlib is being tested under MISRA-C 2012 and needs improvement? After improvement, our drivelib "will" be compliant to MISRA-C 2012?

    3) If not, do we have any plan to make our driverlib be compliant to MISRA-C 2004 and/or 2012?



    Wayne Huang
  • 1. The MISRA-c:2004 checking is part of the compiler, not CCS, but no, TI doesn't currently provide any checkers for MISRA-C:2012.

    2 & 3. We're doing the checks to look for issues and improve quality, but no, we currently don't have any plans to make driverlib fully compliant to any MISRA-C standard.

    Whitney
  • Whitney,

    OK, I see.

    Wayne