Facing Issue related to MISRA C 2012 Rule 11.4 violation. Using PC-Lint Plus for rule check. Keil uVision V5.38.0.0
Error:
conversion between object pointer type 'GPIO_Type *' and integer type 'unsigned int' [MISRA 2012 Rule 11.4, advisory]```
uint *L_uc_byte = (uint *)&GPIO->PIN[0];
Following are the details related to GPIO
#define __IO volatile /*!< Defines 'read / write' permissions */
/** Peripheral GPIO base address */
#define GPIO_BASE (0x4008C000u)
/** Peripheral GPIO base pointer */
#define GPIO ((GPIO_Type *)GPIO_BASE)
/** GPIO - Register Layout Typedef */
typedef struct {
__IO uint8_t B[6][32]; /**< Byte pin registers for all port 0 and 1 GPIO pins, array offset: 0x0, array step: index*0x20, index2*0x1 */
uint8_t RESERVED_0[3904];
__IO uint32_t W[6][32]; /**< Word pin registers for all port 0 and 1 GPIO pins, array offset: 0x1000, array step: index*0x80, index2*0x4 */
uint8_t RESERVED_1[3328];
__IO uint32_t DIR[6]; /**< Direction registers, array offset: 0x2000, array step: 0x4 */
uint8_t RESERVED_2[104];
__IO uint32_t MASK[6]; /**< Mask register, array offset: 0x2080, array step: 0x4 */
uint8_t RESERVED_3[104];
__IO uint32_t PIN[6]; /**< Port pin register, array offset: 0x2100, array step: 0x4 */
uint8_t RESERVED_4[104];
__IO uint32_t MPIN[6]; /**< Masked port register, array offset: 0x2180, array step: 0x4 */
uint8_t RESERVED_5[104];
__IO uint32_t SET[6]; /**< Write: Set register for port Read: output bits for port, array offset: 0x2200, array step: 0x4 */
uint8_t RESERVED_6[104];
__O uint32_t CLR[6]; /**< Clear port, array offset: 0x2280, array step: 0x4 */
uint8_t RESERVED_7[104];
__O uint32_t NOT[6]; /**< Toggle port, array offset: 0x2300, array step: 0x4 */
uint8_t RESERVED_8[104];
__O uint32_t DIRSET[6]; /**< Set pin direction bits for port, array offset: 0x2380, array step: 0x4 */
uint8_t RESERVED_9[104];
__O uint32_t DIRCLR[6]; /**< Clear pin direction bits for port, array offset: 0x2400, array step: 0x4 */
uint8_t RESERVED_10[104];
__O uint32_t DIRNOT[6]; /**< Toggle pin direction bits for port, array offset: 0x2480, array step: 0x4 */
} GPIO_Type;
I have tried multiple things
-
conversion between object pointer type 'GPIO_Type *' and integer type 'unsigned int' [MISRA 2012 Rule 11.4, advisory] uint data = ( ( GPIO->PIN[0] >> 17U ) & 0x03U );
-
conversion between object pointer type 'uint *' (aka 'unsigned int *') and integer type 'volatile uint32_t' (aka 'volatile unsigned int') [MISRA 2012 Rule 11.4, advisory] volatile uint L_uc_byte = *( uint * )(GPIO->PIN[0]);
-
conversion between object pointer type 'GPIO_Type *' and integer type 'unsigned int' [MISRA 2012 Rule 11.4, advisory] uint L_uc_byte = GPIO->PIN[0];
- Using address literal as a pointer
conversion between object pointer type 'uint *' (aka 'unsigned int *') and integer type 'unsigned int' [MISRA 2012 Rule 11.4, advisory] uint L_uc_byte = *( uint * )( 0x40002000U + 0x2100U);
Need Solution to resolve this rule violation.