Support of rpmsg in TorizonCore on Verdin iMX8MP

Currently i am trying to run the multicore RPMsg-Lite string echo demo of the MCUXpresso SDK. Apparently i stumbled upon the same issue like deepimpact as discussed in RPMSG does not work on IMX8M-Plus.

The presented solution involves patching of the caam-driver and the device tree and finally, rebuilding the image. I would really like to avoid this.
Since this solution is over a year old, is there any chance that there is a better solution by now? Will upcoming versions of TorizonCore have build-in support of rpmsg?

This is my hardware / software setup:

  • Verdin iMX8MP Quad 4GB V1.1A, nonwifi
  • Verdin Development Board V1.1D
  • TorizonCore 6.1.0-devel-202212+build.4
  • MCUXpresso SDK Rev 2.12.1 for MIMX8MP

Thanks and regards!
Chris

Hi @MadDoc,

For Verdin M Plus and TorizonCore 6, please check my answer here:

The overlay that I shared there should work for your setup. Let me know if you need anything else or if you had any questions, so I can help you here.

Best Regards,
Hiago.

Hi @hfranco.tx,

thank you for your quick reply! I will check your answer and get back to you if i need further support.

Best regards,
Chris.

1 Like

Hello @hfranco.tx,

i tried your overlay as suggested. Unfortunately, the boot process was aborted due to an allocation error after applying verdin-imx8mp_hmp_overlay.dtbo.

Please see attached u-boot log: uboot.log (4.6 KB)

Best regards,
Chris

Hi @MadDoc,

Sorry for the delay, it took me a while to debug what was going on and I have some points to share with you. Please let me know if you have any questions.

This is my setup, it’s using TorizonCore 6.1.0-devel-202212-build.4 as you mentioned:

torizon@verdin-imx8mp-07174398:~$ sudo tdx-info
Password:

Software summary
------------------------------------------------------------
Bootloader:               U-Boot
Kernel version:           5.15.77-6.1.0-devel+git.a8d2c55c6ae7 #1-TorizonCore SMP PREEMPT Wed Nov 30 08:37:42 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=/ostree/boot.1/torizon/f1353018bbd86b36fe524851f42350278b14e7160971752d450fc53ac0c43b90/0
Distro name:              NAME="TorizonCore"
Distro version:           VERSION_ID=6.1.0-devel-202212-build.4
Hostname:                 verdin-imx8mp-07174398
------------------------------------------------------------

Hardware info
------------------------------------------------------------
HW model:                 Toradex Verdin iMX8M Plus WB on Verdin Development Board
Toradex version:          0058 V1.0D
Serial number:            07174398
Processor arch:           aarch64
------------------------------------------------------------

First, I updated the overlay source code a little bit to disable some peripherals on the Linux part that might cause some issues. Please, download the source code and the compiled DTBO here: Download - Toradex File Sharing Platform.

Next, u-boot is crashing as you mentioned because apparently the FDT relocation is disabled by default by NXP. To correct that, run the following command in your u-boot terminal:

> setenv fdt_high 0xffffffffffffffff
> saveenv
> reset

This will fix the issue you’re seeing.

Then, enable the overlay that I’ve sent. Mine looks like this:

torizon@verdin-imx8mp-07174398:~$ cat /boot/ostree/torizon-f1353018bbd86b36fe524851f42350278b14e7160971752d450fc53ac0c43b90/dtb/overlays.txt
fdt_overlays=verdin-imx8mp_hdmi_overlay.dtbo verdin-imx8mp_dsi-to-hdmi_overlay.dtbo verdin-imx8mp_spidev_overlay.dtbo verdin-imx8mp_hmp_overlay.dtbo

Now, after rebooting your board, the overlay should load fine.
In order to load your HMP binary, please run the following commands:

> ext4load mmc 2:1 ${loadaddr} /ostree/deploy/torizon/var/hello_world.bin
8292 bytes read in 3 ms (2.6 MiB/s)
> cp.b ${loadaddr} 0x7e0000 10000
> dcache flush
> bootaux 0x7e0000
## Starting auxiliary core stack = 0x20020000, pc = 0x0000048D...

