Hi @vix,
Sorry for the delay. I was making sure everything worked on my side before posting the reply. Thanks for your patience.
I’ll describe the steps required and also the necessary file. Let me know if something is not clear.
First things first, we have two options to boot the cortex M4: using u-boot to launch the coprocessor with the “bootaux” command or using the remoteproc framework, which allows you to load the and start the M4 using the Linux Kernel userspace.
I managed to get both of them working, so let’s start with u-boot.
- On TorizonCore 6 and BSP 6, the “bootaux” command is not yet available on u-boot (more information here: Bootaux command in u-boot and boot m4/m7 aux cpu). We’re still under development and this feature will be enabled soon. So, in order to do that, I built my own TorizonCore image with Yocto where I enabled the bootaux with the following u-boot patch:
diff --git a/configs/verdin-imx8mm_defconfig b/configs/verdin-imx8mm_defconfig
index 46d4dd7210..6c3dbfbeaa 100644
--- a/configs/verdin-imx8mm_defconfig
+++ b/configs/verdin-imx8mm_defconfig
@@ -110,3 +110,4 @@ CONFIG_USB=y
CONFIG_USB_EHCI_HCD=y
CONFIG_IMX_WATCHDOG=y
CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_IMX_BOOTAUX=y
As I already built the image, there is no need for you to build it too, I uploaded the TocrizonCore image with “bootaux” enabled here: https://share.toradex.com/kezy53sdk0zf3v3
-
Now, you can follow this guide on how to load your rpmsg binary: High performance, low power Embedded Computing Systems | Toradex Developer Center. Here I tested with the multicore_examples/rpmsg_lite_str_echo_rtos
demo.
-
In order to enable the rpmsg, please use this overlay:
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/*
* Copyright 2022 Toradex
*/
/dts-v1/;
/plugin/;
#include <dt-bindings/clock/imx8mm-clock.h>
/ {
compatible = "toradex,verdin-imx8mm";
};
&{/} {
/* Remote proc device */
imx8mm-cm4 {
compatible = "fsl,imx8mm-cm4";
rsc-da = <0xb8000000>;
clocks = <&clk IMX8MM_CLK_M4_DIV>;
mbox-names = "tx", "rx", "rxdb";
mboxes = <&mu 0 1
&mu 1 1
&mu 3 1>;
memory-region = <&vdevbuffer>, <&vdev0vring0>, <&vdev0vring1>, <&rsc_table>, <&m4_reserved>;
syscon = <&src>;
fsl,startup-delay-ms = <500>;
};
};
/* M4 Code reserved area */
&resmem {
m4_reserved: m4@0x80000000 {
no-map;
reg = <0 0x80000000 0 0x1000000>;
};
vdev0vring0: vdev0vring0@b8000000 {
reg = <0 0xb8000000 0 0x8000>;
no-map;
};
vdev0vring1: vdev0vring1@b8008000 {
reg = <0 0xb8008000 0 0x8000>;
no-map;
};
rsc_table: rsc_table@b80ff000 {
reg = <0 0xb80ff000 0 0x1000>;
no-map;
};
vdevbuffer: vdevbuffer@b8400000 {
compatible = "shared-dma-pool";
reg = <0 0xb8400000 0 0x100000>;
no-map;
};
};
/* Enable Mailbox Unit */
&mu {
status = "okay";
};
You can download the compiled version here (which is also already enabled on the image that I sent you): https://share.toradex.com/l9o0a959wxy5f4c
- Finally, load the kernel module, and the rpmsg should work on your system:
$ sudo modprobe imx_rpmsg_tty
Now, if you don’t want to install the custom image to enable the bootaux feature, you can use the remoteproc device.
- Boot your device with the same overlay shown above.
- Compile your M4 binary with NXP SDK and copy it to your module. In this case, you will need to use the elf version, in this case,
rpmsg_lite_str_echo_rtos_imxcm4.elf
was used.
- You will need to copy this firmware to the /lib/firmware folder. TorizonCore is read-only, so you can remount this folder as “rw” and move the firmware there. Be aware that this approach should be used only for testing purposes.
$ sudo mount -o remount,rw /usr/
$ sudo mv rpmsg_lite_str_echo_rtos_imxcm4.elf /lib/firmware
- Now execute the following commands to boot your remote processor:
$ sudo -s
$ cd /sys/class/remotreproc/remoteproc0/
$ echo stop > state
$ echo rpmsg_lite_str_echo_rtos_imxcm4.elf > firmware
$ echo start > state
Now your M4 will boot with the RPMSG demo (don’t forget to sudo modprobe imx_rpmsg_tty
as well).
torizon@verdin-imx8mm-06827384:~$ dmesg | grep -i -E "(rpmsg|rproc)"
[ 0.030312] imx rpmsg driver is registered.
[ 1.303734] remoteproc remoteproc0: imx-rproc is available
[ 1.303780] remoteproc remoteproc0: attaching to imx-rproc
[ 1.304347] virtio_rpmsg_bus virtio0: creating channel rpmsg-virtual-tty-channel-1 addr 0x1e
[ 1.304435] virtio_rpmsg_bus virtio0: rpmsg host is online
[ 1.304466] remoteproc remoteproc0: remote processor imx-rproc is now attached
[ 45.078466] imx_rpmsg_tty virtio0.rpmsg-virtual-tty-channel-1.-1.30: new channel: 0x400 -> 0x1e!
[ 45.078989] Install rpmsg tty driver!
[ 45.084112] rpmsg_tty_cb68 65 6c 6c 6f 20 77 6f 72 6c 64 21 hello world!
[ 53.630543] rpmsg_tty_cb68 69 61 67 6f hiago
[ 53.632899] rpmsg_tty_cb0d 0a
Now about the TorizonCore part,
Were you able to use the tcbuild.yaml
?
Reference: TorizonCore Builder Tool - Customizing Torizon OS Images | Toradex Developer Center
Sorry for the huge reply, we’re still working to improve our HMP documentation. Let me know if you need anything else.
Best Regards,
Hiago.