How To Run M4 Program in Uboot on i.MX 8M Mini

The OKMX8MM-C platform has a Cortex-M4 core inside, which can be developed using the MCUXpresso SDK, a collection of microcontroller software support that includes peripheral drivers, RPMSG multi-core communication, and FreeRTOS support. You can check the SDK API documentation for the functions and structures it implements.

MCUXpresso SDK supports IAR or armgcc to compile images. Compilation can generate three images, which run in QSPI flash, ram, and DDR respectively. For the compilation method, please refer to the Forlinx Linux manual or SDK_2.5.0_EVK-MIMX8MM user manual Getting Started with MCUXpresso SDK for i.MX 8M Mini.

The following describes how to start the compiled three images in uboot. Taking the simplest hello world as an example, after the program starts, it will output "hello world." in uart4.

1. How to start the M4 program of the QSPI flash version in uboot

First, the M4 program needs to be programmed into the QSPI flash, which can be done through the TF card or UUU tool (refer to the Forlinx linux manual).

Then start the M4 core program in QSPI flash in uboot.

Initialize QSPIflash

sf probe

M starts the M4 core program

bootaux 0x8000000

After entering the command

OKMX8MM-C platform

2. How to start the ram version of the M4 program in uboot

First, you need to read the M4 program into RAM in uboot.

If the M4 program is in the emmc fixed position, it is assumed that the storage position is the 10M offset of the MMC. Select the emmc where the M4 program is stored as the current mmc device

mmc dev 1

Read 50K at 10M offset (0x2800 * 512 = 102400) into RAM

mmc read 0x7e0000 2800 100

If the M4 program is in the fat partition of the U disk,

usb start

fatload usb 0:1 0x7e0000 hello_world.bin

Then start the ram version of the program in uboot

bootaux 0x7e0000

0x7e0000 is the address of the M4 program

After entering the command

View Results

3. How to start the DDR version of the program in uboot

First, you need to read the M4 program into DDR in uboot.

If the M4 program is in the EMMC fixed position, it is assumed that the storage position is the 10M offset of the MMC. Select the EMMC where the M4 program is stored as the current mmc device

mmc dev 1

Read 50K at 10M offset (0x2800 * 512 = 102400) into DDR

mmc read 0x80000000 2800 100

dcache flush

If the M4 program is in the fat partition of the U disk,

usb start

fatload usb 0:1 0x80000000 hello_world.bin

Then start the ram version of the program in uboot

bootaux 0x80000000

0x80000000 is the address of the M4 program

input the command

View Results

Pay attention:

M4 programs of different versions generated by compiling should be loaded strictly according to the compiled version, and jump to its loading address to run.

If the compiled image is not placed in the storage space it needs to run (the RAM version is placed in RAM, the DDR version is placed in DDR, and the QSPIflash version is placed in QSPIflash), the M4 program cannot be run. For example, the M4 program is a compiled version of QSPIflash. If it is put into DDR or ram to run, the program cannot run.

I hope that everyone can see some gains, point out problems and make progress together, and gain more knowledge from Forlinx's technical support and sharing.


contact us