Serial Boot and Flash Loading Utility

From Texas Instruments Wiki
Jump to: navigation, search

TI Flash and Boot Utilities

These packages (currently available for the DM35x, DM644x, and DM646x) contain a set of utilities, some for running under CCS on Windows, and others for running from the command-line on both Windows and Linux. In these second set of utilities are applications for flashing the NOR, NAND, and SPI Flash (and in the future SD/MMC cards, I2C EEPROM) of the EVMs via the serial port. All source is included for users who wish to adapt the applications to their own custom platform. The entire project is released under a BSD-style license.

The Serial Flashing Host Utility (which offers the same functionality as a previous program called DVFlasher) executable is called sfh_<DEVICENAME>.exe, where device name is DM35x, DM644x, or DM646x.

The Serial Loading Host Utility (which offers the same functionality as a previous program called DVLoader) executable is called slh_<DEVICENAME>.exe, where device name is DM35x, DM644x, or DM646x.

These programs each encapsulate a distinct binary UBL which is transferred via the UART. This implies that the chip must be operating in the UART boot mode, showing the BOOTME prompt.

NOTE: The assumption is made that the UART of the device operates at 115200, 8N1. If the oscillator used with the device does not match the one used on the EVM (e.g. on a custom platform), the baud rate assumption may be incorrect.

The binary UBL in the case of the Serial Flasher program is known as the Serial Flasher Target, or sft. The binary UBL in the case of the Serial Loader program is the Serial Loader Target, or slt. The build scripts for these are present in the directories of the same name.

The majority of the code for the target and host components is found in the top-level common directory. This code is shared across many devices (hence the name common). When a build for an individual device is done, the common directory is included. The <DEVICENAME> path contains code needed to differentiate each device. Most of this code is found under <DEVICENAME>/common as it is likewise shared between the GNU and CCS components in the package.

Other related software

Other alternatives for RBL UBL and host programs are also available.

Versions for Other Devices

A version of these tools for the OMAP-L138 device can be found at this page.

A version of these tools for the OMAP-L137 device can be found at this page.

A version of these tools for the DM365 device can be found at this page .

Running

- Under Windows - This utilities can be run from the command line under Windows with the .Net Framework 2.0 or later installed.

 sfh_<DEVICENAME>.exe [options]
 slh_<DEVICENAME>.exe [options]

- Under Linux - They can also be run on a Linux machine with the latest open-source Mono Framework installed.

 mono sfh_<DEVICENAME>.exe [options]
 mono slh_<DEVICENAME>.exe [options]

Compiling

A makefile is included for compiling the host and target parts of each utility. The target portions are built first since they are embedded into the the host executables. These target portions are loaded to the DM35x device via the UART boot mode.


Under Windows

The currently supported method is to use the Cygwin environment (such as the one provided with the Montavista Linux tools for Windows) and put the C sharp compiler's (the csc.exe executable) install location in the user's path. This compiler comes with the .NET Framework installation and can usually be found in C:\WINDOWS\Microsoft.NET\Framework\<version number>. Then go to the top level directory of the package and run:

    make

Under Linux

The Mono Framework must be installed and in the path. RPMs may be available at [1]. Then go to the <DEVICE_NAME>/GNU path of the package and run:

    make
 

The above instructions assume the that GNU ARM cross-compiler tools (arm-none-linux-gnueabi-gcc, etc.) are in the current PATH. The CCS portion of the package cannot be built under Linux.

Usage for 1.x Versions

Serial Loader Usage

More info can be found by running the utility with the '-h' option.

  slh_<DEVICENAME>.exe -h

1) Load a UBL or small UBL-like application to the DM35x IRAM

  slh_<DEVICENAME>.exe -load2IRAM <UBL binary file>

2) Load a larger image compiled to run at start of DDR space

  slh_<DEVICENAME>.exe -load2DDR <binary application file>

