AM261x MCU+ SDK: SBL DFU

| AM261x MCU+ SDK 26.00.00 |

SBL DFU

# Introduction

SBL_DFU is a bootloader which boots the multicore application received via USB DFU. It is analogous to SBL UART

- DFU which stands for (Device Firmware Upgrade) is a standard device class of USB. This application uses DFU to transfer appimages from host pc to RAM.
  - It uses DFU class from TinyUSB stack please refer to USB for more information.
- SBL DFU implements the dfu task which receives the appimage and put it into a dedicated buffer in RAM memory. Once the manifestation stage of DFU state machine is completed and DFU state machine goes to IDLE state, then the dfu task will be exited and booting process of the received image will be initiated.
- It uses bootloader APIs to do the SOC initializations. Once the mcelf image is received, it is parsed into multiple loadable segments. These are then loaded into individual CPUs.
- The Note segment of the MCELF image will have information regarding the core on which each segment that application binary needs to be loaded
- The SBL uses this information to initialize each core, loads the segments to specified addresses, and then releases the core from reset. Now the core will start running.
- Refer to DFU_1.1.pdf to know more about USB DFU class.

Note
  This bootloader performs memory boot i.e it directly boots from the appimage received in RAM buffer. Due to this as of now the maximum boot image size supported with SBL DFU is 384KB

# SBL DFU Multicore ELF

For AM261x, use the Multicore ELF project of SBL DFU.

To parse and load an mcelf file via DFU bootloader, use the project examples/drivers/boot/sbl_dfu_multicore_elf

When an mcelf image is received, the SBL parses it, loads each segment to its respective core. Then the core is released from reset. For more information refer Understanding the bootflow and bootloaders

The steps to run the example is same irrespective of the image format.

# Supported Combinations

Parameter | Value
--- | ---
CPU + OS | r5fss0-0 nortos
Toolchain | ti-arm-clang
Boards | am261x-lp
Example folder | examples/drivers/boot/sbl_dfu_multicore_elf

# Steps to Run the Example

Since this is a bootloader and is used as a SOC initialization binary, the example will be run every time you boot an application using this example. It is generally run from a boot media (OSPI Flash, SD Card or over UART) 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 )

# Example Usage

The standard DFU-Utility is not compatible with the AM261x device. Instead, please use the dfu-util executable located in ${SDK_INSTALL_PATH}/tools/boot/usb_dfu_utility, depending on your operating system, to carry out DFU operations.

- Make sure that dfu-util tool is installed on your host pc. In case of windows make sure that appropriate windows USB generic drivers are installed.
- The application boot is a 4 step process.

1. Put the device into DFU boot mode EVM Setup
2. Connect the USB cable to the HOST PC and observer that correct DFU device is detected.
3. Run the following command which uses dfu-util to send the SBL DFU bootloader tiimage.

        sudo dfu-util -i 0 -a 0 -D <path to mcu_plus_sdk>/tools/boot/sbl_prebuilt/am261x-som/sbl_dfu_multicore_elf.release.hs_fs.tiimage

DFU ROM boot log

4 Run the following command which uses dfu-util tool to send the application images. SBl DFU receives that and boots the application.

    sudo dfu-util -i 0 -a 0 -D <path to application image>

- Another option is to use the USB Bootloader Python Script which abstracts the setps 3 and 4 mentioned above.

# 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 .mcelf 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 .mcelf (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 application image OR create a custom dfu-util tool with increased timeout which suits your requirements.

# See Also

USB

BOOTLOADER

USB DFU Uniflash.

Flashing Tools

USB Bootloader Python Script