Hey,
I am attempting to change the firmware that is running on one of the M4 cores of the iMX8QM-MEK by using an .elf file compiled using MCUXpresso IDE. I have copied both the .elf file and the .bin file to the boot SD and configured U-boot to load the .bin image to the M4 core by changing:
=> print m4_0_image
m4_0_image=hello_world_m40.bin
I am running into some peculiar issues regarding the remote core in both U-boot and the kernel. First of all, it seems that this power mode switching task runs before U-boot prints its first lines to the console, which might indicate that something is happening in SFCW.
In U-boot, when I Interrupt auto-boot and run the booting script, I get the following:
=> print m4boot_0
m4boot_0=run loadm4image_0; dcache flush; bootaux ${loadaddr} 0
=> print loadm4image_0
loadm4image_0=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${m4_0_image}
=> run m4boot_0
14800 bytes read in 10 ms (1.4 MiB/s)
## Auxiliary core is already up
And when I boot into the kernel and read the state of remoteproc0 I get the following state, which disallows me from loading any firmware to the core, or stopping the core:
root@imx8qmmek:~# cat /sys/class/remoteproc/remoteproc0/state
attached
root@imx8qmmek:~# echo stop > /sys/class/remoteproc/remoteproc0/state
[ 84.896858] imx-rproc imx8qm-cm4-0: Failed to stop remote core
[ 84.902759] remoteproc remoteproc0: can't stop rproc: -13
-sh: echo: write error: Permission denied
Looking at dmesg yields:
root@imx8qmmek:~# dmesg | grep rproc
[ 3.022630] remoteproc remoteproc0: imx-rproc is available
[ 3.031813] remoteproc remoteproc0: attaching to imx-rproc
[ 3.043022] rproc-virtio rproc-virtio.1.auto: assigned reserved memory node vdevbuffer@90400000
[ 3.057679] rproc-virtio rproc-virtio.1.auto: registered virtio0 (type 7)
[ 3.064485] rproc-virtio rproc-virtio.2.auto: assigned reserved memory node vdevbuffer@90400000
[ 3.085832] rproc-virtio rproc-virtio.2.auto: registered virtio1 (type 7)
[ 3.092648] remoteproc remoteproc0: remote processor imx-rproc is now attached
[ 3.101451] remoteproc remoteproc1: imx-rproc is available
[ 3.107032] remoteproc remoteproc1: attaching to imx-rproc
[ 3.113075] rproc-virtio rproc-virtio.3.auto: assigned reserved memory node vdevbuffer@90400000
[ 3.127700] rproc-virtio rproc-virtio.3.auto: registered virtio2 (type 7)
[ 3.141984] rproc-virtio rproc-virtio.4.auto: assigned reserved memory node vdevbuffer@90400000
[ 3.163620] rproc-virtio rproc-virtio.4.auto: registered virtio3 (type 7)
[ 3.177037] remoteproc remoteproc1: remote processor imx-rproc is now attached
I'm not sure how to stop the remote core so that I can swap the firmware in the linux kernel instead of via U-boot, and I cannot find any information on the attached state for remoteproc.
If it's not possible to stop the core in U-boot, and only start it, how can I prevent whatever process runs before U-boot from starting the core, so that I can start it in U-boot or in the kernel?
I built my bootable .wic file using Yocto poky 5.0.4 scarthgap.
--- U-Boot info ---
U-Boot SPL 2024.04-lf_v2024.04+g6c4545203d1+p0 (Nov 15 2024 - 04:02:13 +0000)
Normal Boot
Trying to boot from MMC2_2
Primary set selected
Load image from MMC/SD 0x7c800
U-Boot 2024.04-lf_v2024.04+g6c4545203d1+p0 (Nov 15 2024 - 04:02:13 +0000)
CPU: NXP i.MX8QM RevB A53 at 1200 MHz at 26C
Model: NXP i.MX8QM MEK
Board: iMX8QM MEK
Boot: SD1
Reset cause: POR
DRAM: 5.8 GiB
TCPC: Vendor ID [0x1fc9], Product ID [0x5110], Addr [I2C0 0x51]
Core: 188 devices, 32 uclasses, devicetree: separate
MMC: FSL_SDHC: 0, FSL_SDHC: 1
Loading Environment from MMC... OK
[*]-Video Link 0it6263_i2c_reg_read, read err 3
faill to read from it6263 revision, ret 3
(1280 x 720)
[0] dpu@56180000, video
[1] lvds-channel@0, display
[2] lvds-to-hdmi-bridge@4c, video_bridge
In: serial
Out: serial
Err: serial
BuildInfo:
- SCFW 83624b99, SECO-FW 7d5462e6, IMX-MKIMAGE 71b8c18a, ATF android
- U-Boot 2024.04-lf_v2024.04+g6c4545203d1+p0
switch to partitions #0, OK
mmc1 is current device
flash target is MMC:1
Net: eth0: ethernet@5b040000 [PRIME]Could not get PHY for FEC1: addr 1
Fastboot: Normal
Normal Boot
Hit any key to stop autoboot: 0
=> bdinfo
boot_params = 0x0000000000000000
DRAM bank = 0x0000000000000000
-> start = 0x0000000080200000
-> size = 0x0000000007e00000
DRAM bank = 0x0000000000000001
-> start = 0x0000000092000000
-> size = 0x000000006c000000
DRAM bank = 0x0000000000000002
-> start = 0x0000000880000000
-> size = 0x0000000100000000
flashstart = 0x0000000000000000
flashsize = 0x0000000000000000
flashoffset = 0x0000000000000000
baudrate = 115200 bps
relocaddr = 0x0000000087627000
reloc off = 0x0000000007607000
Build = 64-bit
current eth = ethernet@5b040000
ethaddr = 00:04:9f:06:5e:76
IP addr = <NULL>
fdt_blob = 0x0000000085215210
new_fdt = 0x0000000085215210
fdt_size = 0x0000000000011b20
Video = dpu@56180000 active
FB base = 0x0000000087700000
FB size = 1280x720x32
lmb_dump_all:
memory.cnt = 0x3 / max = 0x10
memory[0] [0x80200000-0x87ffffff], 0x07e00000 bytes flags: 0
memory[1] [0x92000000-0xfdffffff], 0x6c000000 bytes flags: 0
memory[2] [0x880000000-0x97fffffff], 0x100000000 bytes flags: 0
reserved.cnt = 0x2 / max = 0x10
reserved[0] [0x85210ba0-0x87ffffff], 0x02def460 bytes flags: 0
reserved[1] [0x90000000-0x91ffffff], 0x02000000 bytes flags: 4
devicetree = separate
arch_number = 0x0000000000000000
TLB addr = 0x0000000087f50000
irq_sp = 0x0000000085215200
sp start = 0x0000000085215200
Early malloc usage: 28e0 / 8000
--- Kernel info ---
root@imx8qmmek:~# uname -a
Linux imx8qmmek 6.6.52-lts-next-ge0f9e2afd4cf #1 SMP PREEMPT Tue Nov 19 23:01:49 UTC 2024 aarch64 GNU/Linux