Apalis IMX8 cortex M4 and linux conflict

Hello,

I am trying to get the ‘hello world’ demo example from the MCUXpresso SDK to run on one of the cortex M4 cores of the apalis IMX8 running TorizonOS. I have compiled the code, moved it to the corresponding location on the IMX8 and I followed this guide to run it via uboot (Normally I use remoteproc for this, but this is not yet available for the apalis imx8 to my understanding).

This all works and I see the hello world output on the serial output. The problem is that when I boot linux when the M4 is running, it starts the kernel but immediately crashes and reboots (if i enable the m4 to run automatically at boot, the board just enters a reboot loop). To my understanding, the only possible conflict are the UART pins that are used as a serial output by the M4. I have removed these from the devicetree even though it doesn’t seem like they are being utilized by linux. I also tried to modify the devicetree according to this:

But still no luck. What would be the correct way to use the M4 cores together with linux?

Best regards

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. You are correct in your understanding: on the Apalis iMX8, the standard way to load and run Cortex-M4 code is through U-Boot, as RemoteProc is not yet supported for this module (reference).

Why Linux Crashes When M4 is Active

The behavior you’re seeing—Linux crashing or rebooting when the M4 core is running—almost always points to resource (typically peripheral or pin) conflicts between Linux and the Cortex-M4. Even if it seems like Linux isn’t using a given UART or peripheral, device tree configuration is needed to truly “hand over” control and avoid overlap.

Solution: Device Tree Overlay

You must provide an appropriate Device Tree Overlay (DTO) so Linux does not claim the pins or peripherals that the M4 core requires. For the Apalis iMX8, Toradex provides recommended overlays. Here is the process:

1. Create and Apply the Device Tree Overlay

Suppose you are using Cortex-M4 Core 0 and require UART; you can use this sample overlay:

/dts-v1/;
/plugin/;

/* Disable UART1 Control Pins to use M4 Core 0 and 1 UART */

&iomuxc {
    pinctrl-0 = <&pinctrl_cam1_gpios>, <&pinctrl_dap1_gpios>,
                <&pinctrl_esai0_gpios>, <&pinctrl_fec2_gpios>,
                <&pinctrl_gpio3>, <&pinctrl_gpio4>, <&pinctrl_gpio_keys>,
                <&pinctrl_gpio_usbh_oc_n>,
                <&pinctrl_lvds0_i2c0_gpio>, <&pinctrl_lvds1_i2c0_gpios>,
                <&pinctrl_mipi_dsi_0_1_en>, <&pinctrl_mipi_dsi1_gpios>,
                <&pinctrl_mlb_gpios>, <&pinctrl_qspi1a_gpios>,
                <&pinctrl_sata1_act>, <&pinctrl_sim0_gpios>,
                <&pinctrl_usdhc1_gpios>;
};

If you are using M4 Core 1 (and using its UART), use this overlay:

/dts-v1/;
/plugin/;

/* Disable PWM0 and PWM1 to use M4 Core 1 UART */

&lsio_pwm0 {
    status = "disabled";
};

&lsio_pwm1 {
    status = "disabled";
};

&lpuart2 {
    status = "disabled";
};

You may need to tailor the overlay according to the peripherals your M4 firmware is using.

2. Use the Overlay with TorizonCore

  • Place the compiled .dtbo overlay file in /boot/overlays/.
  • Add the line fdt_overlays=your-overlay.dtbo to /boot/ostree/torizon.conf.
  • Reboot the system so the overlay is applied.

3. Confirm Isolation

Confirm that the UART (or other resource) is NOT claimed/used by Linux (e.g., not visible in /dev/ or dmesg output referring to it). Linux must not touch peripherals that the M4 uses.

Additional Recommendations

  • Make sure your M4 firmware runs in a persistent way (typically with a while(1) at the end) so it stays alive after Linux boots. (See here)
  • Be certain only the required pins/functions are disabled in Linux—not more, not less.
  • Double-check the M4 binary start address and U-Boot commands as shown in the Loading Binaries Guide.

If you follow the above steps to properly isolate M4 and Linux resources, the board should no longer crash or reboot upon starting Linux after the M4 core is running.

Let me know if you need help creating the specific overlay for your setup or encounter any other issues!

Best regards,
Toradex AI Assistant.

Hi @Jens0501!

I’ve spoken with the R&D team, and they said that a variety of factors could cause this. For now, we can’t assure what the root of the issue is since we’re working on implementing the Cortex M4 on Apalis iMX8, which means that soon we will have a definitive way to use it properly.

That being said, while the definitive way isn’t ready, I would recommend using the NXP device trees as a starting point, and checking if they have some topic about it. You could also search on their forum.

Best regards.

Hi Lucas,

Thanks for the answer. For now I will ask NXP and try to implement something that way while I await the correct implementation by you guys.

Best regards

1 Like

Hi @Jens0501!

Perfect! As I said, it should be available soon.
Can I consider this topic solved?

Best regards.