NXP AN12238, i.MX RT Application Note

AN12238
i.MX RT Flashloader Use Case
Rev. 2 — February 4, 2021

1 Introduction

The i.MX RT Flashloader is a stand-alone, complete software utility for developing and manufacturing of the i.MX RT series MCUs. It includes both the Flashloader binary running in the MCU RAM and the PC-host tools to communicate with the Flashloader binary. It enables quick and easy programming of the internal OCOTP (eFuse) and external NOR/NAND/ HyperFlash devices. The host-side command line and GUI tools are available to communicate with the Flashloader binary via the supported peripherals (USB-HID or UART).
The Flashloader used for the example in this document is Flashloader_RT1050_1.1. The hardware platform is the MIMXRT1050­EVKB board.

2 i.MX RT1050 Flashloader

2.1 Obtaining the i.MX RT1050 Flashloader

NXP provides the Flashloader package on the official website. Download the Flashloader package for the i.MX RT1050 MCU and the MIMXRT1050-EVK board from i.MX RT1050 Evaluation Kit.
Application Note

Contents

1 Introduction......................................1
2 i.MX RT1050 Flashloader................1
2.1 Obtaining the i.MX RT1050
Flashloader.................................. 1
2.2 Flashloader package................... 1
3 i.MX RT1050 OCOTP and external
flash.................................................3
3.1 OCOTP (eFuse)...........................3
3.2 External flash............................... 4
4 i.MX RT1050 Flashloader use cases
........................................................ 7
4.1 Target platform environment........7
4.2 Serial Downloader mode........... 10
4.3 Program OCOTP (eFuse)..........11
4.4 Building the bootable image...... 14
4.5 Programming external flash device
...................................................15
5 i.MX RT10xx Flashloader..............18
5.1 Obtain Flashloader packages.... 18
5.2 Serial downloader...................... 18
6 Conclusion.....................................20
7 Revision history.............................20
A FlexSPI configuration options and
memory ID.....................................20
Figure 1. Downloading the i.MX RT1050 Flashloader
NOTE There are different Flashloader packages for different MCU platforms and they cannot be used interchangeably.
Make sure to download the correct Flashloader package for the specific MCU platform. For the download sites, see
Obtain Flashloader packages.

2.2 Flashloader package

All the files and tools in the Flashloader package work together to achieve these functionalities:
1. Communicate with the MCU BootROM and download the Flashloader image.
2. Create a bootable image (SB file).
NXP Semiconductors
i.MX RT1050 Flashloader
3. Program the MCU internal OCOTP (eFuse) to define the boot mode, MAC address, security mode, and so on.
4. Program the bootable image (SB file) into the MCU external flash (Nor/NAND/HyperFlash/SD).
This is the directory structure of the Flashloader package after it is unzipped:
Table 1 shows detailed information about the Flashloader directories and files.
Table 1. Flashloader directories and files
LA_OPT_Base_License.htm
SW_Content_Register_Kinetis_Bootloader
NXP Software License Agreement
Flashloader release information and software content
.txt
The
doc
directory includes all the documents:
i.MX MCU Manufacturing User's Guide.pdf
MXRT1050 Flashloader v1.1.0 Release Notes.pdf
doc\
Kinetis blhost User's Guide.pdf
Kinetis SDPHost User's Guide.pdf
MCUX Flashloader Reference Manual.pdf
The
example_images\
Flashloader\
example_images
be used by the Flashloader tools to verify the basic process on the MIMXRT1050­EVK board.
The
Flashloader
can be downloaded into the target device and implements the supported features.
directory includes example executable images. They can
directory includes the released Flashloader executable image. It
Table continues on the next page...
i.MX RT Flashloader Use Case, Rev. 2, February 4, 2021
Application Note 2 / 23
NXP Semiconductors
Table 1. Flashloader directories and files (continued)
The
Tools\bd_file
Tools\bd_file\
platform. The BD file is the “Boot Description” file. It is used by the elftosb tool to control the sequence of the bootloader commands present in the final bootable output file.
The
Tools\blhost
OS host systems.
i.MX RT1050 OCOTP and external flash
directory includes the example BD files for the i.MX RT1050
directory includes the blhost tool for the Windows®/MAC/Linux
Tools\blhost\
Tools\elftosb\
Tools\Mfgtools-rel\
Tools\sdphost\
The blhost application is a command-line utility used by the host computer to initiate the communication and inject commands to the Flashloader running on the target device. It can communicate directly with the Flashloader over the host computer UART (Serial Port) or USB connections and then implement the programming of the internal eFuse and the external flash device.
The
Tools\elftosb
host systems.
The elftosb tool creates a binary output file that contains the user application image and a series of bootloader commands. The output is the Secure Binary (SB) file.
The
Tools\Mfgtools-rel
files. The Mfgtool is a GUI application for downloading and programming of application images into external flash devices.
The
Tools\sdphost
OS host systems. The sdphost tool provides a command line interface for sending Serial Download Protocol (SDP) commands from the PC host to NXP i.MX devices in the serial download mode. The sdphost tool is very useful in the factory programming/manufacturing process. It can be invoked from other applications and is a very useful tool for testing of automation software, development and test setups, or manufacturing environments.
directory includes the elftosb tool for the Windows/Linux OS
directory includes the GUI Mfgtool and the configuration
directory includes the sdphost tool for the Windows/MAC/Linux

3 i.MX RT1050 OCOTP and external flash

The key features of the Flashloader are the OCOTP (eFuse) operation and external flash programming. The following subsections provide a simple introduction to the Flashloader and OCOTP. For more details, see (document IMXRT1050RM).

3.1 OCOTP (eFuse)

