M4 code incorporated into imx-boot halts after a second

I’m having an issue with creating a custom bootloader for a IMX8 QM 1.1C on the eval board.

I modified the helloworld mek demo on the M4 core 0 to print “Hello!” repeatedly. If I install the 5.4.0 reference image and load the bin file at boot using the following command it works fine:

fatload mmc 2 ${loadaddr} hello_world_m40.bin && dcache flush && bootaux ${loadaddr} 0

However, if I follow this tutorial:


…and incorporate my m4 core into u-boot using mkimage using this command:

 ./../mkimage_imx8 -soc QM -rev B0 -append mx8qmb0-ahab-container.img -c -scfw scfw_tcm.bin -ap u-boot-atf.bin a53 0x80000000  -m4 ~/input/m40_image.bin 0 0x34FE0000 -out imx-boot

replacing the bootloader in the root directory of my image and using the easy installer OR flashing using the uuu.exe results in the M4 core running for about a second (half a dozen “hello!”).

I’m guessing something is happening with the other cores on boot that interferes. Have i made any mistakes with u-boot or can I delay the M4 cores from booting until a few seconds after linux boots?



This sounds very similar to a problem my colleague had - the same symptom - which was due to a peripheral sharing a clock signal with the M4. When linux was booted, the peripheral was disabled, and the clock with it.

BUT this was on an MX7 device - yours may be different. AND my colleague is not at his desk for a few days and I don’t remember the details. I have a feeling it was the SPI device.


I’m not so sure I could be that as all of this happens before I boot linux. At the moment if i use the following post as a guide:

I get this at boot:

Hit any key to stop autoboot:  0
switch to partitions #0, OK
mmc0(part 0) is current device
Scanning mmc 0:1...
Found U-Boot script /boot.scr
1182 bytes read in 13 ms (87.9 KiB/s)
## Executing script at 83100000
** Reading file would overwrite reserved memory **
## Error: "bootcmd_run" not defined
SCRIPT FAILED: continuing...
Apalis iMX8 #

So i’m really not sure what I can do.

Hi @EvoFrank ,

If you have an error like:

Its a good indication that there is a missed assignment inside boot.scr.
Did you have a look at the boot.scr file inside the Toradex Easy Installer?
There you can see how Toardex dealt with it.

Would it be possible that you to attach your boot.scr here?

Best Regards

Hi Kevin,

I haven’t modified the boot.scr from the reference image, it is still:

# Copyright 2020 Toradex
# TorizonCore boot script.

if test -z "${altbootcmd}"
    env set altbootcmd 'env set rollback 1; run bootcmd'
    env save

if test "${rollback}" = "1" && test "${upgrade_available}" = "1"
    # Make sure to reset upgrade_available to avoid unnecessary wear
    # Note this also makes rollback permanent. aktualizr will reset rollback
    # when a new (hopefully better) update comes in.
    env set upgrade_available 0
    env save

# save default U-Boot devicetree file to use in a rollback situation
env set fdtfile2 "${fdtfile}"

if test ${devtype} != ubi
    if test -n "${loadaddr}"
        ext4load ${devtype} ${devnum}:1 ${loadaddr} /boot/loader/uEnv.txt; env import -t ${loadaddr} ${filesize}
        ext4load ${devtype} ${devnum}:1 ${scriptaddr} /boot/loader/uEnv.txt; env import -t ${scriptaddr} ${filesize}
    ubifsmount ${devtype}${devnum}:rootfs && load ${devtype} ${devnum}:0 ${loadaddr} /boot/loader/uEnv.txt; env import -t ${loadaddr} ${filesize}

run bootcmd_run

The uEnv.txt, again isn’t modified from stock.

bootargs=quiet logo.nologo vt.global_cursor_default=0 plymouth.ignore-serial-consoles splash fbcon=map:3 ostree=/ostree/boot.1/torizon/a365050f574bcc7d045a18af3273d04163ad1c0752f3369effcba07d8523a691/0

set_bootargs=if test ${devtype} != ubi; then \
                 # Load commands for regular block devices \
                 env set bootcmd_args env set bootargs ${defargs} root=LABEL=otaroot rootfstype=ext4 ${bootargs} ${tdxargs}; \
             else \
                 # Load commands for raw NAND devices \
                 env set bootcmd_args env set bootargs ${defargs} ubi.mtd=ubi root=/dev/ubi0_0 rootfstype=ubifs ubi.fm_autoconvert=1 ${bootargs} ${tdxargs}; \
             fi || true

set_kernel_load_addr=if test ${kernel_image_type} = "Image.gz"; then \
    env set kernel_addr_load ${loadaddr}; \
    env set bootcmd_unzip_k 'unzip $kernel_addr_load $kernel_addr_r'; \
else \
    env set kernel_addr_load ${kernel_addr_r}; \
    env set bootcmd_unzip_k ';'; \
fi || true

load_overlay=load ${devtype} ${devnum}:${otaroot} ${loadaddr} /boot${fdtdir}/${overlays_file}; env import -t ${loadaddr} ${filesize}
apply_overlays=fdt addr ${fdt_addr_r} && fdt resize 0x20000 && \
               for overlay_file in ${fdt_overlays}; do \
                   echo "Applying Overlay: ${overlay_file}" && \
                   load ${devtype} ${devnum}:${otaroot} ${loadaddr} /boot${fdtdir}/overlays/${overlay_file} && fdt apply ${loadaddr}; \

