RPMSG configuration in yocto

Hi support,

I am trying to make RPMSG work on a colibri i.MX7, using Yocto to create a BSP 5.7 image.
My basic requirements are the ability to pass data from the M4 to Linux in the most efficient way (ideally, I must transfer 2.4MBytes/s).
On the M4 side, I’m using FreeRTOS (at least for now) and the RPMSG API as implemented in rpmsg_rtos.c (rpmsg_rtos_init(), rpmsg_rtos_recv_no_copy() etc…).

My questions concern the Linux side:

In my “defconfig” file, I currently have this:


# Rpmsg drivers
# end of Rpmsg drivers

Is this the correct configuration that I need in order to make the Linux side work for the functions I use on the M4 ?

When I build for this config and generate/install the corresponding SDK, the only files refering to rpmsg are:


opt/tdx-xwayland/5.7.1$ find . -name "*rpmsg*"

The header file just defines a structure (rpmsg_endpoint_info) and that’s all.
(But there are quite some *virtio* header files and a .so library file.)

So I’m a bit lost.
Am I correct in wanting to use the same API on the Linux side as on the M4 side ?
If so, do you have any idea on how to get this API on Linux ?
If not, can you please tell me how I should proceed ? (by giving instructions or a pointer to somewhere…)

Thanks a lot for your help,

(PS: This is not my first post on the subject but I thought it was better to start a new thread for clarity)

Hello @ompie ,
We have some documentation on RTOS and RPMSG , maybe it can help you:

Best regards,

Hello @josep.tx,

Thanks for your reply!
Of course I’ve already read this article (several times in the pas year). But by looking again, I realize that the article also gives links to the source code for the Linux side ! Shame on me …
I’ll give it a try tomorrow and let you know the results.

Can I just ask you what you think of my settings in the “defconfig” file I mentioned yesterday ?

Is activating RPMSG_VIRTIO while not activating the VIRTIO_CHAR, PINGPONG and TTY lines sufficient ?
Their names correspond to the names of the three examples in the article you mention but what do those three lines exactly mean?

Best regards,

Hi @josep.tx,

(and I also want to ping hfranco.tx, who might have some ideas…)

Small update:
I tried making the image with CONFIG_IMX_RPMSG_PINGPONG=y(otherwise, the same config as in my first post) and then created and installed the SDK.

The pingpong example in the link you gave uses some kernel include files:

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/virtio.h>
#include <linux/rpmsg.h>

linux/kernel.h, linux/module.h and linux/rpmsg.h can be found under the SDK but NOT the kernel/virtio.h file!

There are however:

-rw-r--r-- 1 root root  2041 avril 18 19:50 virtio_9p.h
-rw-r--r-- 1 root root  5036 avril 18 19:50 virtio_balloon.h
-rw-r--r-- 1 root root  6797 avril 18 19:50 virtio_blk.h
-rw-r--r-- 1 root root  3836 avril 18 19:50 virtio_config.h
-rw-r--r-- 1 root root  3136 avril 18 19:50 virtio_console.h
-rw-r--r-- 1 root root 13874 avril 18 19:50 virtio_crypto.h
-rw-r--r-- 1 root root   490 avril 18 19:50 virtio_fs.h
-rw-r--r-- 1 root root  8540 avril 18 19:50 virtio_gpu.h
-rw-r--r-- 1 root root  2592 avril 18 19:50 virtio_ids.h
-rw-r--r-- 1 root root  2506 avril 18 19:50 virtio_input.h
-rw-r--r-- 1 root root  3783 avril 18 19:50 virtio_iommu.h
-rw-r--r-- 1 root root  4586 avril 18 19:50 virtio_mmio.h
-rw-r--r-- 1 root root 10549 avril 18 19:50 virtio_net.h
-rw-r--r-- 1 root root  7079 avril 18 19:50 virtio_pci.h
-rw-r--r-- 1 root root   639 avril 18 19:50 virtio_pmem.h
-rw-r--r-- 1 root root  7430 avril 18 19:50 virtio_ring.h
-rw-r--r-- 1 root root   265 avril 18 19:50 virtio_rng.h
-rw-r--r-- 1 root root  6035 avril 18 19:50 virtio_scsi.h
-rw-r--r-- 1 root root  2153 avril 18 19:50 virtio_types.h
-rw-r--r-- 1 root root  3086 avril 18 19:50 virtio_vsock.h

