Project Home
Project Home
Wiki
Wiki
Project Information
Project Info
wiki4411: AM_OMAP_boot_resources

TI AM/OMAP Booting and Flash Recovery#

This document provides help with various methods of booting the TI AM/OMAP devices. These instructions are meant to supplement the OMAP3530 Beagle BSP and the AM3517EVM BSP release notes.

Additional information is available in the technical reference manuals for the devices and readers are encouraged to explore those guides before seeking additional help. In particular, section 24 of the AM35xx TRM contains some excellent information about the boot process. Similarly, board-specific information is available in the hardware reference manuals for the evaluation boards.

AM/OMAP Boot ROM#

Normal Boot#

The TI AM/OMAP devices contains a boot ROM that is invoked after the board is released from reset. By default, this ROM transfers control to code in the first bytes of NAND flash -- usually x-loader or QNX's IPL.

Peripheral Boot#

Peripheral boot causes the AM/OMAP device to search for an image on the UART, SD card slot, or other device. This boot mode can be used to launch a known working bootloader and image even if the contents of flash are erased or corrupted. More details on the serial boot method and SD card boot method are described below.

On the Beagle (OMAP3530) board, peripheral boot is activated by pressing the USER button while the Beagle is released from reset or is powered up for the first time.

On the AM3517EVM board, peripheral boot is activated by setting the SW7 bank as follows:

 1   2   3   4   5   6   7   8
ON  OFF OFF ON  OFF OFF OFF ON  

Serial Boot#

UART booting is possible via the pserial utility and is available for public download from:

http://code.google.com/p/omap-u-boot-utils/downloads/list

The following instructions list how to install the Beagle QNX RAM IPL. The instructions are the same for the AM3517BSP except for the name of the IPL file and how peripheral mode is entered. For example, to install the Beagle QNX RAM IPL (ipl-omap3530beagle.bin):

1. Turn OFF the Omap3530 Beagle Board by unplugging the power adapter, and close any open serial terminal programs. Connect a RS232 null modem cable between the host and the RS232 connector (UART3 Debug/Boot) on the OMAP35x Beagle Board base board.

2.In Windows Command Prompt console,

c:\tools>pserial.exe -p COM1 -f /omap3530-beagle/ipl-omap3530beagle.bin
Waiting For Device ASIC ID: Press Ctrl+C to stop

3. Push the user button, and plug in the power adapter. In Windows Command Prompt console,

c:\tools>pserial.exe -p COM1 -f /omap3530-beagle/ipl-omap3530beagle.bin
Waiting For Device ASIC ID: Press Ctrl+C to stop
ASIC ID Detected.
Sending 2ndFile:
Downloading file: 100.000% completed(24576/24576 bytes)
File download completed.

4. Open a serial terminal program and hit ENTER. The following message will display:


QNX Neutrino Initial Program Loader for Texas Instruments OMAP3530 Beagle Board
Commands:

Press 'D' for serial download, using the 'sendnto' utility
Press 'F' to boot an OS image from NAND flash
Press 'U' to Copy an OS image to NAND flash
Press 'I' to Update the IPL

Serial Download of NAND IPL image and OS image #

The following instructions list how to install the Beagle QNX NAND IPL. This is the initial program loader that is installed to NAND flash. The instructions are the same for the AM3517 BSP except for the name of the IPL file and how peripheral mode is entered. For example, to install the Beagle QNX NAND IPL and IFS (nand-ipl-omap3530beagle.bin, ifs-omap3530-beagle.bin):

1. Start the QNX Momentics IDE on the host.

2. Open a terminal server window. See the IDE documentation for details.

3.Type I to update the IPL in the NAND flash.

4. In the terminal server window, click the "send file" button in the upper left corner. A popup window will open. Type or browse the correct image file name (nand-ipl-omap3530beagle.bin) in the "Filename" box and sendto as the proctocol. Click OK to start the download on the host side.

5. After the download process finishes, You should see output similar to the following:

Press 'D' for serial download, using the 'sendnto' utility
Press 'F' to boot an OS image from NAND flash
Press 'U' to Copy an OS image to NAND flash
Press 'I' to Update the IPL
Send the IPL image, using the 'sendnto' utility...
Download OK...
Writing IPL to NAND flash @ blk0 ......
Update IPL OK
Commands:

Press 'D' for serial download, using the 'sendnto' utility
Press 'F' to boot an OS image from NAND flash
Press 'U' to Copy an OS image to NAND flash
Press 'I' to Update the IPL

