We have a custom Yocto build based on the 5.4.70 Yocto release. In U-boot I am able to load and start the M4 process and get the following message from the serial port:
RPMSG String Echo FreeRTOS RTOS API Demo...
I then try to load the imx_rpmsg_tty driver in Linux by doing the following:
insmod /lib/modules/5.4.70+g5ca957774d45/kernel/drivers/rpmsg/imx_rpmsg_tty.ko
I never received any messages in the kernel log, so I added a print statement in the init function of the imx_rpmsg_tty.c file. Now when I insmod the driver I get the print statement, but the probe function is not called.
static int __init init(void)
{
printk("NLB imx_rpmmsg_tty\n");
return register_rpmsg_driver(&rpmsg_tty_driver);
}
I do see the imx_rpmsg driver registered on bootup:
[ 0.079095] imx rpmsg driver is registered.
[ 0.721916] mmcblk0rpmb: mmc0:0001 S0J35A partition 3 4.00 MiB, chardev (239:0)
[ 58.720062] NLB imx_rpmmsg_tty
[ 158.781342] NLB imx_rpmmsg_tty
But I don't see the imx_rpmsg_tty device in the dev nodes (/dev). I suspect it has something to do with the device tree. I do have memory reserved. I have also tried to set the rpmsg node to okay:
&rpmsg{
/*
* 64K for one rpmsg instance:
*/
vdev-nums = <2>;
reg = <0x0 0x90000000 0x0 0x20000>;
memory-region = <&vdevbuffer>;
status = "okay";
};
When I do that I get an error with the imx_rpmsg driver:
[ 0.079195] imx rpmsg driver is registered.
[ 0.723292] mmcblk0rpmb: mmc0:0001 S0J35A partition 3 4.00 MiB, chardev (239:0)
[ 1.006545] imx-rpmsg: probe of 90000000.rpmsg failed with error -16
When I look through the imx_rpmsg driver, it has references to sound stuff. Can anyone point me in the right direction?
Hello,
Please try with modprobe instead of insmod, i.e.
$ modprobe imx_rpmsg_tty
After this you may check if the module installed by using lsmod.
Best regards,
Aldo.
The same result occurs after running modprobe imx_rpmsg_tty.
Output of DMESG:
[ 5.237891] systemd[1]: system-getty.slice: unit configures an IP firewall, but the local system does not support BPF/cgroup firewalling.
[ 5.250295] systemd[1]: (This warning is only shown for the first unit using IP firewalling.)
[ 5.261730] systemd[1]: Created slice system-getty.slice.
[ 5.280802] systemd[1]: Created slice system-serial\x2dgetty.slice.
[ 5.300669] systemd[1]: Created slice User and Session Slice.
[ 6.085989] systemd-journald[287]: Received client request to flush runtime journal.
[ 7.206992] [VPU Encoder] enable mu for core[0]
[ 7.220616] [VPU Encoder] vpu encoder core[0] firmware version is 1.3.0
[ 7.276604] atmel_mxt_ts 16-004a: mxt_start: Starting . . .
[ 7.423597] atmel_mxt_ts 16-004a: mxt_stop: Stopping . . .
[ 9.123410] fsl-audmix 59840000.amix: Started TDM1 needed for config propagation!
[ 18.948057] audit: type=1006 audit(1638305278.216:2): pid=405 uid=0 old-auid=4294967295 auid=0 tty=(none) old-ses=4294967295 ses=1 res=1
[ 19.535593] audit: type=1006 audit(1638305278.804:3): pid=402 uid=0 old-auid=4294967295 auid=0 tty=(none) old-ses=4294967295 ses=2 res=1
Looking at /dev shows no ttyRPMSG node:
autofs gpiochip3 iio:device7 mmcblk0 ptyp3 seco_mu1_ch3 tty11 tty29 tty46 tty63 ttypa vcsa3
block gpiochip4 iio:device8 mmcblk0boot0 ptyp4 seco_mu2_ch0 tty12 tty3 tty47 tty7 ttypb vcsa4
bus gpiochip5 iio:device9 mmcblk0boot1 ptyp5 seco_mu2_ch1 tty13 tty30 tty48 tty8 ttypc vcsa5
caam-keygen gpiochip6 initctl mmcblk0p1 ptyp6 seco_mu2_ch2 tty14 tty31 tty49 tty9 ttypd vcsa6
char gpiochip7 input mmcblk0p2 ptyp7 seco_mu2_ch3 tty15 tty32 tty5 ttyLP0 ttype vcsu
console gpiochip8 ion mmcblk0rpmb ptyp8 seco_mu3_ch0 tty16 tty33 tty50 ttyS0 ttypf vcsu1
cpu_dma_latency hugepages kmsg mqueue ptyp9 seco_mu3_ch1 tty17 tty34 tty51 ttyS1 ubi_ctrl vcsu2
cuse hwrng kvm mxc_asrc ptypa seco_mu3_ch2 tty18 tty35 tty52 ttyS2 urandom vcsu3
disk i2c-16 log mxc_hifi4 ptypb seco_mu3_ch3 tty19 tty36 tty53 ttyS3 v4l vcsu4
dri iio:device0 loop-control net ptypc secvio-sc tty2 tty37 tty54 ttyp0 vcs vcsu5
fb0 iio:device1 loop0 null ptypd shm tty20 tty38 tty55 ttyp1 vcs1 vcsu6
fd iio:device10 loop1 port ptype snd tty21 tty39 tty56 ttyp2 vcs2 vfio
fsl-usdpaa-irq iio:device11 loop2 pps0 ptypf stderr tty22 tty4 tty57 ttyp3 vcs3 vga_arbiter
full iio:device12 loop3 ptmx random stdin tty23 tty40 tty58 ttyp4 vcs4 vhci
fuse iio:device2 loop4 ptp0 rtc stdout tty24 tty41 tty59 ttyp5 vcs5 video12
galcore iio:device3 loop5 pts rtc0 tty tty25 tty42 tty6 ttyp6 vcs6 video13
gpiochip0 iio:device4 loop6 ptyp0 seco_mu1_ch0 tty0 tty26 tty43 tty60 ttyp7 vcsa watchdog
gpiochip1 iio:device5 loop7 ptyp1 seco_mu1_ch1 tty1 tty27 tty44 tty61 ttyp8 vcsa1 watchdog0
gpiochip2 iio:device6 mem ptyp2 seco_mu1_ch2 tty10 tty28 tty45 tty62 ttyp9 vcsa2 zero
Hi,
This may be caused by how are you loading and starting the Cortex-M4, for i.MX8QM, SCU_ROM will handle the load of M4 binary code. SCU will create a seperate resource partition(generally partition 3) and based on that partition, there would be resource isolation(including memory region) between M core and A core.
To flash your own M4 image, please follow SDK doc "Getting Started with MCUXpresso SDK for MEK-MIMX8QM" - "Run a demo using imx-mkimage".You need to build a flash.bin file with M4 by imx-mkimage, using "make SOC=iMX8QM flash_linux_m4"
Please try it and let me now of your results.
Best regards,
Aldo.
I've tried many different ways to get the M4 up and running. This has been an extremely painful process. I've used the i.MX Linux Reference manual dated 30 Sept 2021. I've also used the AN5317 app note. But there are many gaps in the explanation of how things work. I've tried the following:
1) Get SCFW to load the M4. I was never able to get this working no matter what I tried.
2) Get u-boot to load the M4. I was able to get the M4 loaded and running. But as soon as u-boot loaded the Kernel but prior to it actually transferring control, it appears to stop the M4.
3) Get Linux to load the M4. This works and is the method I am pursing.
For one boot cycle I was able to get the /dev/ttyRPMSG30 to show up. But now I can't get it to work. It must be some sort of order of operations. Currently I have systemd loading the imx_rpmsg_tty.ko via /etc/modules.d.
Then I have a script that loads the M4 firmware later on. The M4 starts up and I see it register the RPMSG interface. But a /dev/ttyRPMSG dev node never shows up, so I can't communicate with the M4.
Ah, it seems the kernel module has to be loaded AFTER the M4 code is running. This is horribly broken. Why can't I load the kernel module first!!!