nxp-mcuxpresso / rpmsg-lite

RPMsg implementation for small MCUs
BSD 3-Clause "New" or "Revised" License
238 stars 73 forks source link

Program hangs in rpmsg_lite_release_rx_buffer() #6

Closed Genar34 closed 5 years ago

Genar34 commented 5 years ago

First of all thank you for this useful library. Note that in rpmsg_lite_release_rx_buffer() function there is a RL_ASSERT macro to expect a buffer pointer value inside a range, but...From the master side in Linux, these buffers are allocated using dma_alloc_coherent so a virtual address is expected which does not match what the RL_ASSERT macro expects, therefore my program hangs there. I'm using a iMX7D with these configuration for the rpmsg: DT: &rpmsg{ vdev-nums = <1>; reg = <0xbfff0000 0x80000>; status = "okay"; }; RPMSG-LITE

define BOARD_SHARED_MEMORY_BASE (void *)0xBFFF0000

define RL_BUFFER_COUNT (256)

define RL_BUFFER_PAYLOAD_SIZE (496)

With these parameters, when i receive something from the master side, the rx buffer addr is at 0xAA... and RL_ASSERT triggers. Any ideas? Thanks in advance

MarekNovakNXP commented 5 years ago

Dear Genar,

Sorry for a later answer - I have fixed your issue by adding a configuration macro. The check in RL_ASSERT I have added is not applicable for a system using virtual memory, since in the check, the physical addresses is used - so it may be enabled basically only in rpmsg-lite to rpmsg-lite use-cases without virtual memory. So please, try git pull to the master branch. The check should be disabled by default. Regards. Marek