RT Linux SDK build based on Ubuntu

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

RT Linux SDK build based on Ubuntu

RT Linux SDK build based on Ubuntu

RT Linux SDK build based on Ubuntu

1. Abstract

The SDK of NXP MIMXRT products can support three operation systems: windows, Linux, and macOS. Usually, the vast majority of users use the windows version combined with IDE compilation, and the documentation is relatively complete. However, for the Linux version, although the SDK is downloaded, it also contains documents, but the documents are the same as those of windows, not for Linux. Therefore, when a small number of customers use Ubuntu Linux to compile, they suffer from no documentation reference, especially for novices, it is difficult to use.

     This article will implement the build of RT1060 linux version SDK based on Ubuntu.

2. Tool preparation

You need to prepare a computer with Ubuntu system. Windows can install a virtual machine with Ubuntu system. This article uses the Ubuntu system of the web server.

Tools required for testing:

Ubuntu system

cmake

ARMGCC: ARGCC for ARM Cortex M core

SDK: SDK_2_13_1_EVK-MIMXRT1060_linux.zip

EVK: MIMXRT1060-EVK

This article takes MIMXRT1060-EVK SDK as an example, and the situation of other RT development boards with Linux SDK is the same.

2.1 SDK downloading

    Download link: https://mcuxpresso.nxp.com/en/builder?hw=EVK-MIMXRT1060

1.jpg

Fig 1

Download the SDK code, named as: SDK_2_13_1_EVK-MIMXRT1060_linux.zip

If you download it under Windows, you need to copy the SDK to the Ubuntu system. Here you can use FileZilla or MobaXterm to transfer the file. Because I use the web server Ubuntu, it is based on MobaXterm. This software is free to use, and the download link is:

https://mobaxterm.mobatek.net/

Put the downloaded SDK into the Ubuntu folder, in MobaXterm, drag the file can realize the file transfer from Windows to Ubuntu:

2.jpg

Fig 2

Unzip SDK, the commander is:

unzip SDK_2_13_1_EVK-MIMXRT1060_linux.zip -d ./SDK_2_13_1_EVK-MIMXRT1060_linux
3.jpg

Fig 3

4.jpg

Fig 4

It can be seen that the SDK has been successfully unzipped to the SDK_2_13_1_EVK-MIMXRT1060_linux folder.

At this point, the Linux SDK is ready to use.

2.2 ARMGCC install and configuration

Download ARMGCC, as you can see from the release note of the SDK, the supported GCC Arm Embedded version: GCC Arm Embedded, version is 10.3-2021.10  

Download link:https://developer.arm.com/downloads/-/gnu-rm

Download the file: gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2 

Copy it to the Ubuntu, and unzip it, the unzip commander is:

tar -xjvf gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2

5.jpg

Fig 5

6.jpg

Fig 6

You can see that ARMGCC has been decompressed.

Configure the environment variables below and add ARMGCC_DIR to /etc/profile:

Add the path at the end of the profile to save and exit:

export ARMGCC_DIR=/home/nxa07323/rtdoc/gcc-arm-none-eabi-10.3-2021.10/
export PATH=$PATH:/home/nxa07323/rtdoc/gcc-arm-none-eabi-10.3-2021.10/bin/

7.jpg

Fig 7

Valid profile, and check the ARMGCC_DIR is really valid.

source /etc/profile
echo $ARMGCC_DIR

8.jpg

Fig 8

Until now, ARMGCC is ready to use!

2.3 cmake download and install

Build also need the cmake tool, so use the following command to install cmake and check whether the installation is successful:

sudo apt-get install cmake
cmake –version

9.jpg

Fig 9

Cmake is also ready!

3. Testing

All the tools are ready, let’s start compiling the code, here we take hello_world as an example to compile an executable file downloaded to Flash.

3.1 Executable file Compilation

Enter the hello_world gcc path of the SDK:

10.jpg

Fig10

It can be seen that there are many files under the armgcc folder, which are compilable files that generate different images:

build_debugbuild_releasethe linker file is RAM linker, where text and data section is put in internal TCM.

build_flexspi_nor_debug, build_flexspi_nor_release: The linker file is flexspi_nor linker, where text is put in flash and data put in TCM.

build_flexspi_nor_sdram_debug, build_flexspi_nor_sdram_release: The linker file is flexspi_nor_sdram linker, where text is put in flash and data put in SDRAM.

build_sdram_debug, build_sdram_release: The linker file is SDRAM linker, where text is put in internal TCM and data put in SDRAM.

build_sdram_txt_debug, build_sdram_txt_release: The linker file is SDRAM_txt linker, where text is put in SDRAM and data put in OCRAM.

Now, compile build_flexspi_nor_debug.sh, this script will generate flash .elf file, the command is:

./build_flexspi_nor_debug.sh

11.jpg

Fig 11

The compiled .elf is placed in the flexspi_nor_debug folder:

12.jpg

Fig 12

Convert the hello_world.elf file to hex and bin for the RT board burning, conversion command is:

arm-none-eabi-objcopy -O ihex hello_world.elf hello_world.hex
arm-none-eabi-objcopy -O binary hello_world.elf hello_world.bin

13.jpg

Fig 13

3.2 Code Downloading Test

The generated files hello_world.hex and hello_world.bin are the executable files, which can be downloaded to the EVK board through MSD, serial downloader, or debugger software.

Open the bin file to view:

14.jpg

Fig 14

As you can see, this file is an app executable file with FCB.

Here use the MCUbootUtility tool to download, and the EVK board enters the serial download mode: SW7 1-OFF, 2-OFF, 3-OFF, 4-ON

15.jpg

Fig 15

After the downloading is finished, EVK board enter the internal boot mode:

SW7 1-OFF,2-OFF,3-ON,4-OFF

16.jpg

Fig 16

We can see, the printf works, it means the Ubuntu Linux build the file works OK.

3.3 Code configuration

Some customers may think that the executable files to be loaded by some of our tools do not need FCB, so how to realize to generate the app without FCB Linux, here we need to modify the flags.cmake file, the path is:    

/home/nxa07323/rtdoc/SDK_2_13_1_EVK-MIMXRT1060_linux/boards/evkmimxrt1060/demo_apps/hello_world/armgcc

Configure BOOT_HEADER_ENABLE=0:

Default is BOOT_HEADER_ENABLE=1(Fig 17), modified to Fig 18:

17.jpg

Fig 17                            

18.jpg

 Fig18

Build again, to generate the .bin, check the .bin file:

19.jpg

Fig 19

We can see that this file is a pure app file that does not contain FCB+IVT. It can be used in occasions that do not require FCB.

Until now, the RT1060 Linux version of the SDK can be compiled to generate an executable file under Ubuntu, and the function is normal after the function test.

 

 

 

 

 

 

Labels (1)
No ratings
Version history
Last update:
‎07-21-2023 12:40 AM
Updated by: