Getting error while debugging and calling Rpmsg_Read

Hi all,

I use the image 1.1b4 to access M4 core with Rpmsg lib. With VS2013 I buildt the Rpmsg_Demo example. I deployed the release exe to the eval board an everything works fine. The A7 talks to the M4.

But if I deploy the debug exe to debug it, I get a error while calling Rpmsg_Read(…).

void RxThread(HANDLE hRpmsg)
{
	MESSAGE msg;
	DWORD   len;
	DWORD   count = 0;
	TCHAR   dataEvent[32];
	HANDLE  hReceive;
	DWORD   ret;

	msg.DATA = 0;

	//Get event name for creating a receive notification event.
	Rpmsg_GetConfigString(hRpmsg, L"DataAvailableEvent", dataEvent, sizeof(dataEvent));
	hReceive = CreateEvent(NULL, FALSE, FALSE, dataEvent);

	//Send a DWORD to M4.
	Rpmsg_Write(hRpmsg, (DWORD *)&msg, sizeof(MESSAGE));

	while (msg.DATA < 100)
	{
		ret = WaitForSingleObject(hReceive, INFINITE);
		if (ret == WAIT_OBJECT_0)
		{
			len = sizeof(msg);
			if (Rpmsg_Read(hRpmsg, (DWORD *)&msg, len))
			{
				printf("Recv msg : %d\r\n", msg.DATA);
				msg.DATA++;
			}
			Rpmsg_Write(hRpmsg, (DWORD *)&msg, sizeof(MESSAGE));
		}
	}
	CloseHandle(hReceive);
}

Code in the example has not changed. Also Rpmsg_Write is fine. Calling Rpmsg_Read() throws the following error:

f:\dd\vctools\crt_bld\self_arm_arm\crt\src\dbgheap.c(1399) :
Assertion failed: pHead->nBlockUse == nBlockUse
First-chance exception at 0x0001CD5F in Rpmsg_Demo_VS2013.exe: 0xC0000005:
Access violation writing location 0x001A2000.
Unhandled exception at 0x0001CD5F in Rpmsg_Demo_VS2013.exe: 0xC0000005:
Access violation writing location 0x001A2000.

As I said, compiling in release version works. I build the project with Toradex CE_800 SDK.

Best regards,

kuzco

no problem thanks.

Dear @Kuzco
I was able to reproduce the issue here. Please let us some time to investigate the problem in more detail.
Regards, Andy

Dear @Kuzco

We used a wrong function to release allocated memory in one place ( free() instead of LocalFree() ) .
This is fixed in the preliminary Toradex CE Libraries V2.1b4378.

The RpMsgLib for iMX7 and therefore the error you described were never in an official library release, therefore this is the only place where we document the fix.

The issue will be permanently solved in the Libraries V2.2 and later.

Regards, Andy