User Guide - sdphost

This document describes the usage of Serial Download Protocol Host (sdphost), a PC host application.

The sdphost tool is a useful tool in the factory programming and manufacturing process. It can be used to test and develop the automation software and test setups. It can be invoked from other applications too.

This document introduces the serial download protocol, typical factory programming setup, and usage of the tool and description of its sub-command line interface. It also provides a set of example usages of sdphost tool and its sub-command line arguments with a device.

sdphost - Serial Download Protocol

Serial Download Protocol is a set of commands supported by NXP i.MX RT devices in the Boot ROM application’s serial download mode.

The purpose of serial download protocol is to provide means to download bootable images from a PC to the device’s internal or external RAM memory. There are a set of commands to read and write to a memory/register unit, read status of the last command, download images to a given address in internal/external memory, and provide the address to jump and execute the downloaded image.

sdphost - Typical setup

The sdphost tool is used in the development phase of the device firmware application, manufacturing, and factory programming process.

The sdphost tool would run on the PC host, and the device would run in Boot ROM serial download mode. The MCU has BOOT_MODE pins that can be used to boot the device in serial downloader mode. The device’s reference manual provides the documentation on booting the device in serial downloader mode.

sdphost - Communication

The sdphost tool communicates with NXP i.MX RT devices connected on the host PC via USB-HID or UART device.

sdphost - USB

sdphost could be connected to MCU over USB HID.

USB device identification in SPSDK

sdphost - UART

sdphost could be connected to MCU over UART.

UART device identification in SPSDK

sdphost - Sub-commands

sdphost consist of a set of sub-commands followed by options and arguments. The options and the sub-command are separated with a ‘–’.

sdphost [options] -- [sub-command]

The “help” guide of sdphost lists all of the options and sub-commands supported by the sdphost utility.

sdphost --help

sdphost

Utility for communication with ROM on i.MX targets.

sdphost [OPTIONS] COMMAND [ARGS]...

Options

-p, --port <COM[,speed>

Serial port.

-u, --usb <VID,PID>

USB device identifier. Following formats are supported: <vid>, <vid:pid> or <vid,pid>, device/instance path, device name. <vid>: hex or dec string; e.g. 0x0AB12, 43794. <vid/pid>: hex or dec string; e.g. 0x0AB12:0x123, 1:3451. Use ‘nxpdevscan’ utility to list connected device names.

-j, --json

Use JSON output

-v, --verbose

Displays more verbose output

-d, --debug

Display debugging info

-t, --timeout <ms>

Set packet timeout in milliseconds

--version

Show the version and exit.

sdphost read-register

Reads the contents of a memory location or register value.

The address of the register or memory location should be passed in as the first argument. Optional arguments include the data format of the register value in the number of bits and number of bytes to read.

ADDRESS - starting address where to read
FORMAT - bits per item: valid values: 8, 16, 32; default 32
COUNT - bytes to read; default size of FORMAT
FILE - write data into a file; write to stdout if not specified
sdphost read-register [OPTIONS] ADDRESS [FORMAT] [COUNT] [FILE]

Options

-h, --use-hexdump

Use hexdump format

Arguments

ADDRESS

Required argument

[FORMAT]

Optional argument

COUNT

Optional argument

FILE

Optional argument

sdphost write-file

Writes file to the device’s memory address.

ADDRESS - starting address of the image
FILE - binary file to write
COUNT - Count is the size of data to write in bytes (default: whole file)
sdphost write-file [OPTIONS] ADDRESS FILE [COUNT]

Arguments

ADDRESS

Required argument

FILE

Required argument

COUNT

Optional argument

Note

Typically, write-file is used to program the device with boot image and jump-address is used to start execution of boot image on the device.

sdphost error-status

Reads the error code from the device.

sdphost error-status [OPTIONS]

sdphost jump-address

Jumps to the entry point of the image at the given address.

jump-address will result in the execution of the image once the ROM process the IVT and on successful authentication of the image.

ADDRESS - starting address of the image
sdphost jump-address [OPTIONS] ADDRESS

Arguments

ADDRESS

Required argument

Note

IVT can be part of the image or can be downloaded separately. It is a data structure used by ROM that provides information of the boot image entry point and other parameters used for authenticating the image for secure boot. IVT is described in more detail in device’s reference manual.