Please note that my binary is inside /var/ on TorizonCore and the MMC partition you should look into is 2:1. I’m also using the TCM memory 0x7e0000. The partition changed for TorizonCore 6, I will update the article How to load compiled binaries into Cortex-M | Toradex Developer Center to fix that.

Now, the HMP should work. I tested the hello world and RPMSG demos.

RPMSG String Echo FreeRTOS RTOS API Demo...

Nameservice sent, ready for incoming messages...
Get Message From Master Side : "hello world!" [len : 12]
Get Message From Master Side : "hiago" [len : 5]
Get New Line From Master Side

I noticed a bug inside the Remote Proc framework. Sometimes it works, and sometimes it crashes the kernel. I’m not sure why this is happening right now, I opened a ticket internally so we can take a look into that.

For now, please use the bootaux (u-boot) instead of the Remote Proc.

Thanks for your patience. Please note that we’re still developing our documentation and tests regarding the HMP. Any feedback is appreciated.

Let me know if you need anything else.

Best Regards,
Hiago.

Hi @hfranco.tx,

it finally works! Thanks a lot!

Best regards,
Chris

1 Like

Hi @hfranco.tx
can you write here which is the first TorizonCore release that includes the Device Tree Overlay that supports the M7 core (and rpmsg)?
I’ve just downloaded the Monthly TorizonCore with evaluation containers
6.2.0-devel-202303+build.6.container but the overlay is not included.
This is the output from ls /sysroot/boot/ostree/torizon-e6438c5c4cc0811f07a76665909c69d6faf318fc8d2015b5539c84fd926bdaf7/dtb/overlays

display-dpi-lt170410_overlay.dtbo
display-edt5.7_overlay.dtbo
display-edt7_overlay.dtbo
display-fullhd_overlay.dtbo
display-lt161010_overlay.dtbo
display-lt170410_overlay.dtbo
display-vga_overlay.dtbo
verdin-imx8mp_dsi-to-hdmi_overlay.dtbo
verdin-imx8mp_dsi-to-lvds_panel-cap-touch-10inch-lvds_overlay.dtbo
verdin-imx8mp_dsi-to-lvds_panel-lvds-dual-channel-1080p_overlay.dtbo
verdin-imx8mp_hdmi_overlay.dtbo
verdin-imx8mp_mezzanine_ov5640-alt-jumpers_overlay.dtbo
verdin-imx8mp_mezzanine_ov5640-default-jumpers_overlay.dtbo
verdin-imx8mp_mezzanine_panel-cap-touch-10inch-lvds_overlay.dtbo
verdin-imx8mp_mezzanine_panel-lvds-dual-channel-1080p_overlay.dtbo
verdin-imx8mp_nau8822-btl_overlay.dtbo
verdin-imx8mp_ov5640_overlay.dtbo
verdin-imx8mp_spidev_overlay.dtbo

And on the community there are different versions of this overlay, shared in different topics.
I prefer starting from a well-documented fixed point.
Thanks

Hi @vix,

Sorry for the delay.

For now, we only have the overlay for the Mini available, not the Verdin Plus.

Do you have any overlay code that you’re trying to use and want to share with us? Then I can take a look and try on my side as well.

Best Regards,
Hiago.

If you agree, I’ll start from the overlay you posted in this topic, above
Download - Toradex File Sharing Platform.

Is this ok?

Hi @vix,

The overlay for Verdin Plus got merged: device-tree-overlays.git - Sources for Device Tree Overlays

Please check if that works for your TorizonCore. I tested with the ping pong example and couldn’t see any issues so far.

Best Regards,
Hiago.

Hi @hfranco.tx
do you mean it’s included in the most recent Nightly Build, that is 253 at the moment?

Hi @vix,

Not yet, it will be available only on tomorrow’s nightly.

Best Regards,
Hiago.

1 Like

