i.MX7D M4 core FreeRTOS hello_world.elf not running after loading from U-Boot

Hello,

I am working on a Colibri iMX7D eMMC module with a Colibri Evaluation Board.
My goal is to run a FreeRTOS hello_world example on the M4 core.

What I did:

  1. Built the hello_world FreeRTOS example on my host PC.
  2. Copied the generated hello_world.elf to /home/root on the target (Linux running on A7).
  3. Interrupted U-Boot and tried the following commands:
load_cmd=ext4load mmc 0:2
m4image=/home/root/hello_world.elf
loadm4image= 0x84200000 /home/root/hello_world.elf
m4boot= 0x84200000 /home/root/hello_world.elf; dcache flush; bootaux 0x84200000
bootcmd=run m4boot; run m4boot; run m4boot; run distro_bootcmd
Colibri iMX7 # ext4load mmc 0:2 0x84200000 /home/root/hello_world.elf
164344 bytes read in 11 ms (14.2 MiB/s)
Colibri iMX7 # dache flush
Unknown command 'dache' - try 'help'
Colibri iMX7 # dcache flush
Colibri iMX7 # bootauc 0x84200000
Unknown command 'bootauc' - try 'help'
Colibri iMX7 # bootaux 0x84200000
## Starting auxiliary core stack = 0x00000000, pc = 0x1FFF807D...
Colibri iMX7 #

But after that, nothing is printed from the hello_world program.

Additional Info:

  • I have disabled UART_B in the device tree.
  • FreeRTOS is configured to print via M4 UART.
  • Linux is running on the A7 core.
  • I expected the hello_world message to appear on the serial console but it does not.

Question:

  • Am I missing a step to start the M4 core from U-Boot?
  • Do I need to configure the UART differently to see the hello_world output?
  • Is /home/root/hello_world.elf the correct path to load from ext4load?

Any guidance or example sequence for running M4 FreeRTOS applications from U-Boot on Colibri iMX7D would be greatly appreciated.

referred websites
Running freertos on m4 core

How to load compiled binaries imx7d emmc

Thanks in advance!

Hi, I’m the Toradex AI Assistant.

I might make mistakes. Our support team will step in if needed. If I answered your question, please tick the “Solution” checkbox. For follow-up questions to me, please use @ToradexAI in your post.

Did you like my answer? :+1: :-1:


Hello! Thank you for your detailed description and for sharing your progress. Let’s go through your questions and clarify the steps for running a FreeRTOS hello_world example on the Cortex-M4 of the Colibri iMX7D eMMC module using U-Boot.


1. Proper Sequence to Run M4 FreeRTOS via U-Boot

The correct steps for your setup are as follows:

  1. Copy the .elf File:

    • Place the generated hello_world.elf onto the Linux root filesystem (which is the second partition, /home/root/hello_world.elf works if /home/root is on that partition).
  2. U-Boot Commands:

    • Interrupt U-Boot startup.

    • Load the firmware using:

      ext4load mmc 0:2 ${loadaddr} hello_world.elf
      
      • ${loadaddr} is typically set to something like 0x80800000 or 0x84200000.
      • The path should be hello_world.elf, the path must be relative to the root of partition 2 of your eMMC, not the Linux root. If you copied it to /home/root/ with Linux, then from the U-Boot perspective, that is simply /home/root/hello_world.elf.
    • Start the M4 core:

      bootaux ${loadaddr}
      

Example:

ext4load mmc 0:2 ${loadaddr} /home/root/hello_world.elf
bootaux ${loadaddr}

More details: Running FreeRTOS on the Cortex-M4 of a Colibri iMX7


2. Expected UART and Device Tree Configuration

  • Debug UART: The FreeRTOS demo uses UART_B for its console output. Make sure:

    • You are connecting your PC’s serial terminal to the UART_B lines of the Colibri Evaluation Board.
    • The serial terminal is set to 115200 baud rate.
  • Device Tree: You must disable (status = "disabled";) UART_B in the Linux device tree to prevent Linux from claiming the peripheral. This is important so that M4 (not Linux) can use it.

    • Optionally, you can apply a device tree overlay for this purpose. Useful reference: Colibri iMX7 - UARTs

3. Path for ext4load

  • The path you give to ext4load (e.g., /home/root/hello_world.elf) must point to the file’s actual location on the root of the second eMMC partition (not relative to the Linux root). If you copied the file as /home/root/hello_world.elf from Linux, then that’s the path in U-Boot as well. So your usage looks correct.

More details: How to load and run the firmware on Cortex M4


4. Troubleshooting Steps

If you still do not see Hello World! on the UART output:

  1. Double-check you are using UART_B on the eval board.
  2. Serial Configuration: Be sure your terminal emulator is listening on the right serial port, at 115200 baud, 8N1.
  3. Device Tree: Ensure the overlay/disable for UART_B is truly active (reboot Linux and confirm /dev/ttymxc1 is missing or unclaimed).
  4. Correct Firmware: Ensure your hello_world.elf is built for the Colibri iMX7 M4 core and targets the TCM area.
  5. Cables: Confirm cables and pinout—sometimes UART_A is inadvertently used instead of UART_B.
  6. Try a minimal example from the official demo to limit the possibility of software/firmware error.
  7. No Bootaux Typos: Use bootaux, not bootauc, in U-Boot (I see you made a typo earlier).

Example of successful output:

Hello World!

This will appear on the UART_B serial console if everything is set up properly.


Summary Checklist

  • Copy .elf to /home/root/hello_world.elf (visible from U-Boot).
  • In U-Boot:
    ext4load mmc 0:2 ${loadaddr} /home/root/hello_world.elf
    bootaux ${loadaddr}
    
  • Connect serial terminal to UART_B (115200 baud).
  • Ensure Linux device tree disables UART_B.

References:

If you follow these steps and still don’t see output, please let me know precisely what you see on the serial terminal and how UART_B is connected. I’m happy to help further!

Best regards,
Toradex AI Assistant.

Hi @Uday10122,
Please note that M4 hello world messages should appear on a different UART port.

1 Like