Request To Add In-Tree RPMSG Chardevice Driver Kernelmodul

Hello Everyone,
at https://developer.toradex.com/torizon/os-customization/use-cases/building-external-kernel-modules-with-torizon
it is recommended to submit a request to the community if necessary.
This is what I want to do with this.

We want to move UART ↔ M4 ↔ RPMSG data as real time as possible.
Basically, this works with the TTY drivers.
However, I would like to explore if it works better with the rpmsg_char module.

Thanks in advance,
Gerald

Hi @gerko !

On TorizonCore 6, CONFIG_RPMSG_CHAR is already enabled:

torizon@verdin-imx8mp-06849036:~$ sudo tdx-info

Software summary
------------------------------------------------------------
Bootloader:               U-Boot
Kernel version:           5.15.77-6.1.0+git.349786b46e61 #1-TorizonCore SMP PREEMPT Wed Dec 28 09:58:45 UTC 2022
Kernel command line:      root=LABEL=otaroot rootfstype=ext4 quiet logo.nologo vt.global_cursor_default=0 plymouth.ignore-serial-consoles splash fbcon=map:3 ostree=/ostree0
Distro name:              NAME="TorizonCore"
Distro version:           VERSION_ID=6.1.0-build.1
Hostname:                 verdin-imx8mp-06849036
------------------------------------------------------------

Hardware info
------------------------------------------------------------
HW model:                 Toradex Verdin iMX8M Plus WB on Verdin Development Board
Toradex version:          0058 V1.0B
Serial number:            06849036
Processor arch:           aarch64
------------------------------------------------------------
torizon@verdin-imx8mp-06849036:~$ zcat /proc/config.gz | grep -i config_rpmsg
CONFIG_RPMSG=y
CONFIG_RPMSG_CHAR=m
CONFIG_RPMSG_CTRL=m
CONFIG_RPMSG_NS=y
CONFIG_RPMSG_QCOM_GLINK=y
CONFIG_RPMSG_QCOM_GLINK_RPM=y
CONFIG_RPMSG_VIRTIO=y
CONFIG_RPMSG_LIFE_CYCLE=y
CONFIG_RPMSG_IIO_PEDOMETER=m

Best regards,

Oh sorry!
Our hardware information:

torizon@apalis-imx8-07278333:~$ cat /etc/os-release
ID=torizon
NAME="TorizonCore"
VERSION="5.7.0+build.17 (dunfell)"
VERSION_ID=5.7.0-build.17
PRETTY_NAME="TorizonCore 5.7.0+build.17 (dunfell)"
DISTRO_CODENAME="dunfell"
BUILD_ID="17"
ANSI_COLOR="1;34"
VARIANT="Docker"

We use an APALIS iMX8QM Modul on a custom carrier board very similar to an Ixora carrier board

Hi @gerko,

It’s the same case for Apalis iMX8, you can check the config.gz and will see the CHAR device enabled as a kernel module in the Apalais kernel. Please make sure you have a device tree overlay to enable the rpmsg with the correct reserved areas and the driver should load automatically.

You can also test it with the NXP Ping Pong example, from their SDK.

Here are some good references to start:

Let me know if you need any help.

Best Regards,
Hiago.

I now have TDX Wayland with XWayland 6.2.0+build.6 (kirkstone) via the EasyInstaller
flashed.
First login user/passwd… torizon/torizon not working.
So I can’t check whether the modules are there now.
Is there an overview of what was changed in 6.2 compared to version 5.7?

Greetings
Gerald

Addendum:
I must have flashed the wrong image. Actually wanted:
Torizon Core with evaluation containers,
but have:
Toradex Embedded Linux Reference Multimedia Image
Installed.
Nevertheless, what are the access data for the latter image?

Hello @gerko ,

The credentials for the Reference images are root

Best regards,
Josep

I can’t deal with that.

The modules seems to be there:

torizon@apalis-imx8-07201831:~$ zcat /proc/config.gz | grep -i config_rpmsg
CONFIG_RPMSG=y
CONFIG_RPMSG_CHAR=m
CONFIG_RPMSG_CTRL=m
CONFIG_RPMSG_NS=y
CONFIG_RPMSG_QCOM_GLINK=y
CONFIG_RPMSG_QCOM_GLINK_RPM=y
CONFIG_RPMSG_VIRTIO=y
CONFIG_RPMSG_LIFE_CYCLE=y
CONFIG_RPMSG_IIO_PEDOMETER=m

The previous enable rpmsg overlay dto does not work here.
So far I’ve compiled the dts via this approach:
Using Standalone Commands
This no longer works for core 6.2? Are there no more standalone commands here?
Do the overlay source files (dts) for the 5.7 images also work in the 6.2 images?

if I copy the include folder from the linux/include following output:
(I think that’s not how it’s meant to be)

gerko@LAPTOP-BF6RSE3A:~/tcb62$ torizoncore-builder dt apply linux/arch/arm64/boot/dts/freescale/imx8qm-apalis-v1.1-ixora-v1.1.dts --include-dir linux/include
'imx8qm-apalis-v1.1-ixora-v1.1.dts' compiles successfully.
warning: removing currently applied device tree overlays
Device tree imx8qm-apalis-v1.1-ixora-v1.1.dtb successfully applied.

gerko@LAPTOP-BF6RSE3A:~/tcb62$ torizoncore-builder dto apply device-trees/overlays/apalis-imx8_enable_rpmsg.dts
'apalis-imx8_enable_rpmsg.dts' compiles successfully.

Failed to apply '/tmp/tmpc4i37hu6': FDT_ERR_NOTFOUND

