DFU: Difference between revisions

From Variscite Wiki
No edit summary
(Use tee instead of echo to fix permissions when writing 99-dfu-utils.rules)
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{INIT_RELEASE_PARAM|am62-yocto-dunfell-5.10.168_08.06.00.42-v1.0}}<!--
{{INIT_RELEASE_PARAM|am62-yocto-kirkstone-6.1.46_09.01.00.08-v1.0}}<!--
--> {{#lst:Yocto_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
--> {{#lst:Yocto_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
--> {{PageHeader|Booting from USB using DFU (USB Device Firmware Upgrade)}} {{DocImage|category1={{#var:HARDWARE_NAME}}|category2=Yocto}}[[Category:Debian]] __toc__
--> {{PageHeader|Booting from USB using DFU (USB Device Firmware Upgrade)}} {{DocImage|category1={{#var:HARDWARE_NAME}}|category2=Yocto}}[[Category:Debian]] __toc__
Line 11: Line 11:


= Installing dfu-util =
= Installing dfu-util =
In order to avoid using sudo in all commands, create a custom udev rule to set the appropriate access permissions for your PC to the dfu USB device:
$ echo 'SUBSYSTEMS=="usb", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="6165", GROUP="plugdev", MODE="0666"' | sudo tee /etc/udev/rules.d/99-dfu-util.rules
$ sudo udevadm control --reload-rules && sudo udevadm trigger


dfu-util is available in the Ubuntu apt repositories:
dfu-util is available in the Ubuntu apt repositories:


  $ sudo apt-get install dfu-util
  $ sudo apt-get install dfu-util
 
{{#ifexpr: {{#var:YOCTO_VERSION}} >= 4.1 |&nbsp;
Alternatively, DFU is shipped with the Yocto SDK and can be used after installing and sourcing the SDK setup script. See the [https://variwiki.com/index.php?title=Yocto_Toolchain_installation&release={{#var:RELEASE_NAME}}#Build_a_complete_SDK Variscite SDK article] for more details
}}
= Building U-Boot =
= Building U-Boot =


Line 40: Line 46:
== Load images using dfu-util ==
== Load images using dfu-util ==
If the hardware is configured correctly, you should see the {{#var:HARDWARE_NAME}} using dfu-util:
If the hardware is configured correctly, you should see the {{#var:HARDWARE_NAME}} using dfu-util:
  sudo dfu-util -l
  dfu-util -l
  dfu-util 0.9
  dfu-util 0.9
   
   
Line 54: Line 60:
  Export Environment Variables if not already done so:
  Export Environment Variables if not already done so:
  $ export WORKDIR=~/am62x-var-som-u-boot && \
  $ export WORKDIR=~/am62x-var-som-u-boot && \
   export UBOOT_DIR=$WORKDIR/ti-u-boot && \
   export UBOOT_DIR=$WORKDIR/ti-u-boot{{#ifexpr: {{#var:YOCTO_VERSION}} < 4.1 |&nbsp;&& \
   export K3IG_DIR=$WORKDIR/k3-image-gen && \
   export K3IG_DIR=$WORKDIR/k3-image-gen && \}}
   
   
  Load the images:
  Load the images:
  $ sudo dfu-util -R -a bootloader -D $K3IG_DIR/tiboot3.bin
  $ dfu-util -R -a bootloader -D {{#ifexpr: {{#var:YOCTO_VERSION}} < 4.1 | $K3IG_DIR/ | $UBOOT_DIR/out/r5/ }}tiboot3.bin
     U-Boot SPL 2021.01-00010-ge7ae7212f8-dirty (Apr 27 2023 - 14:31:25 -0500)
     U-Boot SPL 2021.01-00010-ge7ae7212f8-dirty (Apr 27 2023 - 14:31:25 -0500)
     SYSFW ABI: 3.1 (firmware rev 0x0008 '8.6.4--v08.06.04 (Chill Capybar')
     SYSFW ABI: 3.1 (firmware rev 0x0008 '8.6.4--v08.06.04 (Chill Capybar')
     ...
     ...
     Trying to boot from DFU
     Trying to boot from DFU
  $ sudo dfu-util -R -a tispl.bin -D $UBOOT_DIR/out/a53/tispl.bin
  $ dfu-util -R -a tispl.bin -D $UBOOT_DIR/out/a53/tispl.bin
     ################################################DOWNLOAD ... OK
     ################################################DOWNLOAD ... OK
     ...
     ...
     Trying to boot from DFU
     Trying to boot from DFU
   
   
  $ sudo dfu-util -R  -a u-boot.img -D $UBOOT_DIR/out/a53/u-boot.img
  $ dfu-util -R  -a u-boot.img -D $UBOOT_DIR/out/a53/u-boot.img
     ###DOWNLOAD ... OK                                                                                                                         
     ###DOWNLOAD ... OK                                                                                                                         
     Ctrl+C to exit ...                                                                                                                                                                                                                                                                                                                                                                                                               
     Ctrl+C to exit ...                                                                                                                                                                                                                                                                                                                                                                                                               

Latest revision as of 14:17, 17 July 2024

Warning: This page is designed to be used with a 'release' URL parameter.

This page is using the default release am62-yocto-kirkstone-6.1.46_09.01.00.08-v1.0.
To view this page for a specific Variscite SoM and software release, please follow these steps:

  1. Visit variwiki.com
  2. Select your SoM
  3. Select the software release
Booting from USB using DFU (USB Device Firmware Upgrade)

Introduction

The VAR-SOM-AM62 supports booting U-Boot (R5 SPL -> A53 SPL -> A53 U-Boot) from USB using dfu-util.

dfu-util is a host side implementation of the DFU 1.0 and DFU 1.1 specifications of the USB forum. DFU is intended to download and upload firmware to/from devices connected over USB. It ranges from small devices like micro-controller boards to mobile phones. Using dfu-util you can download firmware to your DFU-enabled device or upload firmware from it. dfu-util has been tested with the Openmoko Neo1973 and Freerunner and many other devices. For more information, see https://dfu-util.sourceforge.net/

This guide is derived from TI's USB Device Firmware Upgrade (DFU) guide and walks through the process of booting U-Boot from USB.

Installing dfu-util

In order to avoid using sudo in all commands, create a custom udev rule to set the appropriate access permissions for your PC to the dfu USB device:

$ echo 'SUBSYSTEMS=="usb", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="6165", GROUP="plugdev", MODE="0666"' | sudo tee /etc/udev/rules.d/99-dfu-util.rules
$ sudo udevadm control --reload-rules && sudo udevadm trigger

dfu-util is available in the Ubuntu apt repositories:

$ sudo apt-get install dfu-util

  Alternatively, DFU is shipped with the Yocto SDK and can be used after installing and sourcing the SDK setup script. See the Variscite SDK article for more details

Building U-Boot

Build the bootloader images using the am62x_var_som_r5_usbdfu_defconfig and am62x_var_som_a53_defconfig configs files. The configs required for DFU boot as well as DFU in U-Boot are already enabled. For instructions to build the bootloader images please refer to the Build U-Boot from source code guide.

Booting using DFU

Hardware Setup

Prepare the VAR-SOM-AM62 and Symphony board to boot from DFU:

  1. Power off the Symphony board
  2. Change SW3 to boot from the SD Card
  3. Remove the SD Card
  4. Plug a USB OTG cable from J26 to your host computer
  5. Plug a USB cable to the J29 serial debug console.
  6. Apply power to the Symphony board

In the serial debug console, you should see:

[2085050.210604] usb 3-4.2.3: new high-speed USB device number 34 using xhci_hcd                                                            
[2085050.334776] usb 3-4.2.3: New USB device found, idVendor=0451, idProduct=6165, bcdDevice= 2.00                                          
[2085050.334779] usb 3-4.2.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3                                                      
[2085050.334780] usb 3-4.2.3: Product: AM62x DFU                                                                                            
[2085050.334782] usb 3-4.2.3: Manufacturer: Texas Instruments, Inc.                                                                         
[2085050.334783] usb 3-4.2.3: SerialNumber: 01.00.00.00

Load images using dfu-util

If the hardware is configured correctly, you should see the VAR-SOM-AM62 using dfu-util:

dfu-util -l
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Found DFU: [0451:6165] ver=0200, devnum=37, cfg=1, intf=0, path="3-4.2.3", alt=1, name="SocId", serial="01.00.00.00"
Found DFU: [0451:6165] ver=0200, devnum=37, cfg=1, intf=0, path="3-4.2.3", alt=0, name="bootloader", serial="01.00.00.00"

After building the Build U-Boot from source code guide, load the images:

Export Environment Variables if not already done so:
$ export WORKDIR=~/am62x-var-som-u-boot && \
  export UBOOT_DIR=$WORKDIR/ti-u-boot

Load the images:
$ dfu-util -R -a bootloader -D $UBOOT_DIR/out/r5/tiboot3.bin
   U-Boot SPL 2021.01-00010-ge7ae7212f8-dirty (Apr 27 2023 - 14:31:25 -0500)
   SYSFW ABI: 3.1 (firmware rev 0x0008 '8.6.4--v08.06.04 (Chill Capybar')
   ...
   Trying to boot from DFU
$ dfu-util -R -a tispl.bin -D $UBOOT_DIR/out/a53/tispl.bin
   ################################################DOWNLOAD ... OK
   ...
   Trying to boot from DFU

$ dfu-util -R  -a u-boot.img -D $UBOOT_DIR/out/a53/u-boot.img
   ###DOWNLOAD ... OK                                                                                                                         
   Ctrl+C to exit ...                                                                                                                                                                                                                                                                                                                                                                                                              
   U-Boot 2021.01-00010-ge7ae7212f8-dirty (Apr 27 2023 - 14:31:33 -0500)
   ...

You will see each image print to the console after they are loaded.