Any idea what I’m missing ?

And just to anticipate: I probably need to add some libraries in order to link the example. Concerning virtio and rpmsg, the only ‘.so’ I could locate under the SDK is virtio_gpu_dri.so.
Can you shine some light on what to link and where to find these as well ?

Thanks a lot in advance,

Hi @ompie,

From what I could check with bitbake virtual/kernel -c menuconfig, the necessary packages are already enabled for RPMSG, some of the as builtin and some of them as kernel modules, so I expect there is nothing left to enable in this case.

When you enable something on the kernel configuration, it should also enable the related configurations that are required for you. That’s why I believe it should be enabled. Are you seeing any errors or RPMSG still doesn’t work? What’s the status?

Although they will use the shared memory approach to communicate, they can use different libraries or do it differently on the M4 side compared to the Linux side. Can you please explain what errors or what’s happening with your device?

You should always enable them with the menuconfig, and never do it manually because you don’t know which dependencies are required and most probably this will lead to errors. By using menuconfig, you can enable everything and make sure all the dependencies are correct.

These files that you shared, are they from the SDK? The ping pong example should work by default after you modprobe the kernel driver on linux (with the correct device tree overlay enabled), have you tried that already?

Best Regards,

Hi @hfranco.tx,
Thanks for looking at my questions again!

I currently have errors during compilation: I do not seem to have a kernel/virtio.h header file in the generated SDK. In my previous post, I listed all header files with ‘virtio’ in their name.
So it is not possible to tell you what’s happening on the device. The only thing I know is that the M4 side seems to work, init is OK and it is waiting for the Linux side (which I did not manage to compile yet).

Concerning the activation of VIRTIO_CHAR, PINGPONG AND TTY, you wrote:

That’s something to try. After saving the defconfig file a first time (in meta-customer/recipes-kernel/linux/linux-toradex directory), I fiddled with the RPMSG settings by directly changing them in that file.

The pingpong example (the one that includes all the <linux/xxx.h> files) came from the link in the article that @josep.tx provided at the start of this thread.
The list of virtio header files comes from the SDK generated by bitbake (bitbake tdx-reference-minimal-image -c populate_sdk)

With the currently used defconfig file:

# Rpmsg drivers
# end of Rpmsg drivers

I tried these modprobe commands:

root@colibri-imx7-emmc-06596549:~# modprobe imx_rpmsg_tty
modprobe: FATAL: Module imx_rpmsg_tty not found in directory /lib/modules/5.4.193-5.7.1-devel+git.f78299297185
root@colibri-imx7-emmc-06596549:~# modprobe imx_rpmsg_pingpong

The tty version seems logic since CONFIG_IMX_RPMSG_TTY=n and the pingpong as well since it is configured as =y and not as =m.

And what device tree modifications should I make in order to make pingpong work ?
(this is of course only relevant after I manage to compile the example…)

Best regards,

Hi @ompie,

Sorry for the delay, do you still have issues on this topic? Were you able to find a solution?

Best Regards,

Hi @hfranco.tx,

Thanks for following up on the topic.
I actually did not manage to get it to work and I have abandoned it. First of all because it took already so much of my time (incuding the switch from Torizon to BSP/Yocto…) while still not sure whether it would work someday. Also because there is another issue that I’m not sure of: the performance of the M4 outside it TCM seems to be too low for my purposes: I have to transfer about 1M 16-bit samples per second to the Linux/A7 processor(s).
The solution I implemented is using an external microcontroller (PIC32) which interfaces with the ADCs via two parallel SPI interfaces using DMA (something which is not available on the M4). The prepared packet (without much CPU intervention) is then sent over a local Ethernet link to the Colibri. I got this working in only a few days…

So you can close this topic since I will not need a solution anymore… despite of the good support I always get from you guys!

Best regards,

Hi @ompie,

Thanks for your updates on this topic. I’m sorry this couldn’t work out at the end, let us know if you need any extra help regarding any issues.

Best Regards,