Hi @hfranco.tx
I’ve just downloaded an installed Nightly Build 254 with Evaluation Containers, but it seems that the overlay has not been included:

torizon@verdin-imx8mp-14777722:~$ cat /boot/ostree/torizon-866ce63963f90f0f11ffe67f97a1a3a4849a6c7f6ff21e42b9f83086a29ae464/dtb/overlays.txt 
fdt_overlays=verdin-imx8mp_hdmi_overlay.dtbo verdin-imx8mp_dsi-to-hdmi_overlay.dtbo verdin-imx8mp_spidev_overlay.dtbo

and

torizon@verdin-imx8mp-14777722:~$ ls /sysroot/boot/ostree/torizon-866ce63963f90f0f11ffe67f97a1a3a4849a6c7f6ff21e42b9f83086a29ae464/dtb/overlays
verdin-imx8mp_dsi-to-hdmi_overlay.dtbo                                verdin-imx8mp_mezzanine_panel-cap-touch-10inch-lvds_overlay.dtbo
verdin-imx8mp_dsi-to-lvds_panel-cap-touch-10inch-lvds_overlay.dtbo    verdin-imx8mp_mezzanine_panel-lvds-dual-channel-1080p_overlay.dtbo
verdin-imx8mp_dsi-to-lvds_panel-lvds-dual-channel-1080p_overlay.dtbo  verdin-imx8mp_nau8822-btl_overlay.dtbo
verdin-imx8mp_hdmi_overlay.dtbo                                       verdin-imx8mp_ov5640_overlay.dtbo
verdin-imx8mp_mezzanine_ov5640-alt-jumpers_overlay.dtbo               verdin-imx8mp_spidev_overlay.dtbo
verdin-imx8mp_mezzanine_ov5640-default-jumpers_overlay.dtbo

Can you double-check, please?

Hi @vix,

I can verify this was added on the latest nightly:

orizon@verdin-imx8mp-14777535:~$ ls -lh /boot/ostree/torizon-26c36e467e61e81b52eeba2c283c92f30f2465f3f7d40fde7af59e1e65f483c0/dtb/overlays | grep hmp
-rw-r--r-- 1 root root 2.6K Jan  1  1970 verdin-imx8mp_hmp_overlay.dtbo
torizon@verdin-imx8mp-14777535:~$ sudo tdx-info

Software summary
------------------------------------------------------------
Bootloader:               U-Boot
Kernel version:           5.15.77-6.3.0-devel+git.8fd3bb014f54 #1-TorizonCore SMP PREEMPT Fri Apr 21 06:53:45 UTC 2023
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=/ostree/boot.1/torizon/26c36e467e61e81b52eeba2c283c92f30f2465f3f7d40fde7af59e1e65f483c0/0
Distro name:              NAME="TorizonCore"
Distro version:           VERSION_ID=6.3.0-devel-20230427-build.255
Hostname:                 verdin-imx8mp-14777535
------------------------------------------------------------

Hardware info
------------------------------------------------------------
HW model:                 Toradex Verdin iMX8M Plus WB on Verdin Development Board
Toradex version:          0058 V1.1A
Serial number:            14777535
Processor arch:           aarch64
------------------------------------------------------------

I’ve downloaded using Toradex Easy Installer with the feeds for nightly builds enabled.

Best Regards,
Hiago.

1 Like

Hi @hfranco.tx
I confirm that build 255 contains the dtbo overlay.

I enabled it directly on the device using the Approach 2 from KB.
The content of
/sysroot/boot/ostree/torizon-26c36e467e61e81b52eeba2c283c92f30f2465f3f7d40fde7af59e1e65f483c0/dtb/overlays.txt
is
fdt_overlays=verdin-imx8mp_hdmi_overlay.dtbo verdin-imx8mp_dsi-to-hdmi_overlay.dtbo verdin-imx8mp_spidev_overlay.dtbo verdin-imx8mp_hmp_overlay.dtbo

After I reboot the device, the boot fails with the following errors