For the load to IRAM option, the file size is limited to 14KB, and the application assumes an entry point address of 0x0100 (the smallest allowed). The entry point address canbe modified by using the -startAddr command line option, with the address specified in hex.

For the load to DDR option, the file size is limited to 32MB, and the application assumes a load address and entry point address of 0x80000000. The entry point address can be altered by using the -startAddr command line option, as with the -load2IRAM case. The load address can be altered from the default by using the -loadAddr command line option

Serial Flasher Usage

More info can be found by running the utility with the '-h' option.

  sfh_<DEVICENAME>.exe -h

1) Erase the NAND flash

  sfh_<DEVICENAME>.exe -nanderase

2) Flash the NAND with a UBL and u-boot image

   sfh_<DEVICENAME>.exe -nandflash  <UBL binary file> <binary application file>

The entry point of the UBL is assumed to be 0x0100, but this can be changed by using the -UBLStartAddr option. The entry point and load address of the application default to 0x81080000 (u-boot defaults). To change these values, use the -APPStartAddr and -APPLoadAddr option.

   sfh_<DEVICENAME>.exe -nandflash  -UBLStartAddr <address>  -APPLoadAddr <address> <UBL binary file> <binary application file>

3) Erase the NOR flash

  sfh_<DEVICENAME>.exe -norerase

4) Flash the NOR with a UBL and u-boot image

   sfh_<DEVICENAME>.exe -norflash  <UBL binary file> <binary application file>

The entry point of the UBL is assumed to be 0x0100, but this can be changed by using the -UBLStartAddr option. The entry point and load address of the application default to 0x81080000 (u-boot defaults). To change these values, use the -APPStartAddr and -APPLoadAddr option.

   sfh_<DEVICENAME>.exe -norflash  -UBLStartAddr <address>  -APPLoadAddr <address> <UBL binary file> <binary application file>

5) Flash the NOR with a single u-boot image (old u-boot builds)

   sfh_<DEVICENAME>.exe -norflash_noubl  <binary application file>


  NOTE: Currently, YOU MUST USE THE UBL BINARY CREATED BY THE UBL PROJECT IN THIS PACKAGE.  
        If you use any other UBL binary, the boot procedure will most likely fail.

Other Options for Both Utilities

  -p <COM PORT NAME>  : Allows specifying com port other than default 'COM1' or '/dev/ttyS0'.
  -h                  : Show help text.
  -v                  : See verbose output from the DM35x.

Usage for 2.x Versions

The 2.x versions of the tools introduced the ability to target specific devices of a device family within the flashing and loading tools. Individual UBL versions are built for each device type. To see what device types and flash types are supported in the package, you should examine the device.mak file. Alternatively, you can run either the 'slh' or 'sfh' programs with the '-h' option to view the help screen. The supported device and flash types (along with the defaults) are listed under the '-targetType' and '-flashType' options.

Serial Loader Usage

More info can be found by running the utility with the '-h' option.

  slh_<DEVICENAME>.exe -h

1) Load a UBL or small UBL-like application to the DM35x IRAM

  slh_<DEVICENAME>.exe -targetType <TargetTypeName> -load2IRAM <UBL binary file>

2) Load a larger image compiled to run at start of DDR space

  slh_<DEVICENAME>.exe -targetType <TargetTypeName> -load2DDR <binary application file>

For the load to IRAM option, the file size is limited to the maximum UBL size (14KB for DM644x, 30KB for others), and the application assumes an entry point address of 0x0100 (the smallest allowed). The entry point address can be modified by using the -startAddr command line option, with the address specified in hex.

For the load to DDR option, the file size is limited to 32MB, and the application assumes a load address and entry point address of 0x80000000. The entry point address can be altered by using the -startAddr command line option, as with the -load2IRAM case. The load address can be altered from the default by using the -loadAddr command line option

Serial Flasher Usage

