NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

TI811X PSP UBOOT User Guide

From Texas Instruments Wiki
Jump to: navigation, search
TIBanner.png
TI811X PSP UBOOT User Guide
Linux PSP
Construction Icon small.png This page is currently under construction. The content of this page is due to change quite frequently and thus the quality and accuracy are not guaranteed until this message has been removed. Please feel free to contribute to this page while construction is in progress.

Contents

Read This First[edit]

NOTE:
This section shows the major updates since last release, please review this section before any SW activities.

By default the kernel and u-boot supports BCH8 ECC which is recommended for UBIFS. For testing JFFS2 on NAND, following steps need to be followed to enable 1-Bit HW ECC algorithm

  1. U-boot patch ti811x-u-boot-nand-change-to-hamming-ecc-scheme.patch.
  2. Linux Kernel patch ti811x-kernel-nand-change-to-hamming-ecc-scheme.patch.
  3. The maximum size of the filesystem that can be flashed to NAND device is 200MiB.
  4. The ECC scheme needs to be chosen appropriately when flashing 1st & 2nd stage of u-boot binaries on NAND. This is required only for testing JFFS2. Examples are shown in Flashing 1st stage u-boot to NAND from SD card and Flashing 2nd stage u-boot to NAND from SD card; lines marked with 'required only when uboot uses 1-bit HW ECC' when 1-bit HW ECC is set by default (i.e., JFFS2 file system has to be used).


If the previous Uboot used a different ECC scheme from the default ECC present in the current release, erase all images (and the environment if applicable) that were flashed on to NAND and re-flash the images with the new ECC scheme.


Hardware modification for NAND/NOR 16bit Bus width
16-bit NAND is supplied with the EVM but the bus width selection switch is not populated on the EVM. By default, GPMC_D[12] is pulled down, hence corresponding to 8-bit NAND support. So, to support the NAND boot on the EVM (having 16-bit NAND), the following modification has to be done:

  • Pull up GPMC_D[12]: the resistor populated at R336 should be moved to R313

This will set BTMODE12 to 1, which is the required configuration to support 16-bit NAND.


Multiple bad blocks in Uboot

  • If multiple contnuous bad blocks are reported on the NAND flash in the Uboot, run the 'nand scrub' command once.

Some good blocks are incorrectly marked bad in this case. Running the 'nand scrub' command once fixes this issue.

U-Boot[edit]

The ROM code serves as the first stage bootloader. In case of NAND/SPI/SD boot mode, it loads a cut-down version of U-Boot (called u-boot.min or MLO) from the flash memory into OCMC RAM0, which initialises DDR and then loads / runs full U-boot off DDR. In case of NOR boot mode, the ROM code passes control to the U-Boot image stored in NOR memory after some basic initialization.

Note:

  1. Size of U-Boot (TEXT + BSS section) cannot exceed 255 KiB.
  2. U-boot is generally loaded at and executed from address 0x81000000. To avoid overwriting U-Boot when it is executing, make sure that an address greater than 0x81040000 is used when downloading the kernel and/or filesystem images.
  3. There is a difference in the U-Boot prompt for the 2 stages. The 1st stage prompt is TI-MIN# while that for the 2nd stage is TI811X_EVM#. The prompt specified in the commands is meant to serve as an indication of which stage it should be executed from. Most of the commands mentioned in the doc are meant to be executed from the 2nd stage.
  4. NOR boot has only two stages of bootloader. ROM code serves as the 1st stage bootloader and the u-boot serves as the second stage boot loader. u-boot.min is not used here as the NOR is XIP (execute in-place) and hence the complete u-boot binary can be placed in the NOR flash.

Two stage U-Boot design[edit]

This section gives an overview of the two stage U-Boot approach adopted for TI811x.

The size of the internal RAM in TI811x is 128 KiB, out of which 18 KiB at the end is used by the ROM code. This placed a limit of 110 KiB on the size of the U-Boot binary which the ROM code can transfer to the internal RAM.

U-Boot also requires some space for the stack, heap and global data during executing and this region currently needs to be setup before the TEXT_BASE of U-Boot.

Since it is not possible to squeeze in all the functionality that is normally expected from U-Boot in < 110 KiB (after setting aside some space for stack, heap etc) a two stage approach has been adopted.

The first stage (or rather the 2nd stage if the ROM code is also considered) is built using a minimal configuration and has an embedded ENV. The purpose of this stage is to initialize the necessary peripherals, especially DDR, so that a full fledged U-Boot can be transferred to DDR from NAND/SPI/SD/UART/NOR and then control passed to it.

The boot command that the minimal U-Boot uses for fetching the larger U-Boot will not change for a particular boot mode as long as the same layout is used and is hence fixed. If any other behavior required then the minimal U-Boot stage can be interrupted and a different command issued.

The minimal U-Boot binary also has a hole at the top which is used as the space for stack, heap and global data. After some analysis the size of the hole has currently been set as 12 KiB.

Building U-Boot[edit]

U-Boot Configurations[edit]

1st stage u-boot configurations
Boot Modes Output File TI811x
NAND u-boot.min.nand ti811x_evm_min_nand
SPI
u-boot.min.spi ti811x_evm_min_spi
NOR
NA
NA
SD
u-boot.min.sd ti811x_evm_min_sd
UART
u-boot.min.uart ti811x_evm_min_uart
EMAC
NA Not supported

2nd stage u-boot configurations
Boot Modes Output File TI811x
NAND u-boot.bin ti811x_evm_config_nand
SPI
u-boot.bin ti811x_evm_config_spi
NOR
u-boot.bin ti811x_evm_config_nor
SD
u-boot.bin ti811x_evm_config_sd
UART
NA
use NAND/SPI/SD
EMAC
NA
NA

U-Boot supports saving environment variables to NAND, SPI, NOR or MMC. The media to be used for saving the ENV variables needs to be decided before building U-Boot.The environment variables will be saved in the media for which the second stage u-boot is built.

Building 1st stage u-boot[edit]

Different boot modes have different requirements for the U-Boot-MIN stage.

  • When using memory boot (NAND/SPI) a header needs to be attached to the U-Boot binary indicating the the load address and the size of the image. SPI boot also requires endian conversion before flashing the image.
  • When using peripheral boot (UART,EMAC) there can be no header as the load address is fixed.

For easy generation of the different images, different target names have been provided in the Makefile. The different target names take care of building the appropriate image (with or without the header and with or without endian conversion).

U-Boot-MIN stage uses a pre-defined command to load the 2nd stage and does not support commands such as dhcp, tftp, saveenv etc. All the commands are available only from the 2nd stage of U-Boot which the 1st stage U-Boot autoloads (if present).

$ make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm distclean
$ make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm <1st stage config from table (e.g. ti811x_evm_min_nand)>
$ make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm u-boot.ti

NoteNote: The fist stage binary(u-boot.min.sd) generated for the SD boot mode must be renamed to "MLO" before copping to the SD card.

Building 2nd stage u-boot[edit]

The 2nd stage of U-Boot supports saving environment variables to NAND, SPI or SD Card. The media to be used stored for saving the ENV variables needs to be decided before building the 2nd stage of U-Boot.

$ make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm distclean
$ make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm <2nd stage config from table (e.g. ti811x_evm_config_nand)>
$ make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm u-boot.ti

Serial port configuration[edit]

TI811x EVM comes with onboard USB-to-serial converter. The USB cable supplied with the EVM can be used to connect the EVM to a host. The mini-USB end of the cable should be connected to J6 connector (labelled USB_UART) on the EVM.

For correct operation the serial terminal software should be configured with the following settings:

* Baud rate: 115,200
* Data bits: 8
* Parity: None
* Stop bits: 1
* Flow control: None
* Transmit delay: 0 msec/char, 100 msec/line 

NOTE: If Teraterm is used ensure that version 4.67 or later of Teraterm is installed. The implementation of the kermit protocol in Teraterm is not reliable in older versions. The latest version of Teraterm can be downloaded from here.

EVM Switch Settings[edit]

Boot Pin Settings
SW-4
SW-6
Boot Mode 5 4 3 2 1 1 2 3
NAND 1 0 0 1 0 1 X X
SPI 1 0 1 1 0 X X 1
UART 0 0 0 0 1 X X X
SD 1 0 1 1 1 X X X
NOR 1 0 0 0 0 X 1 X
EMAC 0 0 1 0 0 X X X

