The i.MX 8QuadXPlus Multisensory Enablement Kit (MEK) is a NXP development platform based on Cortex A-35 + Cortex-M4 cores. Built with high-level integration to support graphics, video, image processing, audio, and voice functions, the i.MX 8X processor family is ideal for safety-certifiable and efficient performance requirements.
This tutorial shows how to enable the Cortex-M4 using the MCUXpresso SDK package and loading the binary from the network.
NOTE: It is also possible to load the Cortex-M4 image from the SCFW using the imx-mkimage utility. But now we are going to focus on MCUXpresso.
Setting up the machine
$ sudo apt-get install cmake
$ export ARMGCC_DIR=<your_path_to_arm_gcc>/gcc-arm-none-eabi-9-2020q2/
NOTE: The ARMGCC_DIR variable needs to be exported on the terminal used for compilation.
To setup the TFTP server on the host machine:
The first step is to install all the prerequisite packages for TFTP:
$ sudo apt-get install xinetd tftpd tftp
Create a TFTP folder in your desired location with root owner and the “rwx” permission for all users:
$ sudo mkdir /tftpboot
$ sudo chmod –R 777 /tftpboot
$ sudo chown –R root /tftpboot
Create a configuration file for the TFTP with the following content. (The server_args
parameter must match with the folder created above)
$ cat /etc/xinetd.d/tftp
service tftp
{
protocol = udp
port = 69
socket_type = dgram
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = no
}
Restart the xinetd
service:
$ sudo /etc/init.d/xinetd restart
You can place any file at the TFTP folder and load it through U-Boot, you can also create symbolic links from your building directory avoiding to copy and paste your zImage
and dtb
files every time.
Install all the needed packages for NFS:
$ sudo apt-get install nfs-kernel-server
Create a folder for placing your rootfs:
$ mkdir /tftpboot/rfs
Add the following line in the end of your /etc/exports
file:
/tftpboot/rfs *(rw,no_root_squash,no_subtree_check)
Restart the NFS service:
$ sudo service nfs-kernel-server restart
Place your rootfs or create a symbolic link for the NFS folder.
Downloading the SDK
Download the MCUXpresso following these steps:
Building the image
All demos and code examples available on the SDK package are located in the directory <<SDK_dir>>/boards/mekmimx8qx/. This tutorial shows how to build and flash the hello_world demo but similar procedures can be applied for any example (demo, driver, multicore, etc) on the SDK.
$ cd ~/SDK_2.3.0_MEK-MIMX8QX/boards/mekmimx8qx/demo_apps/hello_world/armgcc
$ export ARMGCC_DIR=<your_path_to_arm_gcc>/gcc-arm-none-eabi-9-2020q2/
$ ./build_release.sh
NOTE: If needed, give the script execution permission by running chmod +x build_release.sh.
NOTE: This procedure shows how to build the M4 image that runs on TCM. To run the image from DDR, use the build_ddr_release.sh script to build the binary under the ddr_release folder.
Flashing the image
=> dhcp
=> setenv serverip <ip_from_host_pc>
=> tftp 0x88000000 hello_world.bin
=> dcache flush
=> bootaux 0x88000000
Then the M4 core will load the image to the /dev/ttyUSB1 console.