More info can be found by running the utility with the '-h' option.

  sfh_<DEVICENAME>.exe -h

Examples:

  1. Erase the NAND flash attached to a DM6446
       sfh_DM644x.exe -erase -flashType NAND -targetType DM6446
  2. Flash the NAND attached to DM6446 with a UBL and u-boot image
       sfh_DM644x.exe -flash -flashType NAND -targetType DM6446 <UBL binary file> <u-boot binary file>
  3. Erase a NOR flash attached to a DM6441
       sfh_DM644x.exe -erase -flashType NOR -targetType DM6441
  4. Flash a NOR flash attached to a DM6441 with a UBL and u-boot image
       sfh_DM644x.exe -flash -flashType NOR -targetType DM6441 <UBL binary file> <binary application file>
  5. Flash the NOR with a single u-boot image (old u-boot builds)
       sfh_DM644x.exe -flash_noubl -flashType NOR <binary application file>

NOTE: YOU SHOULD USE THE UBL BINARY CREATED BY THE UBL PROJECT IN THIS PACKAGE. Using any other UBL image is not guaranteed to work.

Other Options for Both Utilities

  -baud               : Allows specifying the baud rate (if hardware setup supports this)
  -p <COM PORT NAME>  : Allows specifying com port other than default 'COM1' or '/dev/ttyS0'.
  -h                  : Show help text.
  -v                  : See verbose output from the DM35x.

Obtaining the software

The latest software can be download from SourceForge by visiting the download page here.

Test Environment

The binaries included in the package were generated under Windows XP SP2 using the .NET Framework v2.0 C# compiler (csc.exe, v8.00.50727.42) and the CodeSourcery arm-none-linux-gnueabi cross compiler (gcc v4.2.3, Sourcery G++ Lite 2008q1-126). The slh and sfh binaries were tested under Windows XP using the .Net framework v2.0 and the Mono Framework for Windows v1.9.1, with a native serial port. Previous versions have been tested under Fedora 7 Linux, using a USB->serial adapter (Prolific PL2303 chipset), running both the Mono 1.2.3 and Mono 1.9.1 Frameworks.

Recent builds (>=2.0) have been tested under Windows XP SP2 using the .NET Framework v3.5 C# compiler (version 3.5.30729.1). The sfh tool was tested under Fedora 11 Linux with Mono version 2.4.2.3, on a system with a native serial port.

Known Problems

We have had reports of problems when using this utility with a USB to Serial adapter on Ubuntu or Kubuntu 8.04. The data transfer hangs while the CRC is being transmitted to the EVM from the host.

The Mono serial port code for Linux platforms has a major bug that affects Mono 1.2.6 and 1.9.1. This has been fixed in newer versions of Mono (ie 2.0: for OpenSuSE 11.1 Mono 2.0.1 its still broken but its seemingly fixed in OpenSuSE 11.1 Mono 2.6.3). Some distributions may have backported the fix to older versions of Mono. If not you can fix the Mono write_serial() function in support/serial.c yourself.

To fix Mono under Ubuntu 8.04:

 sudo -i
 mkdir mono
 cd mono
 apt-get build-dep mono-2.0-devel
 apt-get source mono-2.0-devel
 wget http://processors.wiki.ti.com/images/9/93/Mono-fix-linux-serial.patch.gz
 cd mono-1.2.6+dfsg
 zcat Mono-fix-linux-serial.patch.gz | patch -p 1
 dpkg-buildpackage -b
 dpkg -i ../libmono0_1.2.6+dfsg-6ubuntu3_i386.deb

This has been tested and works on Ubuntu 8.04 using standard serial ports and USB serial port adapters.

To fix Mono under Ubuntu 9.04:

You can do the above steps, or you can use an unofficial Mono 2.4.2.3 package for Ubuntu 9.04.

License

These tools are provided as freeware, with no guarantee. Issues can be reported to the DaVinci Linux Open Source mailing list.