Advance Switch Settings

  • JAMR2 SW2[1:0] to enable NOR GPMC_A25

J5 nor gpmc 25.PNG

  • Switch SW10[2]=1 must be enabled to select NOR GPMC lines
  • Note: NOR and Ethernet will not work simultaneously due to the shared GPMC lines

For other important switch settings, please refer evm811x_SystemSummary.html

Flashing U-Boot using CCS[edit]

TI811x

PLEASE NOTE: BOTH THE STAGES OF U-BOOT NEED TO BE FLASHED ON THE SAME MEDIA

You can flash the 1st stage of U-Boot onto NAND (for NAND boot) or to SPI (SPI Boot) or to NOR (for NOR boot) using the Flashing Tools provided in the PSP releases.

Refer to Flashing to NAND Flash using CCS wiki page for instructions on how to flash the pre-built (or compiled) binary of the 1st stage for NAND boot i.e. u-boot.min.nand (or the recompiled one) with the help of the NAND flash writer.

Refer to Flashing to SPI Flash using CCS wiki page for instructions on how to flash the pre-built (or compiled) binary of the 1st stage for SPI boot i.e. u-boot.min.spi (or the recompiled one) with the help of the SPI flash writer.

Refer to Flashing to NOR Flash using CCS wiki page for instructions on how to flash the pre-built (or compiled) binary for NOR boot i.e. u-boot.bin (or the recompiled one) with the help of the NOR flash writer.

Note
NOR boot has only two stages of boot loader - ROM boot loader and u-boot. There is no u-boot min binary for NOR as in the case of other boot modes.

Once the 1st stage U-Boot has been flashed using the flashing tool

Flashing U-Boot without CCS[edit]

PLEASE NOTE: BOTH THE STAGES OF U-BOOT NEED TO BE FLASHED ON THE SAME MEDIA

It is possible to flash U-Boot to NAND or SPI from the 2nd stage of U-Boot which is loaded over UART or from SD card. Before proceeding with this please make sure that the 2 binaries for flashing (U-Boot-MIN and U-Boot 2nd stage) have been built.

UART-Flash-Method[edit]

  1. Boot over UART to load the 1st stage of U-Boot as described over here. Make sure that you interrupt the countdown in the 1st stage i.e. at the TI-MIN# prompt.
  2. Load the 2nd stage of U-Boot over UART as described over here.
  3. Flash the 1st stage of U-Boot to either NAND using the steps over here or to SPI using the steps over here.
  4. Flash the 2nd stage of U-Boot to either NAND using the steps over here or to SPI using the steps over here.
  5. After flashing the 2 stages use the appropriate switch settings to boot from NAND or from SPI.

SD-Flash-Method[edit]

Make sure the two binaries for NAND boot (u-boot.min.nand and u-boot.bin) or for SPI boot (u-boot.min.spi and u-boot.bin) which are required for flashing are present on the SD. Please refer to the section of building U-Boot to generate the images.

  1. Boot using SD card to load both the 1st stage and the 2nd stage as described. Do not interrupt the countdown till the TI811X_EVM# prompt comes.
  2. Flash the 1st stage of U-Boot to either NAND using the steps over here or to SPI using the steps over here.
  3. Flash the 2nd stage of U-Boot to either NAND using the steps over here or to SPI using the steps over here.
  4. After flashing the 2 stages use the appropriate switch settings to boot from NAND or from SPI.

U-Boot NAND Support[edit]

Before proceeding with any of the commands given in this section please make sure that NAND is enabled on the EVM. The switch for enabling NAND is shown over here.

This section gives an overview of the NAND support in U-Boot. It also describe how to store the kernel image or the JFFS2/UBIFS filesystem to NAND so as to have a network-free boot right from powering on the board to getting the kernel up and running.

Overview[edit]

Micron NAND parts (page size 2 KiB, block size 128 KiB) are supported on TI811x EVM.

Note

  • The following sub-sections illustrate the usage of NAND specific commands on TI811x EVM.
  • If u-boot is built with NAND support and if NAND is disabled in the EVM (or NOR is enabled) then u-boot will crash immediately after displaying the banner. Refer to EVM Switch Settings section for more info on enabling/disabling different boot devices.

NAND Layout[edit]

The NAND part on the EVM has been configured in the following manner. The addresses mentioned here are used in the subsequent NAND related commands.


TI811x

 +------------+->0x00000000-> U-Boot 1st stage start
|            |
|            |-->0x0001FFFF-> U-Boot 1st stage end  
|            |-->0x00020000-> U-Boot 2nd stage start
|            |
|            |-->0x0025FFFF-> U-Boot 2nd stage end  
|            |-->0x00260000-> ENV start
|            |
|            |
|            |-->0x0027FFFF-> ENV end
|            |-->0x00280000-> Linux Kernel start
|            |
|            |
|            |
|            |
|            |-->0x006BFFFF-> Linux Kernel end
|            |-->0x006C0000-> Filesystem start
|            |
|            |
|            |
|            |
|            |
|            |
|            |
|            |
|            |
|            |-->0x0CEDFFFF-> Filesystem end
|            |-->0x0CEE0000-> Free start
|            |
|            |
|            |
+------------+-->0x10000000-> NAND end (Free end)


Writing to NAND[edit]

To write len bytes of data from a memory buffer located at addr to the NAND block offset:

TI811X_EVM# nand write <addr> <offset> <len>

If a bad block is encountered during the write operation, it is skipped and the write operation continues from next 'good' block.

For example, to write 0x40000 bytes from memory buffer at address 0x80000000 to NAND - starting at block 32 (offset 0x400000):

TI811X_EVM# nand write 0x80000000 0x400000 0x40000

Reading from NAND[edit]

To read len bytes of data from NAND block at a particular offset to the memory buffer in DDR located at addr:

TI811X_EVM# nand read <addr> <offset> <len>

If a bad block is encountered during the read operation, it is skipped and the read operation continues from next 'good' block.

For example, to read 0x40000 bytes from NAND - starting at block 32 (offset 0x400000) to memory buffer at address 0x80000000:

TI811X_EVM# nand read 0x80000000 0x400000 0x40000


Marking a bad block[edit]

Some of the blocks in the NAND may get corrupted over a period of time. In such cases you should explicitly mark such blocks as bad so that the image that you are writing to NAND does not end up getting corrupted.

To forcefully mark a block as bad:

TI811X_EVM # nand markbad <offset>

For example, to mark block 32 (assuming erase block size of 128 KiB) as bad block - offset = blocknum * 128 * 1024:

TI811X_EVM# nand markbad 0x400000

Viewing bad blocks[edit]

To view the list of bad blocks:

TI811X_EVM# nand bad

Note
The user marked bad blocks can be viewed by using this command only after a reset.

Erasing NAND[edit]

To erase NAND blocks in a particular the address range or using block numbers:

TI811X_EVM# nand erase <stoffaddr> <len>

This commands skips bad blocks (both factory or user marked) encountered within the specified range.

For example, to erase blocks 32 through 34:

TI811X_EVM# nand erase 0x00400000 0x40000

NAND ECC algorithm selection[edit]

NAND flash memory, although cheap, suffers from problems like bit flipping which lead to data corruption. However by making use of some error correction coding (ECC) techniques it is possible to workaround this problem.

For the data stored in NAND flash, U-Boot supports following NAND ECC schemes

  1. S/W ECC (Hamming code)
  2. H/W ECC (Hamming code, BCH4, BCH8, BCH16)

NOTE: Current releases do not support BCH4 and BCH16.

BCH Flash OOB Layout[edit]

For any ECC scheme we need to add some extra data while writing so as to detect and correct (if possible) the errors introduced by the NAND part. In case of BCH scheme some bytes are needed to store the ECC related info.

The section of NAND memory where addition info like ECC data is stored is referred to as Out Of Band or OOB section.

The first 2 bytes are used for Bad block marker – 0xFFFF => Good block

The next ‘N’ bytes is used for BCH bytes

N = B * <Number of 512-byte sectors in a page>

B =  8 bytes per 512 byte sector in BCH4
B = 14 bytes per 512 byte sector in BCH8 
B = 26 bytes per 512 byte sector in BCH16

So for a 2k page-size NAND flash with 64-byte OOB size, we will use BCH8. This will consume 2 + (14*4) = 58 bytes out of 64 bytes available.

