cancel
Showing results for 
Search instead for 
Did you mean: 

MCSDK compilation error

Ofer
Senior

hi,

I created a project by the MCSDK, i tried running it as a C++ project, but im getting an error compilation that i cant solve:

 

../../MCSDK_v6.4.2-Full/MotorControl/MCSDK/MCLib/Any/Inc/revup_ctrl.h: In function 'void RUC_Stop(RevUpCtrl_Handle_t*)':

../../Inc/mc_type.h:77:32: error: invalid conversion from 'void*' to 'RevUpCtrl_PhaseParams_t*' [-fpermissive]

77 | #define MC_NULL (void *)(0x0)

| ^

| |

| void*

 

 

it seems that there is a wrong casting issue.

I tried to solve it in some fifferent wauys like:

pHandle->pCurrentPhaseParams = (RevUpCtrl_PhaseParams_t*)(malloc(MC_NULL));

or

pHandle->pCurrentPhaseParams = static_cast<RevUpCtrl_PhaseParams_t *>malloc(sizeof(MC_NULL));

 

but its not solving the issue.

but when i tried to delete this line it keeps having the same error !!!!!!

what could be the problem

2 REPLIES 2
mfgkw
Senior III

> but when i tried to delete this line it keeps having the same error !!!!!!

 

When you remove the line and the error remains then the problem will be somewhere else.

Maybe the line(s) before.

 

You should provide some more info...

this is the function which the error happen inside of it:

at the line:

pHandle->pCurrentPhaseParams = MC_NULL;

/**

* @brief Allow to exit from Rev-Up process at the current rotor speed.

* @PAram pHandle: Pointer on Handle structure of RevUp controller.

*/

static inline void RUC_Stop(RevUpCtrl_Handle_t *pHandle)

{

#ifdef NULL_PTR_CHECK_REV_UP_CTL

if (MC_NULL == pHandle)

{

/* Nothing to do */

}

else

{

#endif

VirtualSpeedSensor_Handle_t *pVSS = pHandle->pVSS;

pHandle->pCurrentPhaseParams = MC_NULL;

pHandle->hPhaseRemainingTicks = 0U;

VSS_SetMecAcceleration(pVSS, SPD_GetAvrgMecSpeedUnit(&pVSS->_Super), 0U);

#ifdef NULL_PTR_CHECK_REV_UP_CTL

}

#endif