'unsigned int' can't convert to 'ADC_Type *' pointer

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

'unsigned int' can't convert to 'ADC_Type *' pointer

537 Views
daich
Contributor I
I am using S32K144,and the driver have below code:
#define ADC0_BASE                                (0x4003B000u)
/** Peripheral ADC0 base pointer */
#define ADC0                                     ((ADC_Type *)ADC0_BASE)
but when i use parasoft to check MISRA C 2012, it post "'unsigned int' can't convert to 'ADC_Type *' pointer" ,so how to solve this problem?
thank you very much!
0 Kudos
1 Reply

497 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

 

I'm not familiar with MISRA rules, but I think that definition of address as a macro and casting pointer to different type by this way is against MISRA rules. You can try to define ADC as a pointer and assign the address in it. Something like 

unsigned int adc0*;

adc0=0x4003B000;

 

Jiri

0 Kudos