Verdin M4 core rpmsg example problem

Hello,
I started playing around with Verdin M4 core. I have been following AN article about RUNNING freeRTOS on M4 core. I have successfully run hello_world demo app and next thing I wanted to get familiar with is RPMSG to get an idea how to communicate between A and M core. I built rpmsg pingpong example, copied debug binary to the SD card and run it in uboot:

fatload mmc 1 0x7e0000 rpmsg_pingpong.bin && dcache flush && bootaux 0x7e0000

The program starts and prints:

RPMSG Ping-Pong FreeRTOS RTOS API Demo...
RPMSG Share Base Addr is 0xb8000000

After kernel boots and the imx_rpmsg_pingpong module is inserted nothing happens.

Getting Started with MCUXpressoSDK for i.MX 8M Mini.pdf states that correct dtb should be used:

setenv fdt_file 'fsl-imx8mm-evk-m4.dtb' 

I havent found m4 .dtb file or .dts anywhere. Am I doing something wrong? Should I write my own m4.dts?

Greetings @spasoye,

Before we continue what version of our software are you working with? (i.e. 5.0? 4.0?)

As for dtb files that dtb is not a Toradex maintained device tree, so it’s probably not deployed along with our default software by default. I took a quick look and found the dts here: fsl-imx8mm-evk-m4.dts « freescale « dts « boot « arm64 « arch - linux-toradex.git - Linux kernel for Apalis, Colibri and Verdin modules

However this kernel branch is for our 4.0 software. For our 5.0 software I don’t see a similar device tree source anywhere.

We haven’t done too much formal testing yet with Verdin and the M4 core on it, so I can’t speak too much of what to expect.

Best Regards,
Jeremias

I’m using 4.14.170-4.0.0-devel+git.62ad468b3107 version .
I’ll try to compile it, implement it and see what happens.

I just found the solution for this as I was trying to do the same thing myself. You can find fsl-imx8mm-evk-m4.dts at arch/arm64/boot/dts/freescale/fsl-imx8mm-evk-m4.dtb in linux-toradex. I’m on branch toradex_4.14-2.3.x-imx.

However do NOT use that DTB on its own as it will stall since it’s missing some information present in the Verdin DTBs. Instead, copy fsl-imx8mm-verdin-wifi-dev.dts to a new file fsl-imx8mm-verdin-wifi-dev-m4.dts and add the &rpmsg section in fsl-imx8mm-evk-m4.dtb. The end result should look similar to this:

// SPDX-License-Identifier: GPL-2.0+ OR MIT
/*
 * Copyright 2019 Toradex
 */

/dts-v1/;

#include "fsl-imx8mm-verdin-wifi.dtsi"
#include "fsl-imx8mm-verdin-dev.dtsi"

/ {
        model = "Toradex Verdin iMX8M Mini WB on Verdin Development Board";
        compatible = "toradex,verdin-imx8mm-wifi-dev",
                     "toradex,verdin-imx8mm-wifi", "fsl,imx8mm";
};

&rpmsg{
        /*
         * 64K for one rpmsg instance:
         * --0xb8000000~0xb800ffff: pingpong
         */
        vdev-nums = <1>;
        reg = <0x0 0xb8000000 0x0 0x10000>;
        status = "okay";
};

Now compile the new fsl-imx8mm-verdin-wifi-dev-m4.dtb and try again. That is what made it work for me.

Hi @spasoye,

Can you also give the solution @namundsen shared, a try as well.

Best Regards,
Jeremias

Of course, just to get my head around how to compile .dts file.

@namundsen, @jeremias.tx I think I figured out what I was doing wrong.

I managed to setup toolchain and run linux-toradex repo make on my host PC.
I created fsl-imx8mm-verdin-wifi-dev-m4.dts, add it to Makefile and successfully run
make dtbs. fsl-imx8mm-verdin-wifi-dev-m4.dtb was created.

I decided to compare it to the fsl-imx8mm-verdin-wifi-dev.dtb and
it seems that those two .dtb’s are the same.

I copied it to the Verdin /boot/ostree/torizon-number/dtb/ insted of old fsl-imx8mm-verdin-wifi-dev.dtb
and got rpmsg pingpong example to work.

It seems that 4.14.170-4.0.0-devel+git.62ad468b3107 #1-TorizonCore version that I installed using
EasyInstaller is based on old fsl-imx8mm-verdin.dtsi. I opened dtsi in toradex_4.14-2.3.x-imx branch it up and I found this:

