Building Cortex-M examples for i.MX MPU's using GCC on Linux

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Building Cortex-M examples for i.MX MPU's using GCC on Linux

Building Cortex-M examples for i.MX MPU's using GCC on Linux

Hello everyone, this document will share an step by step guide of the configuration needed in a Linux PC to compile the SDK examples we provide, as well as how to download them in an easy way.

Requirements:


First step would be to get the SDK package, this include documentation and code, which is available at the MCUXpresso builder webpage:
https://mcuxpresso.nxp.com/en/welcome

Click on the select a development board and select the package for your development kit or the i.MX MPU

MCUXpresso builder.png

Select SDK.png

This guide is focused on Linux build so will select GCC package and Linux host PC as the environment.

Select Linux.png

Select GCC.png

Click on build and wait for the SDK package to be ready for download.

Note1: Click on select all if the whole middleware package is desired
Note2: it is possible to select each middleware that are desired.

Select middleware & download.png


On new window select download SDK

download sdk.png



Select on new pop-up window download both SDK and documentation

SDK archive and docs.png


Read and accept EULA so the download start

accept EULA.png


Decompress the package using the following command:
$ tar -xvzf ~/SDK_2_13_0_EVK-MIMX8MM.tar.gz -C ~/SDK_2_13_0_EVK-MIMX8MM

Next will be to download the GCC from the ARM webpage, gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2
https://developer.arm.com/downloads/-/gnu-rm

Note that the GCC version used is based on the minimum version required, since this was tested and supported, this could be found within the SDK documentation (~/SDK_2_13_0_EVK-MIMX8MM/docs/MCUXpresso SDK Release Notes for EVK-MIMX8MM)

GCC version.png


Once downloaded we can decompress and configure the environment:
$ tar -xf gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2
$ export ARMGCC_DIR=~/gcc-arm-none-eabi-10.3-2021.10
$ export PATH=$PATH:~/gcc-arm-none-eabi-10.3-2021.10

$ sudo apt-get install cmake 
Check the version >= 3.0.x
$ cmake --version

Once this is done we enter the path of the example of our choice and compile using the script, as necessary using debug, release or all.
$ cd ~/SDK_2_13_0_EVK-MIMX8MM/boards/evkmimx8mm/demo_apps/hello_world/armgcc
$./build_release.sh

The binary (elf and bin) will be found inside the folder according to whether we use debug or release script. For this example we used release script:
$ cd release

Once builded we can move/download the binaries from the Linux host PC to the board by using the UUU tool with the command fat_write
#### we put the board in fastboot mode by entering the command in the uboot terminal fastboot 0 ####

From the Linux terminal introduce the UUU command to  download to the FAT partition of the eMMC of the baord:
## For rproc it is needed the .elf binary ##
$ uuu -v -b fat_write hello_world.elf mmc 0:1 hello_world.elf

## For bootaux it is needed the .bin binary ##
$  uuu -v -b fat_write hello_world.bin mmc 0:1 hello_world.bin

Once with the binaries in the FAT partition of the SD/eMMC of our board we can make the necessary modifications (device tree/bootargs) to test the Cortex-M examples.

For any question regarding this document, please create a community thread and tag me if needed.

Saludos/Regards,
Aldo.

100% helpful (1/1)
Version history
Last update:
‎07-21-2023 10:44 AM
Updated by: