Tux
Communication
Mailing lists
Documentation
User Manual
Target board info.
Target chip info.
Support
Linux support
Bugzilla
Downloads
STLinux
Updates
Search
Google


The web
stlinux.com
U-Boot boot loader
ST Logo

Introduction

The "u-boot"  is a multi-platform open source bootloader with comprehensive support for loading and managing boot images:

  • Serial download: s-record, binary (via kermit)
  • Network download: tftp, bootp, dhcp, nfs
  • Flash management: copy, erase, protect
  • Memory utilities: copy, dump. crc, check
  • Interactive shell: choice of simple or "busybox" shell with many scripting features.  

This is the 1st release of u-boot support for ST40/SH4 & ST200 processors.  This file is a quick guide to getting started. For full details of u-boot features please refer to the README file and visit the website:

        http://u-boot.sourceforge.net/

This release supports the following platforms:

Main CPU CORE
Device
Board name
SH4 (ST40)



STi5528
espresso
ST40-RA166
st40rastarter*
STm8000
st220eval
STb7100
stb7100mboard
SH4-202 eval microdev
ST231

STi5301

sti5301mb390*
sti5301mb424*

*Ethernet not supported in this release

Compiling u-boot

To configure and build  u-boot for a board type:

make distclean
make <board>_config
make

Where <board> is one of the board names given above. This will create

u-boot         - elf file
u-boot.bin     - binary file
u-boot.map     - map file
u-boot.srec    - srec

Putting u-boot on your board

You need to have access to the serial port of the board you are using and connect to it with the following parameters:

    baud=38400, data=8, parity=n, Flow Control=none

kermit  is recommended for supporting binary serial downloads (see README).

Use sh4gdb or st200gdb to load and run u-boot. e.g. for loading an 7100mboard:  (all the commands you need to type are in bold)

>sh4gdb         
GNU gdb 5.3
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=sh-superh-elf".
(gdb) mb411bypass TARGET
The target is assumed to be little endian
The target architecture is assumed to be sh4
0xa0000000 in ?? ()
(gdb) load u-boot
Loading section .text, size 0x12b44 lma 0x85f00000
Loading section .rodata, size 0x444 lma 0x85f12b44
Loading section .rodata.str1.4, size 0x3a0c lma 0x85f12f88
Loading section .data, size 0xa10 lma 0x85f16994
Loading section .u_boot_cmd, size 0x420 lma 0x85f173a4
Start address 0x85f00000, load size 96196
Transfer rate: 769568 bits/sec, 19239 bytes/write.
(gdb) c
Continuing.

You should see this output on the serial port:

Board: STb7100-mboard
PLL0      = 531 MHz
PLL1      = 266 MHz
ST40  CPU = 265 MHz
ST40  BUS = 132 MHz
ST40  PER = 66 MHz
ST231 CPU = 266 MHz
ST BUS    = 133 MHz
EMI       = 66 MHz
LMI       = 133 MHz


U-Boot 1.1.2 (May 17 2005 - 13:37:15)

DRAM:  64 MB
Flash:  8 MB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   Using MAC Address 00:80:E1:12:06:3E
STB7100-MBOARD>

There are now a number of options for downloading u-boot  image into flash:

Download using serial port

Assuming you used kermit to connect to the serial port  and type:
STB7100-MBOARD> loadb a4000000
## Ready for binary (kermit) download to 0xA4000000 at 115200 bps...

Return back to kermit  (using Ctrl-\c) and send u-boot::

(u-boot/)C-Kermit>robust
(u-boot/) C-Kermit>send u-boot.bin
(u-boot/) C-Kermit>c
Connecting to /dev/ttyS1, speed 115200
 Escape character: Ctrl-\ (ASCII 28, FS): enabled
Type the escape character followed by C to get back,
or followed by ? to see other options.
----------------------------------------------------
## Total Size      = 0x000177c4 = Bytes
## Start Addr      = 0xA4000000
STB7100-MBOARD>

Downloading using nfs over the network

To use the network functions you need to set up your boards IP address etc. This is done by setting the following environment variables:

STB7100-MBOARD> set ipaddr <board-ip-addr>
STB7100-MBOARD> set netmask <your-netmask> STB7100-MBOARD> set serverip <your-server-ip>

Where "your-server-ip" is the address of you nfs/tftp server machine. To save changes to the environment into flash type "save".  

Note: The " u-boot.bin" file needs to be placed in a directory exported by the nfs server accessible to the target board.  

You can now use the nfs command to copy the u-boot binary into memory:

STB7100-MBOARD> nfs a4000000 $serverip:/export/u-boot/stb7100/u-boot.bin
Using MAC Address 00:80:E1:12:06:3E
File transfer via NFS from server 164.129.14.91; our IP address is 164.129.15.90
Filename '/export/u-boot/stb7100/u-boot.bin'.
Load address: 0xa4000000
Loading: ##########################
done
Bytes transferred = 96196(177c4 hex)

Copying image to flash

To copy u-boot into flash type:

ESPRESSO> run update
Un-Protect Flash Sectors 0-0 in Bank # 1
. done
Erase Flash Sectors 0-0 in Bank # 1
. done
Copy to Flash... .done
Protect Flash Sectors 0-0 in Bank # 1
. done
STB7100-MBOARD>

 This executes this script held in the environment variable update:

update=protect off 1:0;erase 1:0;cp.b 0xa4000000 0xa0000000 20000;protect on 1:0

Downloading and booting a Linux kernel