The NAND flash part used in EVM does not have enough spare area to support BCH16.

ECC Schemes and their context of usage
ECC type Usage
S/W ECC Not used
H/W ECC - Hamming Code Not used by default. Switch back to this only if using JFFS2 file system.
H/W ECC – BCH8 Used by default to flash any image from the Uboot. Environment variables are also stored in this ECC scheme.


To select ECC algorithm for NAND:

TI811X_EVM# nandecc [sw | hw <hw_type>] 

Usage:

   sw - Set software ECC for NAND
hw <hw_type> - Set hardware ECC for NAND
 <hw_type> - 0 for Hamming code
             1 for bch4
             2 for bch8
             3 for bch16
Currently we support only Software, Hamming Code and BCH8. We do not support BCH4 and BCH16

Transferring images to NAND via U-Boot[edit]

Note
When updating any partition in NAND, please erase the complete partition and not just the space needed by the image which will be transferred onto NAND

Make sure the EVM is connected to network. This is required to get Linux Image from a tftp server. If there is no DHCPserver in the network then use static ip. The section on U-Boot network configuration gives commands for doing this.

Make sure tftp server is running in a windows PC and the home directory for the tftp server has Linux kernel uImage. This windows PC should be accessible from the EVM.

Flashing U-Boot from U-Boot[edit]

1st Stage:

TI811X_EVM# nand erase 0x0 0x20000   <=== Erasing the whole partition before flashing the image
TI811X_EVM# tftp 0x83000000 u-boot.min.nand
TI811X_EVM# nand write.i 0x83000000 0x0 0x20000

2nd Stage:

TI811X_EVM# nand erase 0x20000 0x60000   <=== Erasing the whole partition before flashing the image
TI811X_EVM# tftp 0x83000000 u-boot.bin
TI811X_EVM# nand write.i 0x83000000 0x20000 0x60000

Flashing Linux Kernel from U-Boot[edit]

TFTP the kernel uImage to DDR.

TI811X_EVM# tftp 82000000 <kernel_image>

Now flash the kernel image to NAND at the appropriate offset (refer to NAND layout section for the offsets)

TI811X_EVM# nand erase 0x00280000 0x00400000
TI811X_EVM# nand write 0x82000000 0x00280000 <image_size> (example, 0x200000)

Creating UBIFS File-System[edit]

Refer to TI811x UBIFS Support guide

Creating JFFS2 File-system[edit]

Since jffs2 is used only on flash devices, a standard Linux distribution does not have the tools to make a jffs2 file system.Refer TI811x_MTD_Utilities wiki page for instructions on how to create JFFS2. mkfs.jffs2 is the tool needed to build a jffs2 file system and the source is in this code. All of the MTD code will be downloaded but only the code to build mkfs.jffs2 is built.

With the mkfs.jffs2 utility built and in place it is now time to make the jffs2 file system from of the target directory. Change to the /home/user directory and enter the mkfs.jffs2 command below. Probably the most important argument to the utility is the erase block size. For the NAND part on the TI811x EVM board the erase block is 128k.

[root@localhost]# cd /home/<user>/mtd/install/sbin
[root@localhost]# ./mkfs.jffs2 -lqn –e 128 -r <target_fs> -o /tftpboot/rd-jffs2.bin


By building the file in the /tftpboot directory, the step of copying it over is eliminated. The file must now be written into flash at a specific location. In u-boot, the flash file system will get flashed to the physical address 0x6c0000 and will be mounted by the kernel from /dev/mtdblock<partition-number>, partition-number starts from 0, refer flash layout for individual flash devices and partition creation order for exact number. Use 'cat /proc/partitions' at Linux prompt for the list of partitions.

After identifying the partition, unprotect the flash area where the file system will reside, erase that area. Download the rd-jffs2.bin file. Write it to flash. Modify bootargs to support a JFFS2 file system as root on /dev/mtdblock<partition-number>. Save the environment variables.


Flashing File-system from U-Boot[edit]

First TFTP the filesystem image (example - rootfs-base.jffs2 or ubi.img) to DDR.

TI811X_EVM# mw.b 0x83000000 0xFF 0x0C820000 <=== This is required to get rid of "Empty Flash" JFFS2 during kernel boot.
TI811X_EVM# tftp 0x83000000 <filesystem_image> 

Flash the file system image to NAND using the appropriate offsets

For JFFS2 file system:  
TI811X_EVM# nand erase 0x006C0000 0x0C820000  <=== Erasing the whole partition before flashing the image

For UBIFS file system: 
TI811X_EVM# nand erase 0x006C0000 0x0C820000  <=== Erasing the whole partition before flashing the image

TI811X_EVM# nand write 0x83000000 0x006C0000 <image_size> <=== Example, 0x01040000
NOTE: The image size should be upward aligned to NAND page size which is 2KiB (i.e. 0x800). 
For example, if the image size is 0x19B8004 the size to be passed to the NAND write 
command should be 0x19B8800.
         Also, refer [[1]] for information on JFFS2 error/warning messages.

NOTE If you have flashed the UBIFS on NAND flash, make sure to power-cycle the board before booting.

Please follow the steps to set the environment for Booting Linux Kernel and Filesystem

U-Boot SPI Support[edit]

Before proceeding with any of the commands given in this section please make sure that SPI is enabled on the EVM by SW6:3==ON.

This section gives an overview of the SPI support in U-Boot. It also describe how to store the kernel image or the JFFS2 filesystem to SPI flash so as to have a network-free boot right from powering on the board to getting the kernel up and running.

Overview[edit]

Winbond SPI Flash part W25X32 is supported on TI811x EVM. Refer http://www.mail-archive.com/u-boot@lists.denx.de/msg35376.html for information on supporting new Winbond SPI flashes. This mail thread discusses on adding support for W25Q64 SPI flash part.


Note

  • The following sub-sections illustrate the usage of SPI specific commands on TI811x EVM.
  • Refer to EVM Switch Settings section for more info on enabling/disabling different boot devices.

SPI Flash Layout[edit]

The SPI flash part on the EVM has been configured in the following manner. The addresses mentioned here are used in the subsequent SPI related commands.

TI811x

+-------------+->0x00000000-> U-Boot 1st stage start
|		|
|		|-->0x0001FFFF-> U-Boot 1st stage end  
|		|-->0x00020000-> U-Boot 2nd stage Start
|		|
|		|-->0x0005FFFF-> U-Boot 2nd stage end
|		|-->0x00060000-> ENV start
|		|
|		|
|		|-->0x00061FFF-> ENV end
|		|-->0x00062000-> Linux Kernel start
|		|
|		|
|		|
|		|
|		|-->0x002E1FFF-> Linux Kernel end <======= If the size of the kernel is more, the end address will change.
|		|-->0x002E2000-> Filesystem start
|		|
|		|
|		|
+--------------+-->0x00400000-> Filesystem end 

NOTE :

  • Type sf in u-boot prompt to get help on SPI flash commands
  • Before using any SPI command, first the SPI flash has to be probed using the sf probe 0 command. Here 0 is the SPI flash chip select number

Writing to SPI Flash[edit]

To write len bytes of data from a memory buffer located at addr to offset in SPI flash:

TI811X_EVM# sf write addr offset len

For example, to write 0x1000 bytes from memory buffer at address 0x80000000 to SPI flash - starting at offset 0x4000:

TI811X_EVM# sf write 0x80000000 0x4000 0x1000

Reading from SPI Flash[edit]

To read len bytes of data from SPI flash at a particular offset to the memory buffer located at addr:

TI811X_EVM# sf read addr offset len

For example, to read 0x1000 bytes from flash - starting at offset 0x4000 to memory buffer at address 0x80000000:

TI811X_EVM# sf write 0x80000000 0x4000 0x1000

Erasing SPI Flash[edit]

To erase len bytes from 'offset' in a SPI flash:

TI811X_EVM# sf erase offset len

For example, to erase 0x1000 bytes from offset 0x4000:

TI811X_EVM# sf erase 0x4000 0x1000

Transferring images to SPI flash via U-Boot[edit]

Make sure the EVM is connected to network. This is required to get Linux Image from a tftp server. If there is no DHCPserver in the network then use static ip. The section on U-Boot network configuration gives commands for doing this.

Make sure tftp server is running in a windows PC and the home directory for the tftp server has Linux kernel uImage. This windows PC should be accessible from the EVM.