bootcmd_load_k=load ${devtype} ${devnum}:${otaroot} ${kernel_addr_load} "/boot"${kernel_image}
bootcmd_load_r=load ${devtype} ${devnum}:${otaroot} ${ramdisk_addr_r} "/boot"${ramdisk_image}; env set ramdisk_size ${filesize}

# check kernel_image2 to avoid booting from other then default emmc in case of
# bootlimit is reached and there is no other deployed image
check_rollback_needed=if test -n "${kernel_image2}" && test "${rollback}" = "1"; then \
    echo "Rollback enabled. Booting previously deployed version."; \
    env set kernel_image ${kernel_image2}; \
    env set ramdisk_image ${ramdisk_image2}; \
    env set bootargs ${bootargs2}; \
    env set fdtdir ${fdtdir2}; \
    env set fdt_file ${fdt_file2}; \
    env set fdtfile ${fdtfile2}; \
fi || true

set_fdt_path=if test -n "${fdtdir}"; then \
                env set fdt_path /boot${fdtdir}/${fdtfile}; \
             else \
                env set fdt_path /boot${fdt_file}; \
             fi || true

bootcmd_dtb=load ${devtype} ${devnum}:${otaroot} ${fdt_addr_r} ${fdt_path}; \
            if test ${skip_fdt_overlays} != 1; then \
                    if test -e ${devtype} ${devnum}:${otaroot} /boot${fdtdir}/${overlays_file}; then \
                        run load_overlay && run apply_overlays || true; \
                    fi || true; \
            fi || true

set_bootargs_custom=if test -n "${fdt_overlays}"; then \
                        for overlay_file in ${fdt_overlays}; do \
                            if test "${overlay_file}" = "custom-kargs_overlay.dtbo"; then \
                                if fdt get value custom_kargs /chosen/ bootargs_custom; then \
                                    env set bootargs ${bootargs} ${custom_kargs}; \
                                fi; \
                            fi; \
                        done; \
                    fi || true

board_fixups=if test "${board}" = "verdin-imx8mm"; then \
                 if test "${fdtfile}" = "imx8mm-verdin-nonwifi-v1.1-dahlia.dtb"; then \
                     env set fdtfile imx8mm-verdin-nonwifi-dahlia.dtb; \
                 elif test "${fdtfile}" = "imx8mm-verdin-nonwifi-v1.1-dev.dtb"; then \
                     env set fdtfile imx8mm-verdin-nonwifi-dev.dtb; \
                 elif test "${fdtfile}" = "imx8mm-verdin-wifi-v1.1-dahlia.dtb"; then \
                     env set fdtfile imx8mm-verdin-wifi-dahlia.dtb; \
                 elif test "${fdtfile}" = "imx8mm-verdin-wifi-v1.1-dev.dtb"; then \
                     env set fdtfile imx8mm-verdin-wifi-dev.dtb; \
                 fi; \
             fi || true

nand_fixups=if test ${devtype} = ubi; then \
    setexpr kernel_image sub "/boot" "" ${kernel_image}; \
    setexpr ramdisk_image sub "/boot" "" ${ramdisk_image}; \
    setexpr fdtdir sub "/boot" "" ${fdtdir}; \
    if test -n "${kernel_image2}"; then \
        setexpr kernel_image2 sub "/boot" "" ${kernel_image2}; \
        setexpr ramdisk_image2 sub "/boot" "" ${ramdisk_image2}; \
        setexpr fdtdir2 sub "/boot" "" ${fdtdir2}; \
    fi || true; \
fi || true

bootcmd_boot=booti ${kernel_addr_r} ${ramdisk_addr_r}:${ramdisk_size} ${fdt_addr_r}
bootcmd_run=run board_fixups && run nand_fixups && run check_rollback_needed && run set_bootargs && run set_fdt_path && \
            run bootcmd_dtb && run bootcmd_args && run set_bootargs_custom && run set_kernel_load_addr && \
            run bootcmd_load_k && run bootcmd_unzip_k && run bootcmd_load_r && run bootcmd_boot

I don’t understand the sudden change in behaviour. Perhaps I can ask a different question; does anyone at torizon have a sound method to get the M4 cores on a imx8 to run automatically at boot? At the moment that’s all i’m trying to achieve. (I’m guessing i might be able to boot them from SD by modifying the boot script.)

I still have this issue. I’m unable to get hold of anyone at Toradex.

Hi @EvoFrank

Sorry for the lack of communication here.

According to email exchanges, seems like you were able to overcome this question, right?

If yes could you please comment about it?

Best regards,


So by following a post here https://community.toradex.com/t/i-mx8qm-u-boot-is-conflicting-with-m4-0-m4-1-ddr-aliasing-memory-region/14087 and having discussions with the author I was able to partition the M4 cores correctly IF I used an older commit of u-boot-toradex (June 2021) and BSP version 5.3.0. If I try and use the current u-boot-toradex and BSP 5.5.0 it does not work.

I’m going to state that its very disconcerting that the provider of an embedded solution doesn’t seem to have comprehensive knowledge of their own system. The iMX8 is attractive to us for the heterogeneity, that’s the main selling point of the chip and Toradex seems to not be directly supporting that feature.