u-boot supports a number of different image formats that can be downloaded saved to flash and executed.  The types of images include Linux kernels, script files,  standalone binaries and ramdisk images.  This section shows you how to create, download and boot a Linux kernel image.

Creating the kernel image

First you need to make a u-boot image file containing the binary vmlinux kernel using "objcopy"  followed by  the "mkimage" tool.  In this example we also compress the kernel as well:

>sh4linux-objcopy -O binary vmlinux vmlinux.bin
>gzip vmlinux.bin
>./tools/mkimage -A sh4 -O linux -T kernel -C gzip -a 0x84001000  -e 0x84002000 -n "Linux 2.6" -d vmlinux.gz vmlinux.ub

Image Name:   Linux 2.6
Created:      Fri May 20 10:29:23 2005
Image Type:   SuperH SH4 Linux Kernel Image (gzip compressed)
Data Size:    850719 Bytes = 830.78 kB = 0.81 MB
Load Address: 0x84001000
Entry Point:  0x84002000

Dowloading the kernel image file

This image file can then be downloaded into memory using either serial or ethernet.  In this example we use the nfs command to download the image as this is very fast:

STB7100-MBOARD> nfs a4000000 $serverip:/export/u-boot/stb7100/vmlinux.ub Using MAC Address 00:80:E1:12:06:3E
File transfer via NFS from server 164.129.14.91; our IP address is 164.129.15.90
Filename '/export/u-boot/stb7100/vmlinux.ub'.
Load address: 0xa4000000
Loading: #################################################################
         #################################################################
         #####################################
done
Bytes transferred = 850783 (cfb5f hex)
STB7100-MBOARD>

Copying the kernel image to flash

Next we can copy the Linux image to flash and check it is valid.  In this example we are copying the linux image into flash sectors 2-9 as the first two sectors are used by u-boot - the first contains the u-boot image and the second the u-boot environment.

STB7100-MBOARD> era 1:2-9
Erase Flash Sectors 2-9 in Bank # 1
........ done
STB7100-MBOARD> cp.b a4000000 a0040000 $filesize
Copy to Flash... done
STB7100-MBOARD> iminfo a0040000

## Checking Image at a0040000 ...
   Image Name:   Linux 2.6
   Image Type:   SH-4 Linux Kernel Image (gzip compressed)
   Data Size:    850719 Bytes = 830.8 kB
   Load Address: 84001000
   Entry Point:  84002000
   Verifying Checksum ... OK
STB7100-MBOARD>  

Booting the kernel image

Finally we can set up the bootargs and boot the image from flash.  In this example we just set up the console terminal and memory size so prove the kernel boots from flash:

STB7100-MBOARD> set bootargs console=ttyAS0,115200 mem=64M
STB7100-MBOARD> bootm a0040000
## Booting image at a0040000 ...
   Image Name:   Linux 2.6
   Image Type:   SH-4 Linux Kernel Image (gzip compressed)
   Data Size:    850719 Bytes = 830.8 kB
   Load Address: 84001000
   Entry Point:  84002000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK

Starting kernel console=ttyAS0,115200 mem=64M - 0x00000000 - 0 ...

Linux version 2.6.10-rc1-sim  (gcc version 3.4.3) #6 Thu May 19 15:48:09 BST 2005
STMicroelectronics STb7100 Validation board initialisation
DeviceID 0
EPLD v1r3, PCB ver B
POD EPLD version: 1, DevID: MB411(5) Rev.A
Built 1 zonelists
Kernel command line: console=ttyAS0,115200 mem=64M
....

For details of how set  put ramdisk images into flash and set up autoboot options please read the u-boot documentation.

Note: the ST200 targets do not support the passing of command line arguments to the kernel in this release.

Configuring u-boot

This section gives a quick overview  of the structure of the u-boot code.

Configuration files

The important configuration info is defined in:

include/configs/<target-board-config>.h

For example expresso board  default configuration file is:

include/configs/espresso.h

This defines such things as the memory layout, default baudrate, what u-boot features will be included in the build etc. Please refer to the README file for a description of the options defined in the configuration file.

Code organisation

The target specific code in held in the following directories:

./include/configs/<board-config>.h  -- board config header file
./board/<board>                     -- board files
./cpu/<cpu>                         -- cpu files
./cpu/<cpu>/<soc>                   -- soc files
./lib_<arch>                        -- arch support files
./include/asm-<arch>                -- arch headers
e.g for the espresso board:

./include/configs/espresso.h      -- board config header file
./board/espresso/                 -- board files
config.mk         -- defines base address for u-boot in mem
espresso.c        -- board specific initialisation
Makefile
sconsole.c        -- used if no physical serial port
sconsole.h
u-boot.lds        -- linker script
init-espresso.S   -- memory/soc configuration table
./cpu/sh4_1xx                     -- cpu files
config.mk         -- cpu make flags
cpu.c             -- cpu functions
interrupts.c      -- interupt routines (not needed for sh4)
Makefile
start.S           -- main cpu entry point
init-st40common.S -- common configuration code
./cpu/sh4_1xx/sti5528             -- soc files
Makefile
sti5528.c         -- soc specific functions e.g. reset

./lib_sh4                         -- arch support files
board.c           -- generic board initialisation code
cacheops.S
io.c
io_generic.c
linkage.h
memchr.S
memcpy.S
memmove.S
memset.S
sh4_linux.c       -- code for booting sh4 linux kernel
strlen.S
time.c            -- generic code for reading TMU
./include/asm-sh4                 -- arch headers

Valid HTML 4.01! Last updated: 2007/08/22 10:30:38
© Copyright STMicroelectronics Limited, 2005
Printer