For the product I'm working on, we want to use the M4 for a particular feature.
I rather use remoteproc than U-Boot, to load the M4 firmware. I found that there is remoteproc support in the 5.4 Linux kernel.
I found that the MCUXpresso SDK for i.MX 8M Mini has some projects that can build ELF files suitable for loading with remoteproc. Eg under boards/evkmimx8mm/multicore_examples/rpmsg_lite_str_echo_rtos. I found that doing ./build_release.sh builds the ELF file to be loaded into TCM (tightly coupled memory) and remoteproc is able to load that.
I worked out the device tree changes I needed to make, by looking at imx8mm-evk-rpmsg.dts in the 5.4 kernel source.
So, I am having some success with my own code based off one of the NXP examples in the MCUXpresso SDK.
I had trouble once my M4 firmware got above a certain size, that it would no longer load. I found that the NXP kernel branch 5.4-2.3.x-imx has a fix for imx_rproc.c to combine TCMU and TCML into one block, which fixes this problem.
I was curious to know if I could compile my M4 code to run in DDR memory. I tried doing ./build_ddr_release.sh. I found that the remoteproc driver wasn't able to load it. I am a bit unsure if the M4 is really able to execute code at 0x80000000 (the address the example project links at). I wonder if I need to change the address specified in m4_reserved in the reserved-memory in the device tree, and add <&m4_reserved> to memory-region for imx8mm-cm4. Any advice on this would be appreciated.
It would be helpful for NXP to document this so it's easier to work it out (I really appreciate that these examples exist, but I did have to hunt for some time to find them and figure out how to use them successfully).
NXP provides a document called "Getting Started with MCUXpresso SDK for i.MX 8M Mini". Document Number MCUXSDKIMX8MMGSUG.
That document describes loading M4 firmware using U-Boot. It would be logical to update it to describe loading firmware using remoteproc, as well as building the ELF file that is suitable for use with remoteproc.