&rpmsg{
	/*
	 * 64K for one rpmsg instance:
	 * --0xb8000000~0xb800ffff: pingpong
	 */
	vdev-nums = <1>;
	reg = <0x0 0xb8000000 0x0 0x10000>;
	status = "okay";
};

Just a note for future reference, you can compile a dtb by name like this: make freescale/fsl-imx8mm-verdin-wifi-dev-m4.dtb

Thanks, I was looking for this. This will save me a loot of time.

Glad you were able to get the pinpong example working. Extra thanks to @namundsen for providing your own findings and insights.

Best Regards,
Jeremias

Hi there!

So i have the same Problem.
I have a verdin imx8mm 2gb wb it and a dahlia carrierboard.

software:

[upload|Ho/0PGNU9vkmePCo6jZOoeTmWyg=]

[upload|4kNM2z1kBC2+14ji64fxfE1OXJ0=]

I am new to embbeded Linux. I was able to copy the .dtb files from my system to my computer and decompiled them. The thing is, they look totally different than what i found on git. I searched for rpmsg and found that the status was set to “disabled”, so i changed it to “okay”, recompiled everything with the devicetreecompiler, which led me to this
error:

[upload|eA7GfADdlPcpi7tV9gVJeaY3bEQ=]

Now i found a blog post, about this problem here. I decided, that before i try their solution,
i could try the one here. So i downloaded the latest .dts, .dtsi files from the gitrepo.
I downloaded these files:

  • imx8mm-pinfunc.h imx8mm-verdin.dtsi
  • imx8mm-verdin-dahlia.dtsi
  • imx8mm-verdin-dev.dtsi
  • imx8mm-verdin-nonwifi.dtsi
  • imx8mm-verdin-nonwifi-dahlia.dts
  • imx8mm-verdin-nonwifi-dev.dts
  • imx8mm-verdin-wifi.dtsi
  • imx8mm-verdin-wifi-dahlia.dts
  • imx8mm-verdin-wifi-dev.dts

I added this codesection in imx8mm-verdin-wifi-dev.dts:

 &rpmsg{
         /*
          * 64K for one rpmsg instance:
          * --0xb8000000~0xb800ffff: pingpong
          */
         vdev-nums = <1>;
         reg = <0x0 0xb8000000 0x0 0x10000>;
         status = "okay";
 };

and, again tried to recompile it with the devicetreecompiler. Which led to this error:

dtc -I dts -O dtb imx8mm-verdin-wifi-dev.dts > imx8mm-verdin-wifi-dev.dtb
Error: imx8mm-verdin-wifi-dev.dts:8.1-9 syntax error
FATAL ERROR: Unable to parse input tree

After that i tried it without the codesection and got the same Error. So right now, i am just
able to decompile and compile .dtb and .dts which i copied from the board to my PC.

My Questions:

1.) Why can’t i use the devicetree compiler for this?
2.) What is the proper workflow here? How did you download and compile the files? Which files over all did you download?
3.) I saw that there are .c and .h files included in the .dts files. Do i also have to download these?
4.) When i copied the .dtb files to my computer and then decompiled them it didn’t look like what is on git. Why is that?

I read the toradex article Build U-Boot and Linux Kernel from Source Code, but i didn’t get any further, i also checked the “Devicetree for dummies” mentioned a lot. But again, i am no step closer to get rpmsg to work.
I am new to this forum and to embedded Linux. Please excuse me if this is a stupid question.
Thanks a lot for taking the time to read this. And thanks even more if you decide to help me.
Have a nice day :smiley:

Hey @tadegiac,

(1,2,3) this was my workflow for building .dtb files.

Download linux-toradex repo:

git clone -b YOUR_VERSION_BRANCH http://git.toradex.com/cgit/linux-toradex.git

Setup your toolchain:

export ARCH="arm64"
export DTC_FLAGS='-@'
export PATH=~/gcc-linaro/bin/:$PATH
export CROSS_COMPILE="aarch64-linux-gnu-"

You can create export_script.sh, but you have to run it like this:

source ./export_script.sh

Go to freescale dts folder:

cd linux-toradex/arch/arm64/boot/dts/freescale

Put your custom.dts here.

Add your .dts target to Makefile:

dtb-$(CONFIG_ARCH_MXC) += imx8mm-evk.dtb imx8mm-evk-rpmsg.dtb 
                          ...
                          ...
                          custom.dtb \
                          ...

Now return to repo root and run (there is dtc in linux repo):

make freescale/custom.dtb

If everything goes ok .dtbo should be saved in /arch/arm64/boot/dts/freescale.

(4)There is little chance for decompiled .dtb to look like original .dts.