U-Boot 2022.04-6.3.0-devel+git.a7d6442796bf (Jan 01 1970 - 00:00:00 +0000)

CPU:   i.MX8MP[8] rev1.1 1600 MHz (running at 1200 MHz)
CPU:   Industrial temperature grade (-40C to 105C) at 55C
Reset cause: POR
DRAM:  4 GiB
Core:  89 devices, 23 uclasses, devicetree: separate
WDT:   Started watchdog@30280000 with servicing (60s timeout)
MMC:   FSL_SDHC: 1, FSL_SDHC: 2
Loading Environment from MMC... OK
In:    serial@30880000
Out:   serial@30880000
Err:   serial@30880000
Model: Toradex 0058 Verdin iMX8M Plus Quad 4GB WB IT V1.1A
Serial#: 14777722
Carrier: Toradex Verdin Development Board V1.1B, Serial# 10893470
Net:   eth1: ethernet@30be0000, eth0: ethernet@30bf0000 [PRIME]
Normal Boot
Hit any key to stop autoboot:  0
switch to partitions #0, OK
mmc2(part 0) is current device
Scanning mmc 2:1...
Found U-Boot script /boot.scr
973 bytes read in 1 ms (950.2 KiB/s)
## Executing script at 50280000
4862 bytes read in 2 ms (2.3 MiB/s)
90156 bytes read in 2 ms (43 MiB/s)
149 bytes read in 2 ms (72.3 KiB/s)
Applying Overlay: verdin-imx8mp_hdmi_overlay.dtbo
2219 bytes read in 2 ms (1.1 MiB/s)
Applying Overlay: verdin-imx8mp_dsi-to-hdmi_overlay.dtbo
3165 bytes read in 2 ms (1.5 MiB/s)
Applying Overlay: verdin-imx8mp_spidev_overlay.dtbo
561 bytes read in 2 ms (273.4 KiB/s)
Applying Overlay: verdin-imx8mp_hmp_overlay.dtbo
2631 bytes read in 2 ms (1.3 MiB/s)
13356219 bytes read in 44 ms (289.5 MiB/s)
11523513 bytes read in 38 ms (289.2 MiB/s)
   Uncompressing Kernel Image
## Flattened Device Tree blob at 50200000
   Booting using the fdt blob at 0x50200000
ERROR: Failed to allocate 0x3a000 bytes below 0x100000000.
device tree - allocation error
FDT creation failed!
resetting ...

I had to use this strategy to disable the hmp dtbo

When the boot is successfull, the u-boot log is

...
## Flattened Device Tree blob at 50200000
   Booting using the fdt blob at 0x50200000
   Loading Device Tree to 00000000ffae8000, end 00000000ffb0102b ... OK

Starting kernel ...
...

Can you double check, please?

Hi @vix,

Please, run these commands into the U-Boot terminal:

# setenv fdt_high 0xffffffffffffffff
# saveenv
# reset

Let me know if that fixes your issue.

With TorizonCore, the default reserved memories from NXP for RPMSG and REMOTEPROC are overlapped with our allocated regions, that’s why you are seeing this error.

The above command should disable NXP FDT relocation and boot your device.

Anyways, I’ll open a ticket internally with the TorizonCore team so we can investigate further.

Best Regards,
Hiago.

1 Like

Hi @hfranco.tx,
I confirm that setting fdt_high U-Boot variable fixes the issue and the device boots.

Keep me informed on the results of the investigation from TorizonCore team.

1 Like

Hi @hfranco.tx
curisity from my side: what is fdt in the context of U-Boot?

Hi @vix,

The fdt is related to the device tree file.
The fdt reallocation that I mentioned is that u-boot can reallocate where it’s going to load its files in memory, like the device tree file.
The issue you’re seeing is that the memory regions are overlapping because u-boot is allocating the device tree file in the same memory cortex-m is trying to load its binary (as far as I understood from the errors).

So, in NXP downstream u-boot, setting this number in the fdt_high variable disables this feature to fix the error you’re seeing.

Best Regards,
Hiago.

1 Like