The i.MX8QXP SOC platform includes a low-power Cortex-M4 processor with a low gate count and low interrupt latency. The Cortex-M4 implements the ARMv7-ME instruction set architecture (ISA) and adds significant capabilities with digital signal processor (DSP) and single instruction multiple data (SIMD) extensions. It provides additional general processing capabilities via lower power and fast interrupt response time and communicates with the rest of the cores (Cortex-A35 cores and with the SCU) through the messaging unit (MU).

Download the SDK and toolchain

Before building the Cortex-M4 firmware, you must download and install the SDK, which includes example applications and the toolchain to build your firmware application.

Download the SDK

NXP offers an SDK that facilitates firmware development for the Cortex-M4 core. The SDK provides examples demonstrating how to access the peripherals available on this subsystem.

  1. Go to https://mcuxpresso.nxp.com/en/builder.

    You may have to register with NXP.
  2. Click Boards > i.MX.

  3. Select MEK-MIMX8QX.

  4. Click the Build MCUXpresso SDK button.

  5. Select your Toolchain/IDE and Host OS.

  6. Click Download SDK.

You must download the toolchain independently in the next step, because the MCUXpresso IDE is not supported for the i.MX8QXP Cortex-M4.

Download the toolchain

You must also download the toolchain to build your firmware application.

  1. Go to https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads.

  2. Select the latest available version for "GNU Arm Embedded Toolchain".

Install the SDK and toolchain

  1. Decompress and install the SDK in your Linux PC.

    $ tar -xvf <SDK_VER>_MEK-MIMX8QX.tar.gz -C <SDK_VER>_MEK-MIMX8QX
  2. Install the toolchain.

    $ tar -xvf gcc-arm-none-eabi-7-2018-q2-update-linux.tar.bz2 -C <toolchain_install_path>

Build a demo application

  1. To build a hello_world example, export the variable ARMGCC_DIR with the absolute path to the GCC ARM Embedded toolchain.

    $ export ARMGCC_DIR=<toolchain_install_path>/gcc-arm-none-eabi-7-2017-q4-major/
  2. Build the application.

    $ cd ${SDK_INSTALL_DIR}/<SDK_VER>_MEK-MIMX8QX/boards/mekmimx8qx/demo_apps/hello_world/armgcc
    $ ./build_all.sh

    You can find the artifacts from a successful build in the debug/release directory.

For more information, see the Getting Started with MCUXpressoSDK guide from NXP.

Deploy the application onto the target

You can deploy the Cortex-M4 application directly to the target device via the Ethernet interface.

Run the application

To run the firmware application on the target device:

=> setenv boot_m4 'tftp $loadaddr <m4_firmware.bin>; dcache flush; bootaux $loadaddr 0'
=> saveenv
=> run boot_m4
Using ethernet@5b040000 device
TFTP from server 192.168.126.2; our IP address is 192.168.126.102
Filename 'm4_firmware.bin'.
Load address: 0x80280000
Loading: #
          2.1 MiB/s
done
Bytes transferred = 8880 (22b0 hex)
## Starting auxiliary core at 0x80280000 ...
Power on aux core 0
Copy image from 0x80280000 to 0x34fe0000
Start M4
bootaux complete
=>

The application must either be stored on a partition of the eMMC or included in the U-Boot image.

Store the application on the eMMC

Use the following commands to store the application on the eMMC with the Linux kernel and the device trees:

=> updatefile linux tftp <m4_firmware.bin>
=> setenv boot_m4 'fatload mmc 0:1 $loadaddr m4_firmware.bin; dcache flush; bootaux $loadaddr 0'
=> run boot_m4

To autoload the firmware application when the device is powered up, apply the following changes in U-Boot:

=> setenv boot_m4 'fatload mmc 0:1 $loadaddr m4_firmware.bin; dcache flush; bootaux $loadaddr 0'
=> setenv bootcmd "run boot_m4; ${bootcmd}"
=> saveenv
=> reset

Embed the application into U-Boot

You can also include your firmware application in the U-Boot image so the SCU automatically loads the application when the target is booted.

To manually include the firmware application in the U-boot image:

$ mkimage -soc QX -rev B0 -append mx8qx-ahab-container.img -c -scfw scfw_tcm.bin -m4 m4_image.bin 0 0x34FE0000 -ap u-boot-atf.bin a35 0x80000000 -out flash.bin
You can find these artifacts in the DEY deployment directory.

When you have built the new U-Boot image (flash.bin), upload it to the target.

Embed the application into Digi Embedded Yocto

You can also include the firmware application when building U-Boot within Digi Embedded Yocto.

  1. Copy the firmware application to your Digi Embedded Yocto project and name it m4_image.bin. This is the name the Digi Embedded Yocto recipe is expecting when building U-Boot.

    $ cp <custom_m4_app>.bin /<cc8x_project_path>/tmp/work/ccimx8x_sbc_pro-dey-linux/imx-boot/0.2-r0/git/iMX8QX/m4_image.bin
  2. Build the new image with Digi Embedded Yocto.

    $ bitbake -f -c compile imx-boot
  3. Copy the flash.bin file from tmp/work/ccimx8x_sbc_pro-dey-linux/imx-boot/0.2-r0/git/iMX8QX to your tftpboot directory.

  4. Deploy the new U-Boot image to your target device. The firmware is automatically loaded on the next power cycle.