i.MX53 Fastboot Example

Document created by jesseg Employee on Aug 8, 2012Last modified by Jodi Paul on Apr 25, 2013
Version 17Show Document
  • View in full screen mode

This example is useful  if you have your device connected to a host machine using a USB cable, and you want your host machine to be able to update your device using a protocol ready to go.

 

Information you need prior to using this example

  • Fastboot is a protocol used to update firmware in Android devices from a host over USB;
  • Freescale implements fastboot as a uboot driver for the device and the implementation is available from patches applied to uboot source code;
  • By default, fastboot is only enabled when building uboot to use with an Android BSP;
  • To run fastboot at the device in default implementation you need to call it from uboot command line (using the debug serial port of the slave device, for example);
  • The host fastboot application is available as source code from Google. You can build your own fastboot(.exe) binary (which is not in the scope of this howto), or you can find a binary ready for you to go searching the web;
  • You are required to be familiar with Linux BSP and have i.MX53 BSP version 11.05 installed.

 

With this information in mind, what do you get from this example?

  • Patch for uboot to enable fastboot driver for iMX53 Quick Start Board with a new spec file;
  • A command line application that set a flag in iMX53 to automatically start fastboot after a reset, either if it is a SOFT or a HARD reset.

 

How to prepare the example

  • Copy uboot patch file (attached) to /opt/freescale/pkgs;
  • Replace your uboot spec file (u-boot.spec.in attached) in <bsp_root>/ltib/config/platform/imx/;
  • Build a system image for iMX53 Quick Start Board with the packages you need;
  • Build the command line application (setbootmode.c attached) using ltib shell;
  • Prepare an SD card copy the command line application /usr/sbin in your SD card system partition. See attachment to this page.

 

How to test the example

  • Boot the Quick Start Board with the SD card you prepared;
  • Login as root using a serial cable and a terminal application;
  • Run setbootmode application as follows:
$ setbootmode 1
  • Reboot the system:
$ reboot

After rebooting, the device will automatically run fastboot from uboot and will wait for a connection from the host machine. You can test the connection using a fastboot binary at the host machine (not provided here).

Even if you HARD reset your hardware, your device will keep running fastboot at startup. If you want to go back to a regular boot operation, you need to cut power supply to your board.

 

How does the magic happen?

The setbootmode application sets the LSB in the Low Power General Register (LPGR) of the Secure Real Time Clock (SRTC) module to true. The patched version o uboot tests for this bit as a flag to run fastboot or not. The magic is that the LPGR is persistent, even during reset.

 

Additional tips

  • You can run setbootmode with no arguments to see its options;
  • You need to set the boot mode to 0 after a successful update to avoid entering fastboot mode again after a new reboot;
  • Partitioning of the device seen by fastboot is not implemented;
  • Besides using setbootmode, you can read/set LPGR using either md.l / nm.l in uboot or devmem2 at command line:
    • uboot-> md.l 0x53fa401c 1 - displays LPGR;
    • uboot-> nm.l 0x53fa401c - presents a prompt for you to change LPGR;
    • linux shell-> devmem2 0x53fa401c w - displays LPGR;
    • linux shell-> devmem2 0x53fa401c w <value> - changes LPGR;

 

devmem2 has issues that you need to fix so that you can use it to change LPGR:
  • include "volatile" in all writing instruction;
  • uncomment 'w' write instruction.

Outcomes