Flashing 1st stage of U-Boot to SPI from 2nd stage U-Boot[edit]

Flash U-Boot-MIN for SPI (u-boot.min.spi) to SPI flash by executing the following commands:

TI811X_EVM# tftp 0x83000000 u-boot.min.spi
TI811X_EVM# sf probe 0:0 
TI811X_EVM# sf erase 0x0 0x20000
TI811X_EVM# sf write 0x83000000 0x0 0x20000

If no error messages are displayed then the 1st stage for SPI boot is successfully flashed to SPI.

Flashing 2nd stage of U-boot to SPI from 2nd stage of U-boot[edit]

Flash 2nd stage u-boot image (u-boot.bin) to SPI flash by executing the following commands:

TI811X_EVM# mw.b 0x83000000 0xFF 0x40000
TI811X_EVM# tftp 0x83000000 u-boot.bin
TI811X_EVM# sf probe 0:0 
TI811X_EVM# sf erase 0x20000 0x40000
TI811X_EVM# sf write 0x83000000 0x20000 0x40000

Flashing Linux Kernel from U-Boot[edit]

TFTP the kernel uImage to DDR.

TI811X_EVM# tftp 82000000 <kernel_image>

Now flash the kernel image to flash at the appropriate offset (refer to SPI layout section for the offsets)

TI811X_EVM# sf probe 0:0
TI811X_EVM# sf erase 0x62000 0x280000
TI811X_EVM# sf write 0x82000000 0x62000 <image_size> (example, 0x200000)

Creating JFFS2 File-system[edit]

NOTE: JFFS2 cannot be supported on the SPI flash available on TI811x EVM due to erase size restrictions. The erase sector size of W25X32 is 4KiB but JFFS2 requires it be minimum 8KiB. Hence JFFS2 filesystem cannot be used on this flash part. For help on JFFS2 filesystem creation (for other SPI flash parts) refer Creating JFFS2 File-system

Flashing File-system from U-Boot[edit]

TI811X_EVM# tftp 83000000 <filesystem_image>


Flash the file system image to flash using the appropriate offsets

TI811X_EVM# sf probe 0:0
TI811X_EVM# sf erase 0x2e2000 0x11E000
TI811X_EVM# sf write 0x83000000 0x2e2000 0x11E000


Please follow the steps to set the environment for Booting Linux Kernel and Filesystem

U-Boot NOR Support[edit]

This section gives an overview of the NOR support in U-Boot. It also describe how to store the kernel image, RAMDISK or the JFFS2 filesystem to NOR so as to have a network-free boot right from powering on the board to getting the kernel up and running.

Overview[edit]

Important
Please note that the U-Boot commands used in this section is applicable only from a U-Boot which is already running from NOR. Please refer to the Flashing Tools page for flashing the U-Boot image to NOR.

NOR Porting guide[edit]

Refer to NOR Porting guide for interfacing NOR on various daughter boards to DM81xx

Board Modification[edit]

NOR Pin Muxing Info for TI811X EVM[edit]

  • ROM Code initializes only 12 GPMC address lines (gpmc_a0 - gpmc_a11) hence it can access only first 4KBytes of the NOR.
  • Pin muxing for remaining address lines are done by u-boot as given below
gpmc_a12 -----> vout0_fid_mux1
gpmc_a13 -----> vout1_g_y_yc2
gpmc_a14 -----> vout1_r_cr3
gpmc_a15 -----> vout1_r_cr2
gpmc_a16 -----> gpmc_a16
gpmc_a17 -----> gpmc_a17
gpmc_a18 -----> gpmc_a18
gpmc_a19 -----> gpmc_a19
gpmc_a20 -----> gpmc_a_20_mux0
gpmc_a21 -----> gpmc_a_21_mux0
gpmc_a22 -----> gpmc_a_22_mux0
gpmc_a23 -----> gpmc_a_23_mux0
gpmc_a24 -----> gpmc_cs2
gpmc_a25 -----> gpmc_cs1
gpio1_22 -----> mmc2_dat4
  • gpmc_a27 should be configured as gpio1_22 and its output should be set low.
  • For the above pad configuration we cannot use the following modules
    • video


NOR Support[edit]

  • The NOR boot logic is handled in arch/arm/cpu/arm_cortexa8/ti81xx/lowlevel_init.S
  • Since ROM code does not initialize all 25 address lines required for accessing 64MBytes, u-boot should first initialize GPMC to continue with the XIP beyond 4KBytes.
  • u-boot should also configure pin muxing for the remaining 13 address lines (gpmc_a12 - gpmc_a24) based on board schematics
  • In case of NOR boot and XIP, we cannot initialize GPMC while running from NOR, hence we have to relocate the tiny GPMC init code to SRAM and then transfer control to SRAM and then come back to NOR XIP.
  • Also, the relocatable GPMC init code should be placed in the first 4KBytes of the u-boot. This is achieved by adding lowlevel_init.o just below start.o in the u-boot linker script board/ti811x_evm/u-boot.lds as shown below.
