Hardware/ARMEBS/3/u-boot

From UIT
(Difference between revisions)
Jump to: navigation, search
(Created page with "{{private}} = u-boot = for Linux < 2.6.26 see : [wiki:u-bootBefore2.6.26 u-boot before 2.6.26] BR BR u-boot is a bootloader, we've choosen it because it supports usb a...")
 
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{private}}
+
{{public}}
 +
{{TOC right}}
 
= u-boot =
 
= u-boot =
for Linux < 2.6.26 see : [wiki:u-bootBefore2.6.26 u-boot before 2.6.26] [[BR]] [[BR]]
+
for Linux < 2.6.26 see : [[Hardware/ARMEBS/3/u-bootBefore2.6.26|u-boot before 2.6.26]]
u-boot is a bootloader, we've choosen it because it supports usb and network operations. [[BR]]
+
It has been adapted to support our board, especially an [wiki:AutoUpdate auto-update] function, using an USB flash drive. [[BR]]
+
As any bootloader, u-boot can be used (and this is it's main purpose) to start another program (or operating system), for instance Linux. [[BR]]
+
The application we want to run must be in a special form called ''image'' and can be generated using {{{mkimage}}} (in u-boot/tools/), for instance generating a Linux kernel image is done using the following command :
+
{{{
+
mkimage -A ARM -T kernel -C none -O Linux -a 0x20008000 -d /opt/armebs3/linux-2.6.15/output/arch/arm/boot/zImage linux.img
+
}}}
+
Since r641 of our Linux kernel, {{{make uImage}}} will build this image for you.
+
  
== Automatic startup {{{bootcmd}}} ==
+
u-boot is a bootloader, we've choosen it because it supports usb and network operations.
At boot, u-boot do this:
+
 
  * By default, it runs the command in the {{{bootcmd}}} variable.
+
It has been adapted to support our board, especially an [[Hardware/ARMEBS/3/AutoUpdate|auto-update]] function, using an USB flash drive.
  * If the first button (S1 on the ARMEBS3) is pressed, it tries to do AutoUpdate on the USB key. If it fails, it runs {{{bootcmd}}}.
+
 
  * If the third button (S3 on the ARMEBS3) is pressed, it jumps to 0x10060000, after disabling instruction cache.
+
As any bootloader, u-boot can be used (and this is it's main purpose) to start another program (or operating system), for instance Linux.
 +
The application we want to run must be in a special form called ''image'' and can be generated using '''mkimage''' (in u-boot/tools/), for instance generating a Linux kernel image is done using the following command :
 +
 
 +
  mkimage -A ARM -T kernel -C none -O Linux -a 0x20008000 -d /opt/armebs3/linux-2.6.15/output/arch/arm/boot/zImage linux.img
 +
 
 +
After r641 of our Linux kernel, '''make uImage''' will build this image for you.
 +
 
 +
== Automatic startup ''bootcmd'' ==
 +
At boot, u-boot does this:
 +
* By default, it runs the command in the '''bootcmd''' variable.
 +
* If the first button (S1 on the ARMEBS3) is pressed, it tries to do AutoUpdate on the USB key. If it fails, it runs '''bootcmd}'''.
 +
* If the third button (S3 on the ARMEBS3) is pressed, it jumps to 0x10060000, after disabling instruction cache.
  
 
=== Settings for the technical informatics laboratories ===
 
=== Settings for the technical informatics laboratories ===
 
The instruction cache must be shut-down before downloading a software via the JTAG interface.
 
The instruction cache must be shut-down before downloading a software via the JTAG interface.
{{{
+
 
set bootcmd icache off
+
  set bootcmd icache off
save
+
  save
}}}
+
 
  
 
=== Get the Linux kernel from tftp (using a static ip address), and launch it ===
 
=== Get the Linux kernel from tftp (using a static ip address), and launch it ===
  * the kernel image (uImage) is at the root of the tftp server
+
* the kernel image (uImage) is at the root of the tftp server
  * the tftp server IP is 153.109.5.233
+
* the tftp server IP is 153.109.5.233
  * the armebs3 IP is 153.109.5.232
+
* the armebs3 IP is 153.109.5.232
  * don't forget to set the LinuxCommandLine in the {{{bootargs}}} variable
+
* don't forget to set the LinuxCommandLine in the '''bootargs''' variable
{{{
+
 
set ipaddr 153.109.5.232
+
  set ipaddr 153.109.5.232
set serverip 153.109.5.233
+
  set serverip 153.109.5.233
setenv bootcmd "tftpboot 0x21000000 uImage ; bootm 0x21000000"
+
  setenv bootcmd "tftpboot 0x21000000 uImage ; bootm 0x21000000"
save
+
  save
}}}
+
 
  
 
=== Get the Linux kernel from tftp (using DHCP), and launch it ===
 
=== Get the Linux kernel from tftp (using DHCP), and launch it ===
  * the kernel image (uImage) is at the root of the tftp server
+
* the kernel image (uImage) is at the root of the tftp server
  * the tftp server IP is 153.109.5.233
+
* the tftp server IP is 153.109.5.233
  * don't forget to set the LinuxCommandLine in the {{{bootargs}}} variable
+
* don't forget to set the LinuxCommandLine in the {{{bootargs}}} variable
{{{
+
 
set serverip 153.109.5.233
+
  set serverip 153.109.5.233  
setenv bootcmd "bootp 0x21000000 uImage ; bootm 0x21000000"
+
  setenv bootcmd "bootp 0x21000000 uImage ; bootm 0x21000000"
save
+
  save
}}}
+
 
  
 
=== Get the Linux kernel from flash, and launch it ===
 
=== Get the Linux kernel from flash, and launch it ===
  * The kernel image is supposed to be flashed at 0x10060000
+
* The kernel image is supposed to be flashed at 0x10060000
    * Download the kernel to ram (using tftp for intance)
+
* Download the kernel to ram (using tftp for instance)
    * Flash it
+
* Flash it
{{{
+
erase 0x10060000 +0x200000
+
cp.b 0x21000000 0x10060000 0x200000
+
}}}
+
  * don't forget to set the LinuxCommandLine in the {{{bootargs}}} variable
+
{{{
+
setenv bootcmd "bootm 0x10060000"
+
save
+
}}}
+
  
=== Get the Linux kernel from an USB key, and launch it ===
+
   erase 0x10060000 +0x200000
   * The USB key must be FAT16 formated, without partitions
+
   cp.b 0x21000000 0x10060000 0x200000
   * don't forget to set the LinuxCommandLine in the {{{bootargs}}} variable
+
{{{
+
set bootcmd "usb start ; fatload usb 0 0x21000000 uImage ; bootm 0x21000000"
+
}}}
+
  
== Configuration ==
+
* don't forget to set the LinuxCommandLine in the '''bootargs''' variable
The first time you start '''u-boot''' there is some things to configure. [[BR]]
+
Connect with a terminal emulator on the first serial port (115200,8,n,1). [[BR]]
+
  
=== Basic commands ===
+
   setenv bootcmd "bootm 0x10060000"
here is a small list of usefull commands:
+
   save
   help::
+
    give you help for built-in commands (without argument, display a list of all commands)
+
  bmp::
+
    used to display a bmp on the screen (example: '''bmp 0x10f00000''' will display the bitmap at address 0x10f00000). This command support standard bmp or gzipped bmp, and it's possible to
+
  usb::
+
    used to manage usb for  instance: '''usb start''', then '''usb storage''' to see which storage has been attached
+
  fatload::
+
    load a file from a fat file system into memory, example : '''fatload usb 0 0x21000000 linux.img''' will load the linux kernel image at 0x21000000, don't forget to do '''usb start''' before that :-),
+
  erase::
+
    erase flash, for instance '''erase 0x10060000 +0x200000''' for erasing flash from 0x10060000 to 0x10260000
+
   cp![.size]::
+
    copy from memory to memory (or to flash), for intsance '''cp.b 0x21000000 0x10060000 0x200000''' for copying 0x20000 byte from 0x21000000 (SDRAM) to 0x10060000 (flash)
+
  
u-boot works with environment variable for storing configuration option, and here are the basic commands for setting/reading variables:
 
  * setting a variable (v1)
 
{{{
 
setenv toto hello world
 
toto=hello world
 
}}}
 
  
  * printing a variable (v1)
+
=== Get the Linux kernel from an USB key, and launch it ===
{{{
+
* The USB key must be FAT16 formated, without partitions
printenv toto
+
* don't forget to set the LinuxCommandLine in the '''bootargs''' variable
toto=hello world
+
}}}
+
  
   * printing a variable (v2)
+
   set bootcmd "usb start ; fatload usb 0 0x21000000 uImage ; bootm 0x21000000"
{{{
+
echo ${toto}
+
hello world
+
}}}
+
  
  * saving variables (to flash)
 
{{{
 
save
 
Saving Environment to Flash...
 
Un-Protected 1 sectors
 
Erasing Flash...
 
. done
 
Erased 1 sectors
 
Writing to Flash... .
 
done
 
Protected 1 sectors
 
}}}
 
  
=== Well known variables ===
+
== Configuration ==  
u-boot uses some known variables names for it's own use, here is an overview (see also [source:u-boot/trunk/README u-boot README])
+
The first time you start '''u-boot''' there are some things to configure.
board ('''armebs3''' specific) and '''protected*''' variable ::
+
  name (type of the board), used to init board specific hardware. u-boot is compiled to support ALL ARMEBS3 based board and uses this variable to know which board it is running on. possible values are : '''armebs3''', '''ipresenter''', '''sidney''', '''proto'''.  
+
  
ethadd '''protected*''' variable::
+
Connect with a terminal emulator on the first serial port (115200,8,n,1).
  Ethernet address, '''MUST''' be set-up for boards using network, example : '''setenv ethaddr 00:00:17:00:00:00'''.
+
  
bootdelay::
 
  delay after reset before the bootcmp is run
 
  
bootcmd::
+
=== Basic commands ===
  command to run automatically after a reset, example : '''setenv bmp display 0x10f00000 \; bootm 0x10060000''' to diplay the bitmap located at 0x10f00000 and run the software from 0x10060000. unset it (setenv bootcmd) to do nothing at boot.
+
here is a small list of usefull commands:
 +
* '''help''' : gives you help for built-in commands (without argument, display a list of all commands)
 +
* '''bmp''' : used to display a bmp on the screen (example: '''bmp 0x10f00000''' will display the bitmap at address 0x10f00000). This command support standard bmp or gzipped bmp.
 +
* '''usb''' : used to manage usb for  instance: '''usb start''', then '''usb storage''' to see which storage has been attached.
 +
* '''fatload''' : load a file from a fat file system into memory, example : '''fatload usb 0 0x21000000 linux.img''' will load the linux kernel image at 0x21000000, don't forget to do '''usb start''' before that :-)
 +
* erase : erase flash, for instance '''erase 0x10060000 +0x200000''' for erasing flash from 0x10060000 to 0x10260000
 +
* cp![.size] : copy from memory to memory (or to flash), for instance '''cp.b 0x21000000 0x10060000 0x200000''' for copying 0x20000 byte from 0x21000000 (SDRAM) to 0x10060000 (flash)
  
bootargs:: (see also [wiki:LinuxCommandLine linux command line])::
+
u-boot works with environment variables for storing configuration options, and here are the basic commands for setting/reading variables:
  boot arguments, passed to the application to be run (at least passed to linux as the kernel command line), example '''setenv bootargs root=1f03 ro rootfstype=romfs console=ttyS0,9600
+
* setting a variable (v1)  
video=s1d13x06fb:crt,mode:800x600-16'''
+
  setenv toto hello world
 +
  toto=hello world
  
baudrate::
+
* printing a variable (v1)
  The baudrate for the console
+
  printenv toto
 +
  toto=hello world
  
sdtin, stdout, stderr::
+
* printing a variable (v2)  
  Defines where the standard input, output and error stream are sent by u-boot, values can be : '''serial''', '''vga''' (for the mezza_lcd and it's keyborard) and '''vga-serial''' (for both serial AND mezza_lcd).
+
  echo ${toto}
 +
  hello world
  
video::
+
* saving variables (to flash)
  Setup the vga output, values can be :  
+
  save
      * '''video=lcd,640x480-16''' for the mezza_lcd + the laboratory LCD screen.
+
  Saving Environment to Flash...
      * '''video=crt,800x600-16''' for the mezza_lcd + vga output
+
  Un-Protected 1 sectors
      * '''video=lcd,320x240-16''' for the sidney board.
+
  Erasing Flash...
 +
  . done
 +
  Erased 1 sectors
 +
  Writing to Flash... .
 +
  done
 +
  Protected 1 sectors
 +
 
 +
=== Well known variables ===
 +
u-boot uses some known variables names for it's own use, here is an overview.
 +
* board ('''armebs3''' specific) and '''protected*''' variable
 +
name (type of the board), used to init board specific hardware. u-boot is compiled to support ALL ARMEBS3 based board and uses this variable to know which board it is running on. possible values are : '''armebs3''', '''ipresenter''', '''sidney''', '''proto'''.
 +
* ethadd '''protected*''' variable
 +
Ethernet address, '''MUST''' be set-up for boards using network, example : '''setenv ethaddr 00:00:17:00:00:00'''.
 +
* bootdelay
 +
delay after reset before the bootcmp is run
 +
* bootcmd
 +
command to run automatically after a reset, example : '''setenv bmp display 0x10f00000 \; bootm 0x10060000''' to diplay the bitmap located at 0x10f00000 and run the software from 0x10060000. unset it (setenv bootcmd) to do nothing at boot.
 +
* bootargs ( see also [wiki:LinuxCommandLine linux command line])
 +
boot arguments, passed to the application to be run (at least passed to linux as the kernel command line), example '''setenv bootargs root=1f03 ro rootfstype=romfs console=ttyS0,9600
 +
video=s1d13x06fb:crt,mode:800x600-16'''
 +
* baudrate
 +
The baudrate for the console
 +
* sdtin, stdout, stderr
 +
Defines where the standard input, output and error stream are sent by u-boot, values can be : '''serial''', '''vga''' (for the mezza_lcd and it's keyborard) and '''vga-serial''' (for both serial AND mezza_lcd).
 +
* video : Setup the vga output, values can be :  
 +
** '''video=lcd,640x480-16''' for the mezza_lcd + the laboratory LCD screen.
 +
** '''video=crt,800x600-16''' for the mezza_lcd + vga output
 +
** '''video=lcd,320x240-16''' for the sidney board.
  
 
'''*protected variables''' can only be set once. To reset this variables, the flash configuration area must be erased and the system rebooted ('''flash protect off all ; erase 0x10040000 + 0x20000 ; boot'''), then the protected variables can be set again.
 
'''*protected variables''' can only be set once. To reset this variables, the flash configuration area must be erased and the system rebooted ('''flash protect off all ; erase 0x10040000 + 0x20000 ; boot'''), then the protected variables can be set again.
 +
 +
 
== compiling/installing ==
 
== compiling/installing ==
  * checkout the sources from !https://svn.hevs.ch/svn/uit/armebs3/u-boot/trunk ([source:u-boot/trunk view])
+
* checkout the sources from https://svn.hevs.ch/svn/uit/armebs3/u-boot/trunk
{{{
+
  cd /opt/armebs3
cd /opt/armebs3
+
  /opt/armebs3 svn checkout https://svn.hevs.ch/svn/uit/armebs3/u-boot/trunk u-boot
/opt/armebs3 snv checkout !https://svn.hevs.ch/svn/uit/armebs3/u-boot/trunk u-boot
+
 
...
+
* compile it
/opt/armebs3
+
  /opt/armebs3 cd u-boot
}}}
+
  /opt/armebs3/u-boot make armebs3_config
  * compile it
+
  /opt/armebs3/u-boot make
{{{
+
  /opt/armebs3/u-boot
/opt/armebs3 cd u-boot
+
 
/opt/armebs3/u-boot make armebs3_config
+
* flash it
...
+
  /opt/armebs3/u-boot cp u-boot.bin /opt/armebs3/tftp
/opt/armebs3/u-boot make
+
  reset
...
+
  mm 0xfffffc20  0x0000ff01
/opt/armebs3/u-boot
+
  mm 0xffffff70  0x000030ff
}}}
+
  mm 0xfffffc30  0x00000001
  * flash it
+
  unlock 0x10000000 0x20000 2
{{{
+
  erase 0x10000000 0x20000 2
/opt/armebs3/u-boot cp u-boot.bin /opt/armebs3/tftp
+
  Erasing flash at 0x10000000
reset
+
  Erasing flash at 0x10020000
mm 0xfffffc20  0x0000ff01
+
  Erasing flash passed
mm 0xffffff70  0x000030ff
+
  prog 0x10000000 u-boot.bin bin
mm 0xfffffc30  0x00000001
+
  Programming u-boot.bin , please wait ....
unlock 0x10000000 0x20000 2
+
  Programming flash passed
erase 0x10000000 0x20000 2
+
Erasing flash at 0x10000000
+
Erasing flash at 0x10020000
+
Erasing flash passed
+
prog 0x10000000 u-boot.bin bin
+
Programming u-boot.bin , please wait ....
+
Programming flash passed
+
}}}
+
  
 
== u-boot, step by step, file by file ==
 
== u-boot, step by step, file by file ==
 
here is a small overview of what is done in which file
 
here is a small overview of what is done in which file
  * [source:/u-boot/trunk/cpu/arm920t/start.S u-boot/cpu/arm920t/start.S]
+
* /u-boot/trunk/cpu/arm920t/start.S u-boot/cpu/arm920t/start.S
    * reset vectors -> reset
+
** reset vectors -> reset
    * reset
+
** reset
      * do cpu init
+
*** do cpu init
      * call lowlevel_init from [source:/u-boot/trunk/cpu/arm920t/at91rm9200/lowlevel_init.S u-boot/cpu/arm920t/at91rm9200/lowlevel_init.S]
+
*** call lowlevel_init from [source:/u-boot/trunk/cpu/arm920t/at91rm9200/lowlevel_init.S u-boot/cpu/arm920t/at91rm9200/lowlevel_init.S]
        * init sdram, chip select, ...
+
**** init sdram, chip select, ...
      * relocates to sdram, setup stack, clear bss section
+
*** relocates to sdram, setup stack, clear bss section
      * jump to start_armboot (relocated)
+
*** jump to start_armboot (relocated)
    * start_armboot from [source:/u-boot/trunk/lib_arm/board.c u-boot/cpu/arm920t/lib_arm/board.c]
+
** start_armboot from /u-boot/trunk/lib_arm/board.c u-boot/cpu/arm920t/lib_arm/board.c
      * init global data sturcture (gd)
+
*** init global data sturcture (gd)
      * call every functions from the init_sequence[] table
+
**** call every functions from the init_sequence[] table
        * basic cpu dependent setup    cpu_init [source:/u-boot/trunk/cpu/arm920t/cpu.c u-boot/cpu/arm920t/cpu.c]
+
***** basic cpu dependent setup    cpu_init u-boot/trunk/cpu/arm920t/cpu.c u-boot/cpu/arm920t/cpu.c
        * basic board dependent setup  board_init [source:/u-boot/trunk/board/armebs3/armebs3.c u-boot/board/armebs3/armebs3.c]                     
+
***** basic board dependent setup  board_init u-boot/trunk/board/armebs3/armebs3.c u-boot/board/armebs3/armebs3.c                  
        * set up exceptions            interrupt_init [source:/u-boot/trunk/cpu/arm920t/at91rm9200/interrupts.c u-boot/cpu/arm920t/at91rm9200/interrupts.c]
+
***** set up exceptions            interrupt_init /u-boot/trunk/cpu/arm920t/at91rm9200/interrupts.c u-boot/cpu/arm920t/at91rm9200/interrupts.c
        * initialize environment        env_init [source:/u-boot/trunk/common/env_flash.c u-boot/common/env_flash.c]
+
***** initialize environment        env_init /u-boot/trunk/common/env_flash.c u-boot/common/env_flash.c
        * initialze baudrate settings  init_baudrate [source:/u-boot/trunk/lib_arm/board.c u-boot/lib_arm/board.c]
+
***** initialze baudrate settings  init_baudrate /u-boot/trunk/lib_arm/board.c u-boot/lib_arm/board.c
        * serial communications setup  serial_init [source:/u-boot/trunk/cpu/arm920t/at91rm9200/serial.c u-boot/cpu/arm920t/at91rm9200/serial.c]
+
***** serial communications setup  serial_init /u-boot/trunk/cpu/arm920t/at91rm9200/serial.c u-boot/cpu/arm920t/at91rm9200/serial.c
        * stage 1 init of console      console_init_f [source:/u-boot/trunk/board/armebs3/armebs3.c u-boot/board/armebs3/armebs3.c]
+
***** stage 1 init of console      console_init_f /u-boot/trunk/board/armebs3/armebs3.c u-boot/board/armebs3/armebs3.c
        * say that we are here          display_banner [source:/u-boot/trunk/lib_arm/board.c u-boot/lib_arm/board.c]
+
***** say that we are here          display_banner /u-boot/trunk/lib_arm/board.c u-boot/lib_arm/board.c
        * configure available RAM banks dram_init (only setup how many sdram is here for u-boot, no sdram initialization) [source:/u-boot/trunk/board/armebs3/armebs3.c u-boot/board/armebs3/armebs3.c
+
***** configure available RAM banks dram_init (only setup how many sdram is here for u-boot, no sdram initialization) /u-boot/trunk/board/armebs3/armebs3.c u-boot/board/armebs3/armebs3.c
        * display dram info            display_dram_config [source:/u-boot/trunk/lib_arm/board.c u-boot/lib_arm/board.c]
+
***** display dram info            display_dram_config /u-boot/trunk/lib_arm/board.c u-boot/lib_arm/board.c
      * ...
+
***** ...
      * run u-boot
+
***** run u-boot
  
 
== External link(s) ==
 
== External link(s) ==
here is the u-boot home page: [http://u-boot.sourceforge.net/ http://u-boot.sourceforge.net/].
+
here is the u-boot home page: [http://u-boot.sourceforge.net/ http://u-boot.sourceforge.net/].
 +
 
 +
[[Category:Hardware]] [[Category:ARMEBS]]

Latest revision as of 14:42, 26 June 2015

Contents

u-boot

for Linux < 2.6.26 see : u-boot before 2.6.26

u-boot is a bootloader, we've choosen it because it supports usb and network operations.

It has been adapted to support our board, especially an auto-update function, using an USB flash drive.

As any bootloader, u-boot can be used (and this is it's main purpose) to start another program (or operating system), for instance Linux. The application we want to run must be in a special form called image and can be generated using mkimage (in u-boot/tools/), for instance generating a Linux kernel image is done using the following command :

 mkimage -A ARM -T kernel -C none -O Linux -a 0x20008000 -d /opt/armebs3/linux-2.6.15/output/arch/arm/boot/zImage linux.img

After r641 of our Linux kernel, make uImage will build this image for you.

Automatic startup bootcmd

At boot, u-boot does this:

  • By default, it runs the command in the bootcmd variable.
  • If the first button (S1 on the ARMEBS3) is pressed, it tries to do AutoUpdate on the USB key. If it fails, it runs bootcmd}.
  • If the third button (S3 on the ARMEBS3) is pressed, it jumps to 0x10060000, after disabling instruction cache.

Settings for the technical informatics laboratories

The instruction cache must be shut-down before downloading a software via the JTAG interface.

 set bootcmd icache off
 save


Get the Linux kernel from tftp (using a static ip address), and launch it

  • the kernel image (uImage) is at the root of the tftp server
  • the tftp server IP is 153.109.5.233
  • the armebs3 IP is 153.109.5.232
  • don't forget to set the LinuxCommandLine in the bootargs variable
 set ipaddr 153.109.5.232
 set serverip 153.109.5.233
 setenv bootcmd "tftpboot 0x21000000 uImage ; bootm 0x21000000"
 save


Get the Linux kernel from tftp (using DHCP), and launch it

  • the kernel image (uImage) is at the root of the tftp server
  • the tftp server IP is 153.109.5.233
  • don't forget to set the LinuxCommandLine in the {{{bootargs}}} variable
 set serverip 153.109.5.233 
 setenv bootcmd "bootp 0x21000000 uImage ; bootm 0x21000000"
 save


Get the Linux kernel from flash, and launch it

  • The kernel image is supposed to be flashed at 0x10060000
  • Download the kernel to ram (using tftp for instance)
  • Flash it
 erase 0x10060000 +0x200000
 cp.b 0x21000000 0x10060000 0x200000
  • don't forget to set the LinuxCommandLine in the bootargs variable
 setenv bootcmd "bootm 0x10060000"
 save


Get the Linux kernel from an USB key, and launch it

  • The USB key must be FAT16 formated, without partitions
  • don't forget to set the LinuxCommandLine in the bootargs variable
 set bootcmd "usb start ; fatload usb 0 0x21000000 uImage ; bootm 0x21000000"


Configuration

The first time you start u-boot there are some things to configure.

Connect with a terminal emulator on the first serial port (115200,8,n,1).


Basic commands

here is a small list of usefull commands:

  • help : gives you help for built-in commands (without argument, display a list of all commands)
  • bmp : used to display a bmp on the screen (example: bmp 0x10f00000 will display the bitmap at address 0x10f00000). This command support standard bmp or gzipped bmp.
  • usb : used to manage usb for instance: usb start, then usb storage to see which storage has been attached.
  • fatload : load a file from a fat file system into memory, example : fatload usb 0 0x21000000 linux.img will load the linux kernel image at 0x21000000, don't forget to do usb start before that :-)
  • erase : erase flash, for instance erase 0x10060000 +0x200000 for erasing flash from 0x10060000 to 0x10260000
  • cp![.size] : copy from memory to memory (or to flash), for instance cp.b 0x21000000 0x10060000 0x200000 for copying 0x20000 byte from 0x21000000 (SDRAM) to 0x10060000 (flash)

u-boot works with environment variables for storing configuration options, and here are the basic commands for setting/reading variables:

  • setting a variable (v1)
 setenv toto hello world
 toto=hello world
  • printing a variable (v1)
 printenv toto
 toto=hello world
  • printing a variable (v2)
 echo ${toto}
 hello world
  • saving variables (to flash)
 save
 Saving Environment to Flash...
 Un-Protected 1 sectors
 Erasing Flash...
 . done
 Erased 1 sectors
 Writing to Flash... .
 done
 Protected 1 sectors

Well known variables

u-boot uses some known variables names for it's own use, here is an overview.

  • board (armebs3 specific) and protected* variable

name (type of the board), used to init board specific hardware. u-boot is compiled to support ALL ARMEBS3 based board and uses this variable to know which board it is running on. possible values are : armebs3, ipresenter, sidney, proto.

  • ethadd protected* variable

Ethernet address, MUST be set-up for boards using network, example : setenv ethaddr 00:00:17:00:00:00.

  • bootdelay

delay after reset before the bootcmp is run

  • bootcmd

command to run automatically after a reset, example : setenv bmp display 0x10f00000 \; bootm 0x10060000 to diplay the bitmap located at 0x10f00000 and run the software from 0x10060000. unset it (setenv bootcmd) to do nothing at boot.

  • bootargs ( see also [wiki:LinuxCommandLine linux command line])

boot arguments, passed to the application to be run (at least passed to linux as the kernel command line), example setenv bootargs root=1f03 ro rootfstype=romfs console=ttyS0,9600 video=s1d13x06fb:crt,mode:800x600-16

  • baudrate

The baudrate for the console

  • sdtin, stdout, stderr

Defines where the standard input, output and error stream are sent by u-boot, values can be : serial, vga (for the mezza_lcd and it's keyborard) and vga-serial (for both serial AND mezza_lcd).

  • video : Setup the vga output, values can be :
    • video=lcd,640x480-16 for the mezza_lcd + the laboratory LCD screen.
    • video=crt,800x600-16 for the mezza_lcd + vga output
    • video=lcd,320x240-16 for the sidney board.

*protected variables can only be set once. To reset this variables, the flash configuration area must be erased and the system rebooted (flash protect off all ; erase 0x10040000 + 0x20000 ; boot), then the protected variables can be set again.


compiling/installing

 cd /opt/armebs3
 /opt/armebs3 svn checkout https://svn.hevs.ch/svn/uit/armebs3/u-boot/trunk u-boot
  • compile it
 /opt/armebs3 cd u-boot
 /opt/armebs3/u-boot make armebs3_config
 /opt/armebs3/u-boot make
 /opt/armebs3/u-boot
  • flash it
 /opt/armebs3/u-boot cp u-boot.bin /opt/armebs3/tftp
 reset
 mm 0xfffffc20  0x0000ff01
 mm 0xffffff70  0x000030ff
 mm 0xfffffc30  0x00000001
 unlock 0x10000000 0x20000 2
 erase 0x10000000 0x20000 2
 Erasing flash at 0x10000000
 Erasing flash at 0x10020000
 Erasing flash passed
 prog 0x10000000 u-boot.bin bin
 Programming u-boot.bin , please wait ....
 Programming flash passed

u-boot, step by step, file by file

here is a small overview of what is done in which file

  • /u-boot/trunk/cpu/arm920t/start.S u-boot/cpu/arm920t/start.S
    • reset vectors -> reset
    • reset
      • do cpu init
      • call lowlevel_init from [source:/u-boot/trunk/cpu/arm920t/at91rm9200/lowlevel_init.S u-boot/cpu/arm920t/at91rm9200/lowlevel_init.S]
        • init sdram, chip select, ...
      • relocates to sdram, setup stack, clear bss section
      • jump to start_armboot (relocated)
    • start_armboot from /u-boot/trunk/lib_arm/board.c u-boot/cpu/arm920t/lib_arm/board.c
      • init global data sturcture (gd)
        • call every functions from the init_sequence[] table
          • basic cpu dependent setup cpu_init u-boot/trunk/cpu/arm920t/cpu.c u-boot/cpu/arm920t/cpu.c
          • basic board dependent setup board_init u-boot/trunk/board/armebs3/armebs3.c u-boot/board/armebs3/armebs3.c
          • set up exceptions interrupt_init /u-boot/trunk/cpu/arm920t/at91rm9200/interrupts.c u-boot/cpu/arm920t/at91rm9200/interrupts.c
          • initialize environment env_init /u-boot/trunk/common/env_flash.c u-boot/common/env_flash.c
          • initialze baudrate settings init_baudrate /u-boot/trunk/lib_arm/board.c u-boot/lib_arm/board.c
          • serial communications setup serial_init /u-boot/trunk/cpu/arm920t/at91rm9200/serial.c u-boot/cpu/arm920t/at91rm9200/serial.c
          • stage 1 init of console console_init_f /u-boot/trunk/board/armebs3/armebs3.c u-boot/board/armebs3/armebs3.c
          • say that we are here display_banner /u-boot/trunk/lib_arm/board.c u-boot/lib_arm/board.c
          • configure available RAM banks dram_init (only setup how many sdram is here for u-boot, no sdram initialization) /u-boot/trunk/board/armebs3/armebs3.c u-boot/board/armebs3/armebs3.c
          • display dram info display_dram_config /u-boot/trunk/lib_arm/board.c u-boot/lib_arm/board.c
          • ...
          • run u-boot

External link(s)

here is the u-boot home page: http://u-boot.sourceforge.net/.

Personal tools
Namespaces
Variants
Actions
Navigation
Browse
Toolbox