error: cannot apply device tree overlays ['/tmp/tmpc4i37hu6'] against device tree /storage/dt/usr/lib/modules/5.15.77-6.2.0+git.aa0ff7e3554e/dtb/imx8qm-apalis-v1.1-ixora-v1.1.dtb.
error: overlay 'device-trees/overlays/apalis-imx8_enable_rpmsg.dts' is not applicable.

new insights:
The nodes rpmsg0 and rpmsg1 are missing in the device tree sources. (imx8-apalis-v1.1.dtsi and imx8qm.dtsi)


… ok I give up

Hi @gerko !

First of all, I am sorry if you are having a bad experience.

Dealing with Cortex-M and understanding how it works can be kind of fuzzy/cumbersome and we try our best to make the steps clearer.

I would like to ask you to give a step back and start “fresh”.

Could you please try following FreeRTOS on the Cortex-M4s of a Apalis iMX8 | Toradex Developer Center?

Also, please try it using a Toradex Reference Minimal instead of TorizonCore. After you have a better grasp of what is going on and how things work, I think you will have a better experience on TorizonCore and we can also help you with TorizonCore specifics :slight_smile:

Best regards,

Thank you.
Basically I have some experiences.
The TTY example works M4 side and Linux userspace side fine. In core5.7.
I would like to compare how fast the rpmsg_tty module versus the rpmsg_char module.
I just wanted an rpmsg_char kernel module.
In core 6.2 it is available. But the device tree doesn’t work with the old 5.7 overlays.
I’ve fixed that in the dt sources.(I hope)
The standalone dt and dto commands dont work in core6.2.

I can build the new custom image as described in the instructions over the yaml file. No Errors. It now fails on deploying this image over ssh to the apalis module.

But I’ll take your advice and continue with a minimal image.

Greetings

Addendum:

Next issue:
In the torizon core builder, I cannot load an image for the provided minimal image, corresponding to the installed image from the Artifacts servers.
Build 6 is not available:

gerko@LAPTOP-BF6RSE3A:~/tcb62mi$ torizoncore-builder images download --remote-host 192.168.88.16 --remote-username torizon --remote-password torizon
Downloading image from: https://artifacts.toradex.com/artifactory/torizoncore-oe-prod-frankfurt/kirkstone-6.x.y/release/6/apalis-imx8/torizon/torizon-core-docker/oedeploy/torizon-core-docker-apalis-imx8-Tezi_6.2.0+build.6.tar

The download may take some time. Please wait...
The requested image could not be found in the Toradex Artifactory.
Software summary
------------------------------------------------------------
Bootloader:               U-Boot
Kernel version:           5.15.77-6.2.0+git.aa0ff7e3554e #1 SMP PREEMPT Wed Mar 29 15:33:40 UTC 2023
Kernel command line:      pci=nomsi root=PARTUUID=ab24fb1e-02 ro rootwait console=tty1 console=ttyLP1,115200 consoleblank=0 earlycon
Distro name:              NAME="TDX Wayland with XWayland"
Distro version:           VERSION_ID=6.2.0-build.6
Hostname:                 apalis-imx8-07201831
------------------------------------------------------------

Hardware info
------------------------------------------------------------
HW model:                 Toradex Apalis iMX8QM V1.1 on Apalis Evaluation Board
Toradex version:          0037 V1.1E
Serial number:            07201831
Processor arch:           aarch64
------------------------------------------------------------


Hi @gerko !

Ok :slight_smile:
Let us know how it goes!


About your addendum, please avoid adding different subjects to the same thread. It makes really hard for us to keep the work organized.

But, the answer for your addendum is short:

You must use TorizonCore Builder with only TorizonCore images. You are trying to use it with a Reference image and it won’t work. Torizon-related tooling works only on TorizonCore images.

Best regards,

To end the thread:
My findings:

  • In Torizon Core 6.2, the RPMSG_CHAR kernel module is present by default.
  • However, in kernel version 5.15.77-6.2.0 there are no rpmsg0 / rpmsg1 nodes in imx8qm.dtsi or imx8-apalis-v1.1.dtsi
  • so you can not activate them via a device tree overlay
  • i have
    added these nodes accordingly
    edit the torizon core builder tcbuild.yaml
    run the build command
  • the deploy directly back to the apalis module ran without errors but had no effect. Everything was unchanged there.
  • so I searched for the corresponding newly created dtb and dto’s, found them, copied them to the module and lo and behold, I was able to achieve a small success.

Note: the M4_1 runs the NXP SDK rpmsg_lite_str_echo_rtos_imxcm4_m41 example

root@apalis-imx8-07201831:/var/rootdirs/home/torizon# dmesg | grep rpmsg
[    0.084042] imx rpmsg driver is registered.
[    1.410736] imx-rpmsg 90000000.rpmsg0: assigned reserved memory node vdevbuffer@90400000
[    1.446797] virtio_rpmsg_bus virtio0: rpmsg host is online
[    1.476781] virtio_rpmsg_bus virtio1: rpmsg host is online
[    1.477272] imx-rpmsg 90100000.rpmsg1: assigned reserved memory node vdevbuffer@90400000
[    1.478104] virtio_rpmsg_bus virtio2: rpmsg host is online
[    1.478931] virtio_rpmsg_bus virtio3: rpmsg host is online
[    1.478960] virtio_rpmsg_bus virtio3: creating channel rpmsg-virtual-tty-channel-1 addr 0x1f
[    1.479414] virtio_rpmsg_bus virtio2: creating channel rpmsg-i2c-channel addr 0x1
[    1.479583] i2c-rpmsg virtio2.rpmsg-i2c-channel.-1.1: new channel: 0x400 -> 0x1!

Now I’m looking for an example code for the M4 that fits the rpmsg_char kernel module
That’s a new thread then.
I now consider this problem solved.

1 Like

Hi @gerko !

Thanks for the mindful summary :slight_smile:

This is really helpful :smiley:

Have a nice day!