6.Type U to copy the OS image to the NAND flash.

7. In the terminal server window, click the "send file" button in the upper left corner. A popup window will open. Type or browse the correct image file name (ifs-omap3530-beagle.bin) in the "Filename" box and sendto as the proctocol. Click OK to start the download on the host side.

or using the QNX 'sendnto' utility: sendnto -d/dev/ser1 -b115200 ./ifs-omap3530-beagle.bin to download image

8. After the download process finishes, You should see output similar to the following:

Press 'D' for serial download, using the 'sendnto' utility
Press 'F' to boot an OS image from NAND flash
Press 'U' to Copy an OS image to NAND flash
Press 'I' to Update the IPL
send the ifs now...
download OK...
Writing IFS image to NAND flash from block 4 ......
Upgrade IFS OK...
Commands:

Press 'D' for serial download, using the 'sendnto' utility
Press 'F' to boot an OS image from NAND flash
Press 'U' to Copy an OS image to NAND flash
Press 'I' to Update the IPL

9.Type F ' to boot an OS image from NAND flash. You should see output similar to the following:

reading from NAND flash ........
Found image               @ 0x84000008
Jumping to startup        @ 0x80100480

CPU0: L1 Icache: 256x64
CPU0: L1 Dcache: 256x64 WB
CPU0: L2 Dcache: 4096x64 WB
CPU0: VFP 410330c1
CPU0: 411fc083: Cortex A8 rev 3 500MHz
 EHCI_ViewPort_write timeout 82870090
 EHCI_ViewPort_write timeout 82870090

System page at phys:80010000 user:fc404000 kern:fc404000
Starting next program at vfe047f9c
cpu_startnext: cpu0 -> fe047f9c
VFPv3: fpsid=410330c1
coproc_attach(10): replacing fe0758e4 with fe075130
coproc_attach(11): replacing fe0758e4 with fe075130
Welcome to QNX Neutrino 6.4.1 on the Texas Instruments OMAP3530 (ARMv7 Cortex-A8 core) - Beagle Board

SD Card Boot#

In order for the AM/OMAP boot ROM to boot from an SD card, the card must be in a very specific format. The sections below describe how to format the card from Linux and from Windows.

Formatting from Linux#

The instructions below were mostly taken from:

http://wiki.omap.com/index.php?title=MMC_Boot_Format

For the purposes of these instructions, the SD card device will be called /dev/sdx -- you will need to know which device maps onto your SD card. Also note that these instructions assume that you have root access so care should be taken to select the correct device and not erase an internal hard drive accidentally. The process will delete all contents of the SD card so ensure that anything important is backed up ahead of time.

First, unmount any auto or manually mounted partitions of the SD card. This can be done with:

  umount /dev/sdx1
  umount /dev/sdx2
  etc

  or via the file manager GUI.

Next, clear out the partition table and boot sector of the card. This ensures that no previous formats will remain:

  dd if=/dev/zero of=/dev/sdx bs=1M count=1

Now run fdisk to clear the partition table, set up the geometry, and initialize the partition:

Clear the partition table:

# fdisk /dev/sdx

Command (m for help): o
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Display the card capacity, which is used below:

Command (m for help): p

Disk /dev/sdx: 1973 MB, 1973420032 bytes
...

Go into "Expert mode":

Command (m for help): x

Calculate the number of cylinders required by taking the SD capacity in bytes, dividing by the number of heads, number of sectors per head, and number of bytes per sector, and rounding down to the nearest integer. In the example card shown, this is:

floor(1973420032/255/63/512) = floor(239.921319639) = 239.

This value will differ from card to card and it is important to calculate it correctly.

Set the geometry to 255 heads, 63 sectors and the calculated number of required cylinders:

Expert command (m for help): h
Number of heads (1-256, default 4): 255

Expert command (m for help): s
Number of sectors (1-63, default 62): 63
Warning: setting sector offset for DOS compatiblity

Expert command (m for help): c
Number of cylinders (1-1048576, default 1011): 239
Return to main mode and create a new partition. The partition size used below is only 15 cylinders. To guarantee that the processor will be able to read the filesystem, it should be no larger than 2*1024*1024*1024 bytes. Note that using "+2G" results in a partition that is too large so the number of cylinders should be set manually.
Expert command (m for help): r

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-15, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-15, default 15): 15

Mark it bootable:

Command (m for help): a
Partition number (1-4): 1

