How To remove CW10.5 Linker warning initialization from incompatible pointer type [enabled by default]

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

How To remove CW10.5 Linker warning initialization from incompatible pointer type [enabled by default]

1,364 Views
RD_M2S
Contributor I

Hi,

 

I have the following :

 

typedef struct _S_PWM_LED

{

   E_LED_STATUS eStatus;                                 /* Led Status (ON-OFF-BLINK-BACKLIGTH) */

   uint8        Level;                                   /* Level in number of PWM TIC */

   void         (*PtrOnMethod)(LDD_TDeviceData);         /* pointer to On function */

   void         (*PtrOffMethod)(LDD_TDeviceData);        /* pointer to Off function */

}S_PWM_LED;

 

And when I declare my main LED struct, I used processor Expert component methods to initialize my struct.


S_PWM_LED m_sDel[NBR_LED] =

{

   {LED_BLINK, MAX_PWM_TIC, LED_PWR_ClrVal   , LED_PWR_SetVal   },   // LED_POWER

   {LED_OFF  , MAX_PWM_TIC, LED_CPU_ClrVal   , LED_CPU_SetVal   },   // LED_CPU

   {LED_OFF  , MAX_PWM_TIC, LED_MOTOR1_ClrVal, LED_MOTOR1_SetVal},   // LED_MOTOR1

   {LED_OFF  , MAX_PWM_TIC, LED_MOTOR2_ClrVal, LED_MOTOR2_SetVal},   // LED_MOTOR2

};


I have this warning message that comes up :

initialization from incompatible pointer type [enabled by default] (near initialization for 'm_sDel[0].PtrOnMethod') [enabled by default]

initialization from incompatible pointer type [enabled by default] (near initialization for 'm_sDel[0].PtrOffMethod') [enabled by default]

 

and so on for the next one.

 

How can I correct the warning message without removing it from the linker or compiler ?

Labels (1)
0 Kudos
2 Replies

880 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

please upload your project here. we need to reproduce the problem. thanks!

Best Regards,

ZhangJun

0 Kudos

880 Views
RD_M2S
Contributor I

This is a sample code. 

using the cast (void*) removes the warning message (see LED2 calling) but i'm not sure if it's a good idea depending where will be placed the called function when the code will grows.

regards.

0 Kudos