Linux won't boot when autostarting M4 application on iMX7

I’m testing Zephyr on the iMX7’s M4 core. I’ve compiled a simple Hello World example and it works by loading the file via TFTP and running bootaux:

Colibri iMX7 # tftp ${loadaddr} zephyr.elf
Colibri iMX7 # bootaux ${loadaddr}

And on the UART_B terminal:

***** Booting Zephyr OS v1.12.0-1250-g5c8398da0 *****
Hello World! arm

However, I want to store the firmware on flash and run it on boot. Storing the firmware using Linux

root@colibri-imx7:~# ubiupdatevol /dev/ubi0_2 zephyr.elf

Colibri iMX7 # setenv m4boot 'ubi read ${loadaddr} m4firmware && bootaux ${loadaddr}'
Colibri iMX7 # saveenv

Upon booting, I get

U-Boot 2016.11-2.7.4+g1b121c6 (Oct 05 2017 - 03:53:41 +0000)

CPU:   Freescale i.MX7D rev1.2 996 MHz (running at 792 MHz)
CPU:   Extended Commercial temperature grade (-20C to 105C) at 46C
Reset cause: POR
DRAM:  512 MiB
PMIC:  RN5T567 LSIVER=0x01 OTPVER=0x0d
NAND:  512 MiB
MMC:   FSL_SDHC: 0
Video: 640x480x18
In:    serial
Out:   serial
Err:   serial
Model: Toradex Colibri iMX7 Dual 512MB V1.1C, Serial# 02911197
Net:   FEC0
Hit any key to stop autoboot:  0 
Booting from NAND...
ubi0: default fastmap pool size: 200
ubi0: default fastmap WL pool size: 100
ubi0: attaching mtd1
ubi0: attached by fastmap
ubi0: fastmap pool size: 200
ubi0: fastmap WL pool size: 100
ubi0: attached mtd1 (name "mtd=4", size 508 MiB)
ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
ubi0: good PEBs: 4060, bad PEBs: 4, corrupted PEBs: 0
ubi0: user volume: 4, internal volumes: 1, max. volumes count: 128
ubi0: max/mean erase counter: 226/28, WL threshold: 4096, image sequence number: 2030421909
ubi0: available PEBs: 0, total reserved PEBs: 4060, PEBs reserved for bad PEB handling: 76
Read 0 bytes from volume m4firmware to 80800000
No size specified -> Using max size (296504)
## Starting auxiliary core at 0x1FFF93D9 ...
Read 0 bytes from volume kernel to 81000000
No size specified -> Using max size (5114608)
Read 0 bytes from volume dtb to 82000000
No size specified -> Using max size (45016)
Kernel image @ 0x81000000 [ 0x000000 - 0x4e0af0 ]
## Flattened Device Tree blob at 82000000
   Booting using the fdt blob at 0x82000000
   Using Device Tree in place at 82000000, end 8200dfd7
   Updating MTD partitions...

Starting kernel ...

And then it stops right there. The M4 firmware starts with the correct UART_B output, but the kernel won’t load.

Any steps I missed here?

Thanks.

Hi @gustavo.tx, have you tried disabling UART_B for Linux? A temporal fix is:

setenv fdt_fixup 'fdt addr ${fdt_addr_r} && fdt rm /soc/aips-bus@30800000/spba-bus@30800000/serial@30890000'

Hi @alvaro.tx! I forgot to mention it but it’s already disabled :frowning:

Does it work without booting the M4 core or with the Hello World example? Maybe something from Zephyr is interfiring.

It works without booting the M4 core. I’ve tried other Zephyr demos and some FreeRTOS examples and it also doesn’t work so I think it’s not related to that.

Fixed it. It was application-related. I think I built the firmware for the SRAM instead of FLASH. Recompiled it for FLASH and it works.