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.

Questions on MISRA-C 2004 Checker for ARM compiler

Other Parts Discussed in Thread: HALCOGEN

Dear Experts,

    I am using CCS V5.3.0 with TI ARM compiler V5.0.1 on Hercules MCU (TMS570LS3137ZWT).

    When trying to apply MISRA-C:2004 checker with [Required] option, I found the following warnings which I could not understand and get rid of...

    Please kindly help me here:

    1. Warning on rule 10.1 : #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

        This warning is given on the statement generated by HALCoGen V3.03.01, in the function of "adcGetData();" of source file of "adc.c".

        "uint32_t  count = adc->GxINTCR[group] >= (uint32_t)256U ? s_adcFiFoSize[index][group] : s_adcFiFoSize[index][group] - (uint32_t)(adc->GxINTCR[group] & 0xFF);" 

       where "adc" is a structure pointer with type of "adcBASE_t *", GxINTCR[] is an element of the structure with "uint32_t" type.

     2. Warning on rule 12.8: #1407-D (MISRA-C:2004 12.8/R) The right-hand operand of a shift operator shall lie between zero and one less than the width in bits of the underlying type of the left-hand operand

         This warning is given on the statement generated by HALCoGen V3.03.01, in the function of "adcInit();" of source file of "adc.c".

         "adcREG1->BNDCR  =(8U << 16U)|(8U + 8U);" 

         where "adcREG1" is a structure pointer with type of "adcBASE_t *", BNDCR is an element of the structure with "uint32_t" type.

    3. Warning on rule 14.1: #1465-D (MISRA-C:2004 14.1/R) There shall be no unreachable code

         This warning is given on the following statement:

       do{

            /* any statement here...*/

        }while(0);