I'm trying to clean up my code from misra violations using Pc-lint.
One of them is the violation to rule 11.4 in this code.
GPIO_PinState level = HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_6);
the definition of GPIOB is
#define GPIOB ((GPIO_TypeDef *) GPIOB_BASE)
The violation is the following: *[9078] conversion between object pointer type 'GPIO_TypeDef ' and integer type 'unsigned long' [MISRA 2012 Rule 11.4, advisory]
Since I can't modify this files (and is on memory mapped registers) I'm trying to use the Pc-lint command "egrep" to avoid this "warning".
I've tried to use
//lint -egrep(9078, "type 'GPIO_TypeDef *' and integer type 'unsigned long'")
but it doesn't work.
I don't want to use this command
//lint -e9078
because I want to exclude just this particular kind of violation.
Thanks in advance for the help.
HAL drivers released by STMicroelectronics contain hundreds of blocked lines of code; there is no rule that HAL drivers will not be interfered with; I have witnessed many times in the industry that HAL drivers are interfered with.
You can solve this problem using pointer arithmetic. Similar case study is shared in Keil RTOS v2 package:
References