12 Uboot
12 Uboot
Document Description
Keywords U-boot, lpc2294
Abstract This document is a simple user guide for how to
use u-boot on lpc2294 mcu: setup u-boot and
toolkit; make and program the image and as well as
the usage of u-boot
Revision History
Rev/Date Description Author
0.1/20050913 initial version brooks.bai
Contents
1 Introduction.......................................................................................................3
1.1 About U-boot......................................................................................................3
1.2 About Lpc2294...................................................................................................3
1.3 U-boot For Lpc2294 ...........................................................................................3
2 Setup U-boot And Toolkits ................................................................................4
2.1 Download U-boot-1.1.3......................................................................................4
2.2 Get and Install The Toolkit .................................................................................4
2.3 Unpack U-boot Package and add the Lpc2294 patch.......................................4
3 Make The Image................................................................................................6
3.1 Prepare For Making ...........................................................................................6
3.2 Make ..................................................................................................................6
4 Program The Image ..........................................................................................7
4.1 Program To The Right Address..........................................................................7
4.2 Program Using BDI 2000...................................................................................7
4.3 Program Using U-boot Itself ..............................................................................7
5 How To Use U-boot............................................................................................8
5.1 Start Up U-boot ..................................................................................................8
5.2 Initial Steps.........................................................................................................8
5.3 Set Environment Variables ..............................................................................10
5.4 Flash Operation ...............................................................................................11
5.5 Download Image..............................................................................................14
1 Introduction
Unpack the package, and then add the lpc2294 patch(be sure the patch
file is in the src directory).
Proceed as follows:
[root@localhost src]# bunzip2 < u-boot-1.1.3.tar.bz2 | tar xf –
[root@localhost src]# cd u-boot-1.1.3
[root@localhost u-boot-1.1.3]# patch –p1 < ../u-boot-lpc2294.patch
3.2 Make
This time, while resetting, BOOT1:0 selects 32-bit memory on CS0 for boot.
So program the u-boot image to the external flash with your favorite flash
writer.
Since BDI 2000 supports range of flash memories, users can program
u-boot.bin to the external flash memory starting at 0x80000000 with
BDI2000
If BOOT1:0 selects 32-bit memory on CS0 for boot. Users can program
u-boot.bin to the external memory starting at 0x80000000 with u-boot itself.
For details, see section How to use u-boot.
5 How To Use U-boot
To see a list of the available U-Boot commands, you can type help (or
simply ?). This will print a list of all commands that are available in your
current configuration.
Proceed as follows:
=> help
? - alias for 'help'
autoscr - run script from memory
base - print or set address offset
bdinfo - print Board Info structure
boot - boot default, i.e., run 'bootcmd'
bootd - boot default, i.e., run 'bootcmd'
bootelf - Boot from an ELF image in memory
bootm - boot application image from memory
bootp - boot image via network using BootP/TFTP protocol
bootvx - Boot vxWorks from an ELF image
cmp - memory compare
coninfo - print console devices and information
cp - memory copy
crc32 - checksum calculation
echo - echo args to console
erase - erase FLASH memory
flinfo - print FLASH memory information
go - start application at address 'addr'
help - print online help
iminfo - print header information for application image
imls - list all images found in flash
itest - return true/false on integer compare
loadb - load binary file over serial line (kermit mode)
loads - load S-Record file over serial line
loop - infinite loop on address range
md - memory display
mm - memory modify (auto-incrementing)
mtest - simple RAM test
mw - memory write (fill)
nfs - boot image via network using NFS protocol
nm - memory modify (constant address)
ping - send ICMP ECHO_REQUEST to network host
printenv- print environment variables
protect - enable or disable FLASH write protection
rarpboot- boot image via network using RARP/TFTP protocol
reset - Perform RESET of the CPU
run - run commands in an environment variable
saveenv - save environment variables to persistent storage
setenv - set environment variables
sleep - delay execution for some time
tftpboot- boot image via network using TFTP protocol
version - print monitor version
=>
With the command help <command> you can get additional information
about most commands:
printenv
- print values of all environment variables
printenv name ...
- print value of environment variable 'name'
Note these::
- For most commands, you do not need to type in the full command
name; instead it is sufficient to type a few characters. For instance,
help can be abbreviated as h.
- The behaviour of some commands depends of the configuration of
U-Boot and on the definition of some variables in your U-Boot
environment.
- All U-Boot commands expect numbers to be entered in
hexadecimal input format.
- Be careful not to use edit keys besides 'Backspace', as hidden
characters in things like environment variables can be very difficult
to find.
First you can set and save some environment variables to config u-boot.
For instance:
Here we show the commands which operate the external flash memory.
The command flinfo (short: fli) can be used to get information about the
available flash memory:
=> flinfo
803C0000 E 803E0000 E
The command erase is used to erase the contents of one or more sectors
of the flash memory
the most frequent usage of this command is to pass the start and end
addresses of the area to be erased,
for instance:
Note that:
- both the start and end addresses for this command must point
exactly at the start resp. end addresses of flash sectors. Otherwise
the command will not be executed.
Note that:
- Before writing your data to one or more sectors of the flash memory,
make sure that the very area has been erased.
The command protect is used to set certain parts of the flash memory to
read-only mode or to make them writable again. Flash memory that is
"protected" (= read-only) cannot be written (with the cp command) or
erased (with the erase command). Protected areas are marked as (RO)
(for "read-only") in the output of the flinfo command. For instance:
=> flinfo
Bank # 1: SST SST39LF/VF160 (16 Mbit, uniform sector size)
Size: 4 MB in 32 Sectors
Sector Start Addresses:
80000000 80020000 80040000 80060000 80080000 E
803C0000 E 803E0000 E
=>
Note that:
- In most cases U-Boot provides just a simple software-protection, i.
e. it prevents you from erasing or overwriting important stuff by
accident (like the U-Boot code itself or U-Boot's environment
variables), but it cannot prevent you from circumventing these
restrictions - a nasty user who is loading and running his own flash
driver code cannot and will not be stopped by this mechanism. Also,
in most cases this protection is only effective while running U-Boot
5.5 Download Image
Here we show how to download image via network using TFTP protocol
Before you type the tftp command, make sure that the tftp server has been
started and the root directory which contains the image you want to
download has been defined.
After setting up the tftp server, you are ready to download image.
First, use the ping command to check out the network:
#################################################################
#################################################################
#####################
done
Bytes transferred = 1104332 (10d9cc hex)
#################################################################
#################################################################
##################################
done
Bytes transferred = 1167360 (11d000 hex)
After downloading the image ,you can jump to kernel using go command,
or write it to the flash memory using cp command:
=> go 0x81008000
Linux version 2.6.5-ucLPC ([email protected])
…………………………………………………………………..