We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello,
I am using uvision3 with realview compiler. I am busy working on an open source code, which was originally designed for an environment like visual studio. The program compiles fine there.
As soon as I compile it in uvision, i get the following error:
openPOWERLINK_v1.2.0\EplStack\EplApiGeneric.c(1453): error: #167: argument of type "__packed unsigned long *" is incompatible with parameter of type "void *"
I would appreciate any suggestions
Here is some sample of sources where the problem originates:
tEplDllConfigParam DllConfigParam;
typedef struct { unsigned int m_uiSizeOfStruct; BOOL m_fAsyncOnly; // do not need to register PRes-Frame unsigned int m_uiNodeId; // local node ID // 0x1F82: NMT_FeatureFlags_U32 DWORD m_dwFeatureFlags; // Cycle Length (0x1006: NMT_CycleLen_U32) in [us] DWORD m_dwCycleLen; // required for error detection // 0x1F98: NMT_CycleTiming_REC // 0x1F98.1: IsochrTxMaxPayload_U16 unsigned int m_uiIsochrTxMaxPayload; // const // 0x1F98.2: IsochrRxMaxPayload_U16 unsigned int m_uiIsochrRxMaxPayload; // const // 0x1F98.3: PResMaxLatency_U32 DWORD m_dwPresMaxLatency; // const in [ns], only required for IdentRes // 0x1F98.4: PReqActPayloadLimit_U16 unsigned int m_uiPreqActPayloadLimit; // required for initialisation (+24 bytes) // 0x1F98.5: PResActPayloadLimit_U16 unsigned int m_uiPresActPayloadLimit; // required for initialisation of Pres frame (+24 bytes) // 0x1F98.6: ASndMaxLatency_U32 DWORD m_dwAsndMaxLatency; // const in [ns], only required for IdentRes // 0x1F98.7: MultiplCycleCnt_U8 unsigned int m_uiMultiplCycleCnt; // required for error detection // 0x1F98.8: AsyncMTU_U16 unsigned int m_uiAsyncMtu; // required to set up max frame size // $$$ 0x1F98.9: Prescaler_U16 // $$$ Multiplexed Slot // 0x1C14: DLL_LossOfFrameTolerance_U32 in [ns] DWORD m_dwLossOfFrameTolerance; // 0x1F8A: NMT_MNCycleTiming_REC // 0x1F8A.1: WaitSoCPReq_U32 in [ns] DWORD m_dwWaitSocPreq; // 0x1F8A.2: AsyncSlotTimeout_U32 in [ns] DWORD m_dwAsyncSlotTimeout; } tEplDllConfigParam;
EPLDLLEXPORT tEplKernel PUBLIC EplObdReadEntry (EPL_MCO_DECL_INSTANCE_PTR_ unsigned int uiIndex_p, unsigned int uiSubIndex_p, void * pDstData_p, tEplObdSize * pSize_p)
The error originates from this line:
Ret = EplObdReadEntry(0x1006, 0, &DllConfigParam.m_dwCycleLen, &ObdSize);
I would suspect the "__packed" qualifier.
The compiler has to do special tricks when accessing a packed structure; You're passing a "packed" structure via a plain, vanilla void* pointer - so how will the user of that pointer know whether or not to do those special tricks...?
The code sample doesn't show where the __packed came from. Perhaps, there is a pragma above the typedef. Of course, you can use explicit type cast to silence the compiler, but first you must make sure that there will be no data alignment problems. After all, the x86 processor allows unaligned accesses, whereas most ARM processors do not.
Hey Neil, I located the source of the problem.
Thanks, your help is really appreciated!
I got another problem, please look at my new post :D
For the benefit of future readers who might have the same problem, how about sharing what you found...?