Change its type to FAT32:

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): c
Changed system type of partition 1 to c (W95 FAT32 (LBA))

The result is:

Command (m for help): p

Disk /dev/sdx: 1973 MB, 1973420032 bytes
255 heads, 63 sectors/track, 239 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xa2b8daf8

   Device Boot      Start         End      Blocks   Id  System
/dev/sdx1   *           1          15      120456    c  W95 FAT32 (LBA)

Now, really write configuration to card (until here, card is not changed):

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.

Now format the partition as FAT32 to be mounted and populated. Note that before running the commands below you should ensure that the newly created partition has not been auto-mounted again. This can be done with the "umount" steps above.

# mkfs.vfat -F 32 /dev/sdx1
mkfs.vfat 3.0.3 (18 May 2009)

Mount the partition:

mount /dev/sdx1 /mnt

Copy the x-loader software and u-boot to the newly formatted partition. MLO (x-loader) should be the very first file copied since the AM/OMAP bootloader only looks at the first few entries. See a later section for where to obtain the x-loader and u-boot binaries.

cp MLO /mnt
cp u-boot.bin /mnt

Unmount the partition when finished:

umount /dev/sdx1

Formatting from Windows#

To format an SD card from Windows for use with the AM/OMAP bootloader:

  • download the HP USB Disk Storage Format Tool from:
http://www.sysanalyser.com/sp27213.exe
  • Run the downloaded file to install the tool
  • Insert MMC/SD card into the card reader.
  • Launch the HP USB Disk Storage Format Tool.
  • Select FAT32 as File System.
  • Click on Start.
  • After formatting is done Click OK.
  • Copy the x-loader software (MLO) to the SD card first since the AM/OMAP bootloader only looks at the first few entries.
  • Copy u-boot.bin to the SD card.

See a later section for where to obtain the x-loader and u-boot binaries.

X-loader and U-boot binaries#

Beagle Board#

Binaries for X-loader and u-boot for the beagle board can be found at:

http://elinux.org/BeagleBoard#Binaries

For "standard" operation, I recommend using the bootloaders that ship with the boards, which are available at:

http://code.google.com/p/beagleboard/downloads/list

Binaries are also available on CDs that come with the evaluation boards.

AM3517EVM#

Binaries and source for X-loader and u-boot for the AM3517EVM can be found in TI's Platform Support Package:

http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/sdk/AM3517/latest/index_FDS.html

Binaries are also available on CDs that come with the evaluation boards.

Installing QNX IPL and IFS to NAND Flash#

Before installing the QNX IPL to NAND Flash, you should prepare an SD card in the special format mentioned above so that you can re-install x-loader and u-boot at a later time.

These instructions are for the Beagle board. The only differences between the Beagle board and the AM3517EVM board is the name of the NAND IPL and IFS files and the method used to place the board in peripheral boot mode.

Run the mkflashimage.sh script in the Beagle BSP images folder to create nand-ipl-omap3530beagle.bin and copy it to the SD card. Also copy the Beagle IFS (ifs-omap3530-beagle.bin) to the SD card.

Insert the SD card in the Beagle and boot to the u-boot prompt. From u-boot issue the following commands:

mmc init     (or mmcinit, depending on which version of u-boot you're running)
mw.b 80000000 ff 40000
fatload mmc 0 80000000 nand-ipl-omap3530beagle.bin
nandecc hw
nand erase 0 40000
nand write.i 80000000 0 40000
mw.b 80000000 ff 700000
fatload mmc 0 80000000 ifs-omap3530-beagle.bin
nandecc hw
nand erase 80000 700000
nand write.i 80000000 80000 700000

Restoring x-loader and u-boot to NAND Flash#

  • Prepare an SD card in the special format mentioned above.
  • Download X-loader and u-boot binaries from the site mentioned above.
  • Copy X-loader onto the SD card as MLO.
  • Copy u-boot onto the SD card as u-boot.bin.
  • Insert the SD card in the Beagle, and do a peripheral boot with the USER button held down when power is applied or the reset button is hit.
  • Boot to the u-boot prompt and issue the following commands:
mmc init     (or mmcinit, depending on which version of u-boot you're running)
mw.b 80000000 ff 40000
fatload mmc 0 80000000 MLO
nandecc hw
nand erase 0 40000
nand write.i 80000000 0 40000
mw.b 80000000 ff 1c0000
fatload mmc 0 80000000 u-boot.bin
nandecc sw
nand erase 80000 1c0000
nand write.i 80000000 80000 1c0000