The OCOTP (On-Chip One-Time Programmable) memory, also named eFuse, is a special memory module in the chip. Any eFuse bit in the field can be programmed from 0 to 1 just once (fused), but the read operation has no limitations. The memory space contains the whole chip configuration. Here are some key configurations:
• Boot mode
• MAC address
• FlexRAM setting
For the eFuse programming examples using the Flashloader, see Program OCOTP (eFuse).
The eFuse memory space is not assigned to the system 4G address space, so the normal address Read/Write cannot be used to access the eFuse registers. A specific process is needed to Read/Write the eFuse registers and for the Flashloader to support this feature.
The OTP memory footprint in Figure 2 shows the registers grouped by the lock region.
i.MX RT Flashloader Use Case, Rev. 2, February 4, 2021
Application Note 3 / 23
i.MX RT1050 Processor Reference Manual
NXP Semiconductors
i.MX RT1050 OCOTP and external flash
Figure 2. OTP memory footprint

3.2 External flash

The i.MX RT1050 device provides various external flash memory interfaces:
• 8/16-bit SLC NAND FLASH with the ECC handled by software
• SD/eMMC
• HyperFlash
• Parallel NOR FLASH with XIP support
• Single/dual-channel quad SPI FLASH with XIP support
i.MX RT Flashloader Use Case, Rev. 2, February 4, 2021
Application Note 4 / 23
NXP Semiconductors
i.MX RT1050 OCOTP and external flash
The external flash can be used to store the application image and make the i.MX RT1050 boot from the flash image. The Flashloader includes various flash-programming algorithms to support the flash image programming in the development and manufacture phases.

3.2.1 Bootable image

For the i.MX RT1050 device, the application image must be stored in the external flash device. It is different for MCUs that have an internal parallel NOR flash. The internal parallel NOR flash space is assigned to the system 4 G memory space and can be accessed directly by address. The core can fetch the boot image binary directly and run the eXecute-In-Place (XIP).
After the chip power reset, the BootROM in the i.MX RT1050 always runs first. It checks the boot mode and helps the core to boot from a specific external flash device.
For various flash interfaces and boot modes, the BootROM must get some additional information from the application image in the external flash device. By combining the additional necessary information with the application image, you get the final programmable bootable image.
The additional necessary information are:
• Flash Configuration Block (FCB):
— Optional (used for serial/parallel NOR FLASH).
— Offset: 0x0000.
— Description: The structure of the external flash interface definition.
• Image Vector Table (IVT):
— Required.
— Offset: 0x0400 (non-XIP flash)/0x1000 (XIP flash).
— Description: The structure includes the address information of the application binary, DCD, BD, and CSF.
• Boot Data (BD):
— Required.
— Offset: 0x0420 (non-XIP)/0x1020 (XIP).
— Description: The structure includes the start address and size of the SB image.
• Device Configuration Data (DCD):
— Optional.
— Offset: Defined in the IVT.
— Description: Currently used to configure the SDRAM (SEMC interface).
• Application binary:
— Required.
— Offset: 0x2000 (Typical).
— Description: The pure application binary.
• Command Sequence File (CSF):
— Optional.
— Offset: Defined in the IVT.
— Description: Used by the High-Assurance Boot (HAB).
• KeyBlob:
— Optional.
— Offset: Defined in the IVT.
i.MX RT Flashloader Use Case, Rev. 2, February 4, 2021
Application Note 5 / 23
NXP Semiconductors
i.MX RT1050 OCOTP and external flash
— Description: Secure boot key information.
The elftosb tool in the Flashloader can be used to create the bootable image. The Flashloader also provides some BD example files. Figure 3 shows the bootable image layout and the function of each block.
Figure 3. Bootable image layout

3.2.2 Booting from external flash

With BootROM, the i.MX RT1050 can boot from various external flash devices in the XIP (NOR-only) or NON-XIP modes. Based on the IVT and BD information in the Bootable image, the BootROM starts up the application binary directly (XIP) or copies the bootable image to the RAM and starts up the application binary (NON-XIP).
Figure 4 shows the process of the NON-XIP boot.
• Stage 1: Bootable image is in the external flash.
• Stage 2: BootROM loads the starting 4 KB of data from the bootable image to the internal SRAM (OCRAM). It includes the IVT and BD information and will be used for the application image loading.
• Stage 3: BootROM transfers the starting 4 KB of data from the internal SRAM (OCRAM) to the destination address space of the bootable image.
• Stage 4: BootROM continues loading the rest of the bootable image from the external flash to the destination address space and starts up the application binary.
i.MX RT Flashloader Use Case, Rev. 2, February 4, 2021
Application Note 6 / 23
NXP Semiconductors
i.MX RT1050 Flashloader use cases
Figure 4. NON-XIP boot
In stage 2, if the BootROM finds the destination address equal to the external flash address, it will skip the remaining stages and start up the application binary directly in the flash address space. It is XIP boot.

4 i.MX RT1050 Flashloader use cases

This chapter describes the Flashloader usage case by case and provides the command lines and simple descriptions.

4.1 Target platform environment

All the Flashloader use cases are demonstrated using the MIMXRT1050 EVK target platform, as shown in Figure 5.
For the Flashloader usage, set the configurations as follows:
• Set the Boot Mode Switch (SW7) to 0001b for the serial downloader mode.
• BootROM/Flashloader supports both the OpenSDA/UART and USB-HID ports as the communication interfaces with the PC host.
• Set the correct Power Supply Switch (J1) based on the communication interfaces used:
— OpenSDA/UART - J1-5&J1-6
— USB-HID - J1-3&J1-4
i.MX RT Flashloader Use Case, Rev. 2, February 4, 2021
Application Note 7 / 23
Loading...
+ 16 hidden pages