SECTIONS
{
    . = 0x00000000;
    . = ALIGN(4);
    .text   :
    {
      arch/arm/cpu/arm_cortexa8/start.o  (.text)
      arch/arm/cpu/arm_cortexa8/ti81xx/lowlevel_init.o   (.text)
      *(.text)
    }
...
...
...
  • Before relocating any code to SRAM we have to first enable the SRAM.
  • All the above steps have to be done only if we are not already running from SRAM (or DDR)
  • The diagram below explains the above discussed steps

U-boot nor-boot gpmc-init.jpg

Config Macros[edit]
    #define CONFIG_SYS_FLASH_CFI
    #define CONFIG_MTD_DEVICE
    #define CONFIG_FLASH_CFI_DRIVER
    #define CONFIG_FLASH_CFI_MTD
    #define CONFIG_SYS_MAX_FLASH_SECT   512
    #define CONFIG_SYS_MAX_FLASH_BANKS  1
    #define CONFIG_ENV_IS_IN_FLASH      1
    #define CONFIG_SYS_FLASH_BASE       (0x08000000)
    #define CONFIG_SYS_MONITOR_BASE     CONFIG_SYS_FLASH_BASE
    #define NOR_SECT_SIZE               (128 * 1024)
    #define CONFIG_SYS_ENV_SECT_SIZE    (NOR_SECT_SIZE)
    #define CONFIG_ENV_OFFSET           (2 * NOR_SECT_SIZE)
    #define CONFIG_ENV_ADDR             (CONFIG_ENV_OFFSET)
  • These macros assume spansion flash being used in the EVM. For any other flash part, the sector size macro (NOR_SECT_SIZE) has to be modified.


Spansion NOR parts are supported on TI811x platforms.

Note

  • The following sub-sections illustrate the usage of NOR specific commands on TI811XEVM.
  • If U-Boot is built with NOR support and if NOR is disabled in the EVM (or NAND is enabled) and if you try loading U-Boot through CCS then U-Boot will crash. Refer to EVM Switch Settings section for more info on enabling/disabling different boot devices.

NOR Layout[edit]

The NOR part on the EVM has been configured in the following manner. Please note the addresses mentioned here carefully as they are used in the subsequent NOR related commands.

----------------+----> 0x08000000 (u-boot Start) Flash Start
|		|
|		|
|		|
|		|----> 0x0803FFFF (u-boot End) 
|		|----> 0x08040000 (ENV Start)
|		|
|		|
|		|----> 0x0805FFFF (ENV End)  
|		|----> 0x08060000 (Linux Start)
|		|
|		|
|		|
|		|
|		|----> 0x0845FFFF (Linux End) 
|		|----> 0x08460000 (FS Start)
|		|
|		|
|		|
|		|
|		|
|		|
|		|
|		|----> 0x0B65FFFF (FS End) 
|		|----> 0x0B660000 (Reserved Start)
|		|
|		|
----------------+----> 0x0C000000 (Reserved End) Flash End

Writing to NOR[edit]

To write len bytes of data from a memory buffer located at addr to the NOR block offset (here <len> is always in 16-bit word count and not bytes):

TI811X_EVM# cp.w <src> <dest> <len>

For example, to write 0x40000 bytes (i.e. 0x20000 16-bit words) from memory buffer at address 0x81000000 to NOR - starting at offset 0x0B660000:

TI811X_EVM# cp.w 0x81000000 0x0B660000 0x20000

Reading from NOR[edit]

To read len bytes of data from NOR block at offset to memory buffer located at addr (here <len> is always in 16-bit word count and not bytes):

TI811X_EVM# cp.w <src> <dest> <len>

For example, to read 0x40000 bytes (i.e. 0x20000 16-bit words) from NOR - starting at offset 0x0B660000 to memory buffer at address 0x81000000:

TI811X_EVM# cp.w 0x0B660000 0x81000000 0x20000

Erasing NOR[edit]

To erase NOR in the address range (start and end should align to block size):

TI811X_EVM# erase <start> <end>


For example, to erase from 0x0B660000 to 0x0BFFFFFF:

TI811X_EVM# erase 0x0B660000 0x0BFFFFFF

Transferring images to NOR via U-Boot[edit]

Ethernet will not work with NOR boot due to the same GPMC line are shared for both NOR and Ethernet. Transfer the u-boot and Kernel images over UART. Use Kermit protocol transfer the files over the UART.

Flashing U-Boot from U-Boot[edit]

To flash u-boot image (u-boot.bin) to the NOR execute the commands listed below:

TI811X_EVM# mw.b 0x81000000 0xFF 0x100000
TI811X_EVM# loadb 0x81000000

From TeraTerm Menu click “File -> Transfer -> Kermit -> Send”.

TI811X_EVM# protect off 0x08000000 0x0803FFFF
TI811X_EVM# erase 0x08000000 0x0803FFFF
TI811X_EVM# cp.w 0x81000000 0x08000000 <image size/2 in hex> (NOTE: <len> is size of uboot.bin / 2)

Please note that the above steps can only be used from U-Boot already running out of NOR.

The above set of commands fill in the section of memory starting from 0x81000000 with size 0x100000 with 0xFF. In TI811X EVM this memory region is a part of the DDR memory. Next we download the U-Boot image to the DDR memory. To have persistent storage we then transfer the downloaded U-Boot image to NOR with the help of the NOR commands described earlier.

Flashing Linux Kernel from U-Boot[edit]

Load the kernel uImage to DDR over UART.

TI811X_EVM# loadb 81000000 

From TeraTerm Menu click “File -> Transfer -> Kermit -> Send”. Flash the kernel image to NOR

TI811X_EVM# protect off 0x08060000  0x0845FFFF 
TI811X_EVM# erase 0x08060000  0x0845FFFF 
TI811X_EVM# cp.w 0x81000000 0x08060000 <len> (NOTE: <len> is size of kernel_image / 2)

Creating JFFS2 File-system[edit]

Refer Creating JFFS2 File-system

Flashing File-system from U-Boot[edit]

TFTP filesystem image (example - rootfs-816x.jffs2) to DDR.

TI811X_EVM# tftp 81000000 <filesystem_image>

Flash the file system image to NOR

TI811X_EVM# protect off 0x08460000  0x0B65FFFF 
TI811X_EVM# erase 0x08460000  0x0B65FFFF 
TI811X_EVM# cp.w 0x81000000 0x08460000 <len> (NOTE: <len> is size of filesystem / 2)


Please follow the steps to set the environment for Booting Linux Kernel and Filesystem

U-Boot UART support[edit]

This section describes how to use UART boot mode using TeraTerm.

Ensure that you have the latest version 4.67 of the Teraterm installed. The kermit protocol implementation in Teraterm is not reliable in older versions. The latest version of Teraterm 4.67 can be downloaded from here

Boot Over UART[edit]

Note: The release package does not contain the binary for UART boot. Please follow the steps mentioned #Building_1st_stage_u-boot for compiling u-boot.min.uart

  1. Switch ON EVM with switch settings for UART boot. When “CCCC” characters appear on TeraTerm window, from the File Menu select Transfer --> XMODEM --> Send (1K mode)
  2. Select “u-boot.min.uart” for the transfer
  3. Press "Reset button" to initiate image download
  4. After image is successfully downloaded, the ROM code will boot it.
  5. Hit enter and get to u-boot prompt “TI-MIN#”
TI_MIN#

Loading 2nd stage over UART[edit]

  • From the U-Boot-MIN prompt
TI_MIN# loadb 0x83000000
  • From TeraTerm Menu click “File -> Transfer -> Kermit -> Send”.
  • Select the 2nd stage u-boot image “u-boot.bin” built earlier and click “OPEN” button
  • Wait for download to complete
TI_MIN# go 0x83000000
  • You should get 2nd Stage u-boot prompt
TI811X_EVM#

Flashing images to NAND[edit]

Before proceeding with any of the commands given in this section please make sure that NAND is enabled on the EVM. The switch for enabling NAND is shown over here.

After the 2nd stage prompt TI811X_EVM# comes up, the images for the 1st stage and 2nd stage can be flashed to NAND for persistent storage.

Before proceeding with flashing of the images please make sure that NAND is enabled on the EVM.

Flashing 1st stage to NAND from 2nd stage[edit]

Flash U-Boot-MIN for NAND (u-boot.min.nand) to NAND by executing the following commands:

TI811X_EVM# mw.b 0x83000000 0xFF 0x20000
TI811X_EVM# loadb 0x83000000
  • From TeraTerm Menu click “File -> Transfer -> Kermit -> Send”.
  • Select the 1st stage u-boot image “u-boot.min.nand” and click “OPEN” button
  • Wait for download to complete and then run following commands in u-boot prompt
TI811X_EVM# nand erase 0x0 0x20000
TI811X_EVM# nand write.i 0x83000000 0x0 0x20000

If no error messages are displayed the 1st stage of NAND boot has been successfully transferred to NAND.

Flashing 2nd stage to NAND from 2nd stage[edit]

Flash the 2nd stage U-Boot (u-boot.bin) to NAND by executing the following commands:

TI811X_EVM# mw.b 0x83000000 0xFF 0x40000
TI811X_EVM# loadb 0x83000000
  • From TeraTerm Menu click “File -> Transfer -> Kermit -> Send”.
  • Select the 2nd stage u-boot image “u-boot.bin” and click “OPEN” button
  • Wait for download to complete and then run following commands in u-boot prompt
TI811X_EVM# nand erase 0x20000 0x40000
TI811X_EVM# nand write.i 0x83000000 0x20000 0x40000

If no error messages are displayed the 2nd stage of NAND boot has been successfully transferred to NAND.

Flashing images to SPI[edit]

Before proceeding with any of the commands given in this section please make sure that SPI is enabled on the EVM.

After the 2nd stage prompt TI811X_EVM# comes up the images for the 1st stage and 2nd stage can be flashed to SPI for persistent storage.

Flashing 1st stage to SPI from 2nd stage[edit]

Flash U-Boot-MIN for SPI (u-boot.min.spi) to SPI flash by executing the following commands:

TI811X_EVM# mw.b 0x83000000 0xFF 0x20000
TI811X_EVM# loadb 0x83000000
  • From TeraTerm Menu click “File -> Transfer -> Kermit -> Send”.
  • Select the 1st stage u-boot image “u-boot.min.spi” and click “OPEN” button
  • Wait for download to complete and then run following commands in u-boot prompt
TI811X_EVM# sf probe 0:0 
TI811X_EVM# sf erase 0x0 0x20000
TI811X_EVM# sf write 0x83000000 0x0 0x20000

If no error messages are displayed then the 1st stage for SPI boot is successfully flashed to SPI.

Flashing 2nd stage to SPI from 2nd stage[edit]

Flash 2nd stage u-boot image (u-boot.bin) to SPI flash by executing the following commands:

TI811X_EVM# mw.b 0x83000000 0xFF 0x40000
TI811X_EVM# loadb 0x83000000
  • From TeraTerm Menu click “File -> Transfer -> Kermit -> Send”.
  • Select the 1st stage u-boot image “u-boot.bin” and click “OPEN” button
  • Wait for download to complete and then run following commands in u-boot prompt
TI811X_EVM# sf probe 0:0 
TI811X_EVM# sf erase 0x20000 0x40000
TI811X_EVM# sf write 0x83000000 0x20000 0x40000

If no error messages are displayed then the 2nd stage for SPI boot is successfully flashed to SPI.

U-Boot SD (Secured Digital card) Support[edit]

This section gives an overview of the SD (Secured Digital Card) support in U-Boot

Overview[edit]

SD (Secured Digital Card) support is available through HSMMC controller.

SD support is available by default in all U-Boot configs.  SD card can also be accessed in other boot modes e.g. NAND, SPI and UART.

Read and execute application from SD card

List files on a FAT32 formated SD card

TI811X_EVM# mmc rescan 0
TI811X_EVM# fatls mmc 0

Booting kernel image from the SD card

TI811X_EVM# mmc rescan 0
TI811X_EVM# fatload mmc 0 0x82000000 uImage
TI811X_EVM# bootm 0x82000000

Booting application (ex. u-boot.bin)image from the SD card

TI811X_EVM# mmc rescan 0
TI811X_EVM# fatload mmc 0 0x83000000 u-boot.bin
TI811X_EVM# go 0x83000000

Setting Up Boot Environment on SD Card[edit]

This section describes steps to be followed to create a standalone power-on bootable system on SD card.

Prerequisites Ensure that following is available:

  • A Linux host with fdisk, sfdisk, mkfs.ext3 and mkfs.vfat utilities is available
  • Copy images MLO, u-boot.bin and uImage, nfs.tar.gz and mksd-ti811x.sh to a directory on this Linux machine. For subsequent description, we will assume these files are copied to /home/ti811x. Please refer Package Contents section in TI81XX User Guide for location of these files.
  • Empty SD card (at least 256MB, preferably 4 GiB SDHC)
  • A SD memory card reader/programmer to copy files from Linux Host
  Note: The SD Boot has some specific restriction about the format of the 1st partition and copying the MLO image.
    So it is recommended that the supplied script mksd-ti811x.sh is used for creating partitions and copying files. 

Steps

  • Connect the SD memory card using Memory Card reader to the Linux Host
  • Note the name allotted for this device. We assume the device is named as "/dev/sdd"
  • Navigate to the /home/ti81xx directory where all the mentioned files are copied
  • Ensure that the script mksd-ti811x.sh has executable permissions
  • This scripts expects arguments in the following format
./mksd-ti811x.sh <sd-device-name> <sd-1st-stage-bootloader> <kernel-uImage> <tar-gzipped-filesystem-directory>
  • Note that the user will require root/sudo permissions
  • In our example, we run the following command
sudo ./mksd-ti811x.sh /dev/sdd MLO u-boot.bin uImage nfs.tar.gz
  • You will be asked about data getting overwritten, confirm it and the files along with filesystem will be copied to SD card
  • Note that this script will create two primary partitions:
    • 1st partition is formatted as FAT32 containing MLO, u-boot.bin, uImage files
    • 2nd partition is formatted as ext3 where the filesystem is extracted in root

Boot using SD card[edit]

Once the SD card has been setup as described in the previous section make sure the switch setting are set for SD boot mode and then plug in the SD card in the MMC/SD card slot on the EVM.

When the EVM is powered on the 1st stage will autoload the 2nd stage from SD. Interrupt the countdown in the 2nd stage if kernel boot is not required. You should see the TI811X_EVM# prompt on the console.

Flashing images to NAND in SD boot[edit]

Before proceeding with any of the commands given in this section please make sure that NAND is enabled on the EVM. The switch for enabling NAND is shown over here.

Copy the U-Boot image u-boot.min.nand built for 1st stage NAND and u-boot.bin built for NAND in the FAT partition on the SD card.

After the 2nd stage prompt TI811X_EVM# comes up, the images for the 1st stage and 2nd stage can be flashed to NAND for persistent storage.

Flashing 1st stage to NAND from 2nd stage in SD boot[edit]

Flash U-Boot-MIN for NAND (u-boot.min.nand) to NAND by executing the following commands:

TI811X_EVM# mmc rescan 0
TI811X_EVM# mw.b 0x83000000 0xFF 0x20000
TI811X_EVM# nandecc hw 2 <=== required only when Uboot uses 1-bit HW ECC
TI811X_EVM$ fatload mmc 0 0x83000000 u-boot.min.nand
TI811X_EVM# nand erase 0x0 0x20000
TI811X_EVM# nand write.i 0x83000000 0x0 0x20000
TI811X_EVM# nandecc hw 0 <=== required only when Uboot uses 1-bit HW ECC

If no error messages are displayed the 1st stage of NAND boot has been successfully transferred to NAND.

Flashing 2nd stage to NAND from 2nd stage in SD boot[edit]

Flash the 2nd stage U-Boot (u-boot.bin) to NAND by executing the following commands:

TI811X_EVM# mmc rescan 0
TI811X_EVM# mw.b 0x83000000 0xFF 0x20000
TI811X_EVM$ fatload mmc 0 0x83000000 u-boot.bin
TI811X_EVM# nand erase 0x20000 0x60000
TI811X_EVM# nand write.i 0x83000000 0x20000 0x60000

If no error messages are displayed the 2nd stage of NAND boot has been successfully transferred to NAND.

Flashing images to SPI in SD boot[edit]

Before proceeding with any of the commands given in this section please make sure that SPI is enabled on the EVM.

Copy the U-Boot image u-boot.min.spi built for 1st stage SPI as described here and u-boot.bin built for SPI as described here in the FAT partition on the SD card.

After the 2nd stage prompt TI811X_EVM# comes up the images for the 1st stage and 2nd stage can be flashed to SPI for persistent storage.

Flashing 1st stage to SPI from 2nd stage in SD boot[edit]

Flash U-Boot-MIN for SPI (u-boot.min.spi) to SPI flash by executing the following commands:

TI811X_EVM# mmc rescan 0
TI811X_EVM# mw.b 0x83000000 0xFF 0x20000
TI811X_EVM# fatload mmc 0 0x83000000 u-boot.min.spi
TI811X_EVM# sf probe 0:0 
TI811X_EVM# sf erase 0x0 0x20000
TI811X_EVM# sf write 0x83000000 0x0 0x20000

If no error messages are displayed then the 1st stage for SPI boot is successfully flashed to SPI.

Flashing 2nd stage to SPI from 2nd stage in SD boot[edit]

Flash 2nd stage u-boot image (u-boot.bin) to SPI flash by executing the following commands:

TI811X_EVM# mmc rescan 0
TI811X_EVM# mw.b 0x83000000 0xFF 0x40000
TI811X_EVM# fatload mmc 0 0x83000000 u-boot.bin
TI811X_EVM# sf probe 0:0 
TI811X_EVM# sf erase 0x20000 0x40000
TI811X_EVM# sf write 0x83000000 0x20000 0x40000

If no error messages are displayed then the 2nd stage for SPI boot is successfully flashed to SPI.

Boot using ramdisk when the ramdsik.gz is stored in SD-card[edit]

This section describes how a ramdisk can be created from an existing known-to-work filesystem and how the ramdisk can be mounted successfully. It assumes that all the necessary bin files (MLO, u-boot.bin and uImage) are already stored in the BOOT partition of the SD-card. And they have been already verified to work.

Considering that we already have a working filesystem (size <= 32MB), we can follow the steps in Creating a RAMDISK to a create a ramdisk.
In case, the size (after expansion) of the filesystem is greater than 32MB (e.g. 38MB), the steps given below, can be followed.

  • Creating a file of zeros
 dd if=/dev/zero of=ramdisk bs=1M count=40
  • Changes in .config file of the kernel build
 CONFIG_BLK_DEV_RAM_SIZE=65536 <= 32768 (default)
and/or
CONFIG_BLK_DEV_RAM_COUNT=1 <= 16 (default)

Now build the uImage using the above config.


Once the uImage and ramdisk.gz are ready, place them in BOOT partition of the SD-card. And set the environment as below.

TI811X_EVM# setenv bootargs 'console=ttyO0,115200n8 mem=256M earlyprintk root=/dev/ram rw initrd=0x83000000,NNMB'
TI811X_EVM# setenv bootcmd 'mmc rescan 0; fatload mmc 0 0x82000000 uImage; fatload mmc 0 0x83000000 ramdisk.gz; bootm 0x82000000'

where the NN = the size of file with zeros as created in the above step.

Example
TI811X_EVM# set bootargs 'console=ttyO0,115200n8 root=/dev/ram0 initrd=0x82000000,40M ramdisk_size=45000 mem=200M earlyprintk'
TI811X_EVM# set bootcmd 'mmc rescan 0; fatload mmc 0 0x82000000 ramdisk.ext2.gz; tftp 0x81000000 uImage; bootm'

If everything goes fine, the above should boot and mount the ramdsik.

Note:

  • The ramdisk.gz as created above, can also be flashed on NAND, SPI depending upon the available size and can be mounted using the environment settings as given in #Environment_Settings_for_Ramdisk.
  • The MLO, u-boot.bin, uImage and ramdisk.gz needs to be copied into the empty SD card, if there is any issue in ramdisk mount.

</div>

ENV on SD card using a script[edit]

U-Boot environment variables can be modified using U-Boot scripts. The scripts can be used to modify and even over-ride the various parameters like bootargs, TFTP serverip etc.

Generation of the scripts is done with the help of the mkimage tool which can be found under the tools directory of the U-Boot source. The mkimage binary gets generated whenever any U-Boot image is built.

Once the mkimage binary generated, create a text file named boot.txt with the U-Boot commands that would normally be executed manually at the U-Boot prompt.

Example text file named boot.txt

setenv bootargs 'console=ttyO0,115200n8 root=/dev/mmcblk0p2 mem=128M rootwait'
setenv bootcmd 'mmc rescan 0; fatload mmc 0 0x81000000 uImage; bootm 0x81000000'
boot


Now use the following command to generate the script named boot.scr

$ mkimage -A arm -O linux -T script -C none -n TI_script -d boot.txt boot.scr

The file boot.scr can now be executed from U-Boot using the source command to execute all the commands present in it. Eg: TFTP the file to some location in DDR and then use source command in the following manner (assumption: network setting has already been done using the steps mentioned in this User Guide)

TI811X_EVM# tftp 0x81000000 boot.scr 
TI811X_EVM# source 0x81000000

The script can even be placed in the SD card and then bootcmd set to autorun this script if present.


Please follow the steps to set the environment for Booting Linux Kernel and Filesystem

U-Boot Network configuration[edit]

In order to download the Linux kernel image from the TFTP server and for mounting NFS the network settings in U-Boot need to be configured.

NoteNote: Uboot supports only Ethernet on Port 0. The Port 1 is not supported in current release.

Please note that the following commands are being run from the 2nd stage U-Boot prompt on the serial console.

TI811X_EVM# setenv autoload no
TI811X_EVM# setenv bootfile uImage

The above two commands configure U-Boot not to autoboot the kernel and then set the name of the kernel image to be downloaded over the network.

When booting for the first time, U-Boot tries to fetch the MAC address from the env space. If it returns empty, it will look for MAC address from the eFuse registers in the Control module space and set the "ethaddr" variable in the env appropriately.

The ethaddr can also be set using the setenv/saveenv commands. In such cases the user-set MAC address will take effect on subsequent reboot only.

To set a different MAC address use the following command

TI811X_EVM# set ethaddr <random MAC address eg- 08:11:23:32:12:77>

Note
When setting a MAC address please ensure that the LSB of the 1st byte if not 1 i.e. when setting the MAC address: y in xy:ab:cd:ef:gh:jk has to be an even number. For more info this refer to the wiki page http://en.wikipedia.org/wiki/MAC_address


In case a static ip is not available run the dhcp command to obtain the ip address from the DHCP server on the network to which the EVM is connected.

TI811X_EVM# setenv serverip <tftp server in your network>
TI811X_EVM# dhcp
TI811X_EVM# saveenv

In case a static ip is available run the following commands

TI811X_EVM# setenv ipaddr <your static ip>
TI811X_EVM# saveenv

This completes the network configuration in U-Boot.

U-Boot Environment Variables[edit]

After completing the network configuration and flashing the kernel image and filesystems to flash you need to set some other parameters which are essential for booting the kernel.

Environment Settings for Ramdisk[edit]

In case you are using a RAMDISK as the Linux filesystem

TI811X_EVM# setenv bootargs 'console=ttyO0,115200n8 mem=256M earlyprintk root=/dev/ram rw initrd=0x83000000,32MB'

In case of NAND boot (0x170000 => size of Linux kernel uImage, 0x00320000 => size of Filesystem)

TI811X_EVM# setenv bootcmd 'nand read 0x82000000 0x280000 0x170000;nand read 0x83000000 0x6C0000 0x320000;bootm 0x82000000'

In case of SPI boot (0x280000 => size of Linux kernel uImage, 0x13E000 => size of Filesystem)

TI811X_EVM# setenv bootcmd 'sf probe 0; sf read 0x82000000 0x42000 0x280000; sf read 0x83000000 0x2C2000 0x13E000;bootm 0x82000000'

In case of SD boot

TI811X_EVM# setenv bootcmd 'mmc init; fatload mmc 0 0x82000000 uImage; fatload mmc 0 0x83000000 ramdisk.gz; bootm 0x82000000' 

If auto boot is required then prefix 'dhcp' and 'run addip' to the above 'bootcmd'

TI811X_EVM# setenv bootcmd 'dhcp;run addip;${bootcmd}'

NOTE: The sizes of images mentioned in the above commands have to be modified based on the actual image size. Also, it should be aligned to sector size of the flash device used.

Finally

TI811X_EVM# saveenv

Environment Settings for JFFS2 Filesystem[edit]

  • U-Boot environment variable bootargs has information on arguments to be passed to Linux kernel. The bootargs format for JFFS2 root filesystem is,
  console=ttyO0,115200n8 root=/dev/mtdblock<partion_id> [ro|rw] rootfstype=jffs2 mem=100M earlyprintk

The value of <partition_id> depends on memory device which holds the rootfs. The below list gives values for different scenarios and it also assumes that only that respective device is enabled on the board,

rootfs on NAND ==> partion_id should be 4
rootfs on NOR  ==> partion_id should be 3
rootfs on SPI  ==> partion_id should be 4

NOTE:

   By default the kernel is compiled with both SPI and NAND support
   If SW6.1 is ON /dev/mtdblock4 should be used for NAND.
   If SW6.3 is ON /dev/mtdblock4 should be used for SPI.
   If both SW6.1 and SW6.3 are ON then /dev/mtdblock9 should be used for NAND or SPI.


  • Below examples set bootargs variable from u-boot prompt for different memory devices (in case of SPI, mtdblock4 should be used).

In case if you want readonly filesystem,

TI811X_EVM# setenv bootargs 'console=ttyO0,115200n8 root=/dev/mtdblock4 ro rootfstype=jffs2 mem=100M earlyprintk' 

In case if you want read/write filesystem,

TI811X_EVM# setenv bootargs 'console=ttyO0,115200n8 root=/dev/mtdblock4 rw rootfstype=jffs2 mem=100M earlyprintk'

In case of NAND boot (0x170000 => size of Linux kernel uImage)

TI811X_EVM# setenv bootcmd 'nand read 0x82000000 0x00280000 0x170000;bootm 0x82000000'

In case of SPI boot (0x280000 => size of Linux kernel uImage)

TI811X_EVM# setenv bootcmd 'sf probe 0; sf read 0x82000000 0x42000 0x280000;bootm 0x82000000'

NOTE: The sizes of images mentioned in the above commands have to be modified based on the actual image size. Also, it should be aligned to sector size of the flash device used.

Environment Settings for NFS Filesystem[edit]

In case you want to have the kernel use the same ip as that assigned to U-Boot

TI811X_EVM# print ethaddr                          <-- Check if MAC address is assigned and is unique
TI811X_EVM# setenv ethaddr <unique-MAC-address>    <-- Set only if not present already, format uv:yy:zz:aa:bb:cc
TI811X_EVM# setenv bootcmd 'dhcp;run addip; tftp 82000000 uImage;bootm'
TI811X_EVM# setenv hostname <unique-hostname>
TI811X_EVM# setenv addip 'setenv bootargs ${bootargs} ip=${ipaddr}:${nfsserver}:${gatewayip}:${netmask}:${hostname}:eth0:off'
TI811X_EVM# setenv autoload no
TI811X_EVM# setenv nfsserver <NFS server-ip>         <-- Make sure the same NFS server IP is used below
TI811X_EVM# setenv bootargs 'console=ttyO2,115200n8 root=/dev/nfs nfsroot=<NFS server-ip>:<NFS share>,nolock rw mem=128M'      
TI811X_EVM# setenv serverip <tftp-server-ip>

In case you want to use dhcp for getting an IP when the kernel boots up

TI811X_EVM# print ethaddr                          <-- Check if MAC address is assigned and is unique
TI811X_EVM# setenv ethaddr <unique-MAC-address>    <-- Set only if not present already, format uv:yy:zz:aa:bb:cc
TI811X_EVM# setenv bootcmd 'dhcp;tftp 82000000 uImage;bootm'
TI811X_EVM# setenv autoload no
TI811X_EVM# setenv nfsserver <NFS server-ip>         <-- Make sure the same NFS server IP is used below
TI811X_EVM# setenv bootargs 'console=ttyO2,115200n8 root=/dev/nfs nfsroot=<NFS server-ip>:<NFS share>,nolock rw mem=128M ip=dhcp'      
TI811X_EVM# setenv serverip <tftp-server-ip>

Environment Settings for MMC/SD root Filesystem[edit]

setenv bootargs 'console=ttyO0,115200n8 root=/dev/mmcblk0p2 mem=128M rootwait'
setenv bootcmd 'mmc rescan 0; fatload mmc 0 0x81000000 uImage; bootm 0x81000000'
boot

Finally

TI811X_EVM# saveenv

Booting Linux Kernel[edit]

Kernel along with root filesystem can either be booted from on board storage device or can be fetched over the Ethernet to RAM using TFTP and booted from there. Also, the root filesystem can be formatted as JFFS2 or UBIFS, flashed and then mounted. Please refer U-Boot User Guide for details about flashing and supported storage devices.

Following sections describe various kernel boot options possible.

Note: The offsets and MTD partition numbers used in examples below may vary depending upon actual partition layout used on particular storage device. Also, selecting multiple storage device support in kernel (e.g., NAND & SPI) may change the effective partition number to be used as root partition.

Boot from NAND[edit]

Make sure the Boot Mode/Configuration Select Switch is set for the NAND boot mode as described in U-boot UserGuide section.

Power on EVM and wait for U-Boot prompt of the 2nd stage (TI811X_EVM#) to come up on the serial console.

When kernel uImage and JFFS2 or UBIFS filesystem are flashed on the NAND device:

TI811X_EVM# nand read.i 0x81000000 280000 500000

For JFFS2 file system:
TI811X_EVM# setenv bootargs 'mem=128M console=ttyO0,115200n8 root=/dev/mtdblock4 rw rootfstype=jffs2 ip=dhcp'

For UBIFS file system:
TI811X_EVM# setenv bootargs 'console=ttyO0,115200n8 mem=256M rw ubi.mtd=4,2048 rootfstype=ubifs root=ubi0:rootfs init=/init'


TI811X_EVM# bootm 0x81000000

When kernel image is flashed on the NAND device, and NFS mounted filesystem is being used:

TI811X_EVM# nand read.i 0x81000000 280000 500000
TI811X_EVM# setenv bootargs 'console=ttyO0,115200n8 root=/dev/nfs nfsroot=<NFS Server IP:Path>,nolock rw mem=128M'
TI811X_EVM# bootm 0x81000000

Boot from SPI[edit]

Make sure the Boot Mode/Configuration Select Switch is set for the SPI boot mode as described in U-boot UserGuide section.

Power on EVM and wait for U-Boot prompt of the 2nd stage (TI811X_EVM#) to come up on the serial console.

Assuming kernel image is flashed on the SPI flash @0x42000 and NFS based root filesystem is used:

TI811X_EVM# sf read 0x81000000 0x42000 0x200000
TI811X_EVM# setenv bootargs 'console=ttyO0,115200n8 root=/dev/nfs nfsroot=172.24.179.98:/nfs_root,nolock rw mem=128M'
TI811X_EVM# bootm 0x81000000

Boot from NOR[edit]

Make sure the Boot Mode/Configuration Select Switch is set for the NOR boot mode as described in U-boot UserGuide .

Power on EVM and wait for U-Boot to come up on the serial console.

Assuming kernel uImage and JFFS2 filesystem are flashed on the NOR device @0x08060000 (Partition 2) and @0x08460000 (Partition 3) respectively:

TI811X_EVM# cp.w 0x08060000 0x81000000 0x200000
TI811X_EVM# setenv bootargs 'mem=128M console=ttyO0,115200n8 noinitrd root=/dev/mtdblock3 rw rootfstype=jffs2 ip=dhcp'
TI811X_EVM# bootm 0x81000000

Boot from SD Card[edit]

Make sure the Boot Mode/Configuration Select Switch is set for the SD boot mode as described in U-Boot User Guide.

Power on EVM and wait for U-Boot to come up on the serial console.

The example below assumes kernel uImage is available in first partition of the SD card and second partition contains ext3 formatted filesystem.

TI811X_EVM# mmc rescan 0
TI811X_EVM# fatload mmc 0 0x81000000 uImage
TI811X_EVM# setenv bootargs 'console=ttyO0,115200n8 root=/dev/mmcblk0p2 mem=128M rootwait'
TI811X_EVM# bootm 0x81000000

Boot over Network (Ethernet)[edit]

Note
When setting a MAC address please ensure that the LS-bit of the 1st byte is not 1 i.e. when setting the MAC address: y in xy:ab:cd:ef:gh:jk has to be an even number. For more info this refer to the wiki page http://en.wikipedia.org/wiki/MAC_address

When kernel image and ramdisk image are fetched from a TFTP server:

  • Ensure that the EVM is connected to network with DHCP and TFTP server set up
  • Set 'ethaddr' U-Boot environment variable with proper ethernet address in format 'xx:xx:xx:xx:xx:xx' (replace 'xx' with proper hexadecimal values)
  • Copy kernel image and ramdisk to TFTP server's root directory.
  • Ensure that the "Options Negotiation" box in the tftp server settings is not checked.
  • Execute following commands at U-Boot prompt. We assume kernel image name as 'uImage' and ramdisk file name as 'ramdisk.gz'
TI811X_EVM# setenv autoload no
TI811X_EVM# dhcp
TI811X_EVM# setenv serverip <Server IP Address>
TI811X_EVM# tftp 0x81000000 uImage
TI811X_EVM# tftp 0x82000000 ramdisk.gz
TI811X_EVM# setenv bootargs 'mem=200M console=ttyO0,115200n8 root=/dev/ram0 initrd=0x82000000,40M ramdisk_size=32768 ip=dhcp'
TI811X_EVM# bootm 0x81000000
  • Alternatively, kernel can be made to use the same IP address as assigned to U-Boot instead of doing DHCP request again by setting U-Boot parameters as follows:
TI811X_EVM# print ethaddr                          <-- Check if MAC address is assigned and is unique
TI811X_EVM# setenv ethaddr <unique-MAC-address>    <-- Set only if not present already, format xn:yy:zz:aa:bb:cc
TI811X_EVM# setenv bootcmd 'dhcp;run addip; tftp 81000000 uImage;bootm'
TI811X_EVM# setenv hostname <unique-hostname>
TI811X_EVM# setenv addip 'setenv bootargs ${bootargs} ip=${ipaddr}:${nfsserver}:${gatewayip}:${netmask}:${hostname}:eth0:off'
TI811X_EVM# setenv autoload no
TI811X_EVM# setenv nfsserver <nfs-server-ip>         <-- Make sure the same NFS server IP is used below
TI811X_EVM# setenv bootargs 'console=ttyO0,115200n8 root=/dev/nfs nfsroot=<nfs-server-ip>:<path-to-nfs-share>,nolock rw mem=128M'
TI811X_EVM# setenv serverip <tftp-server-ip>
TI811X_EVM# saveenv
TI811X_EVM# boot
  • After saving the environment variables, you need not set them again on reboot unless a change is required.
  • Note that the above example uses NFS mounted root file system accessed over 'eth0' interface (as available on the base EVM)

Note: You need not set 'ethaddr' for devices having valid MAC IDs set. In such cases, U-Boot will automatically detect and set the ethernt address (should show message like "Detected MACID:...").

E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article TI811X PSP UBOOT User Guide here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article TI811X PSP UBOOT User Guide here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article TI811X PSP UBOOT User Guide here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article TI811X PSP UBOOT User Guide here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article TI811X PSP UBOOT User Guide here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article TI811X PSP UBOOT User Guide here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article TI811X PSP UBOOT User Guide here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article TI811X PSP UBOOT User Guide here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article TI811X PSP UBOOT User Guide here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity