AM261x MCU+ SDK: SBL DFU Uniflash

| AM261x MCU+ SDK 26.00.00 |

SBL DFU Uniflash

# Introduction

This is a flash-writer application which works in conjunction with the usb_dfu_uniflash.py python script mentioned in Flashing Tools. Although it is not strictly not a bootloader, it uses bootloader APIs to do basic SOC initialization required to be able to flash binaries to the OSPI flash. Like other SBLs, this is also booted by the ROM bootloader. It is analogous to SBL UART Flash Writer

- DFU which stands for (Device Firmware Upgrade) is a standard device class of USB USB. This application uses DFU to flash the SBLs and application images to ospi/qspi flash.
  - It uses DFU class from TinyUSB stack please refer to USB for more information.

Once the example starts running it attempts to receive files via USB DFU and process them in a loop. Once it receives a file (this is sent by the usb_dfu_uniflash.py script), it finds out what to do with the received file from the file header. It can be three things:

- Flash the received file at the given offset
- Verify if the data in the received file is present at the given offset
- Erase the flash at the given offset for the given size

The meta-data required for doing these operations (offset, file size, erase size etc.) will be extracted from the same header.

This example is more or less like a flashing server, and will never terminate until EVM is powered down or the core is reset.

Note
  The DFU uniflash differes from SBL UART Flash Writer in response message stage.
  - SBL UART uniflash send the response header back via UART which contains the status information of the requested flash cmd mentioned in the file header.
  - As USB DFU is host driven protocol the response stage differs from the UART uniflash. dfu-util will take care of necessary error handling.

- Refer to DFU_1.1.pdf to know more about USB DFU class.

# Supported Combinations

# Steps to Run the Example

Since this is mainly a flash-writer application, this is sent via the USB DFU unlike other examples which are usually loaded with CCS. Nevertheless, you can build this example like you do for the others using makefile or build it via CCS by importing as a project.

- When using CCS projects to build, import the CCS project for the required combination and build it using the CCS project menu (see Using SDK with CCS Projects).
- When using makefiles to build, note the required combination and build using make command (see Using SDK with Makefiles)

# Flashing Failure

If the flashing fails, the error message will give a hint as to why it failed. Some common error messages, reasons and potential solutions are listed below.

Error | Possible Reason | Solution
--- | --- | ---
No DFU capable USB device available | AM261x ROM USB enumeration failed. | Check the USB connection between host machine and AM261x. Power cycle the AM261x and try running 'dfu-util -l' command to see the enumerated device list.
Transfering application image gets stuck (LIBUSB_ERROR_PIPE) | AM261x USB did not respond to Host request or the Host Stopped communicating with AM261x | Power cycle EVM and try again.
DFU Timeout while transfering large application image (LIBUSB_ERROR_TIMEOUT) | DFU-UTIL tool timed out | Reduce the size of application image if the dfu-util tool is facing time-out issues due to large appimage/mcelf OR create a custom dfu-util tool with increased timeout which suits your requirements.

# See Also

USB

BOOTLOADER

USB DFU Uniflash.

Flashing Tools

# Sample Output

Since this SBL receives the appimage and other files over USB protocol, it doesn't print anything to the console.