ECE597 icassp 2010 Lab 2 The Boot Sequence

From eLinux.org
Revision as of 13:47, 27 October 2011 by Peter Huewe (talk | contribs) (Added categories and changed links to internal)
Jump to: navigation, search

In the first lab you saw the BeagleBoard from a users point of view. In this lab we'll take a look at what's going on inside.

Connecting to the Beagle's serial port

If your Beagle is still running do this to shut it down.

Start HyperTerminal

Go to Start:Accessories:Communications:HyperTerminal and create a new connection. Call it Beagle. HyperTerminal init.png
Select USB if you are using the USB to serial port adapter, or select COM1 if you are directly connected to the serial port HyperTerminal Connect To.png
Select the settings shown HyperTerminal Properties.png

Alternative Serial Program: Putty

Newer versions of windows lack HyperTerminal, or if you prefer to use something other then HyperTerminal, putty's serial support works quite well. It can be downloaded here
Upon starting putty select the Serial bubble on the Session tab under Connection type, next set the Speed to 11520. Optionally you can save the session to prevent the need for reconfiguration of future starts of putty.
Simply click open and you should be connected to your beagle.

With either method, you should be able to hit enter and see

.-------.                                           
|       |                  .-.                      
|   |   |-----.-----.-----.| |   .----..-----.-----.
|       |     | __  |  ---'| '--.|  .-'|     |     |
|   |   |  |  |     |---  ||  --'|  |  |  '  | | | |
'---'---'--'--'--.  |-----''----''--'  '-----'-'-'-'
                -'  |
                '---'

The Angstrom Distribution beagleboard ttyS2

Angstrom 2009.X-stable beagleboard ttyS2

beagleboard login: root
root@beagleboard:~#

Login as root.

Shutting Down and Rebooting on U-Boot

root@beagleboard:~# shutdown -r now

As your Beagle reboots you will see:

Texas Instruments X-Loader 1.4.2 (Feb 19 2009 - 12:01:24)
Reading boot sector
Loading u-boot.bin from mmc

Which is then followed by

U-Boot 2009.11-rc1 (Jan 08 2010 - 21:19:52)
 
OMAP3530-GP ES3.1, CPU-OPP2 L3-165MHz
OMAP3 Beagle board + LPDDR/NAND
I2C:   ready
DRAM:  256 MB
NAND:  256 MiB
In:    serial
Out:   serial
Err:   serial
Board revision C4
Die ID #5444000400000000040365fa1400e007
Hit any key to stop autoboot:  0
OMAP3 beagleboard.org #

Hit a key before it goes on to boot Linux. What has happened so far is:

  1. When power is first applied the Beagle jumps to a boot loader in the OMAPs ROM.
  2. This bootloader finds the SD card run runs a file called MLO.
  3. MLO is X-Loader with a couple things added. The first bit of output above is from X-Loader.
  4. X-Loader looks and finds u-boot.bin and starts running it.

Das U-Boot is universal boot loader that is used on many embedded systems. You can find more information at http://www.denx.de/wiki/U-Boot. You can list the commands it understands:

OMAP3 beagleboard.org # help
?       - alias for 'help'
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'
bootm   - boot application image from memory
chpart  - change active partition
cmp     - memory compare
coninfo - print console devices and information
cp      - memory copy
crc32   - checksum calculation
echo    - echo args to console
editenv - edit environment variable
exit    - exit script
ext2load- load binary file from a Ext2 filesystem
ext2ls  - list files in a directory (default /)
false   - do nothing, unsuccessfully
fatinfo - print information about filesystem
fatload - load binary file from a dos filesystem
fatls   - list files in a directory (default /)
fsinfo  - print information about filesystems
fsload  - load binary file from a filesystem image
go      - start application at address 'addr'
help    - print command description/usage
i2c     - I2C sub-system
imxtract- extract a part of a multi-image
itest   - return true/false on integer compare
loadb   - load binary file over serial line (kermit mode)
loads   - load S-Record file over serial line
loady   - load binary file over serial line (ymodem mode)
loop    - infinite loop on address range
ls      - list files in a directory (default /)
md      - memory display
mm      - memory modify (auto-incrementing address)
mmc     - MMC sub-system
mtdparts- define flash/nand partitions
mtest   - simple RAM read/write test
mw      - memory write (fill)
nand    - NAND sub-system
nandecc - nandecc - switch OMAP3 NAND ECC calculation algorithm

nboot   - boot from NAND device
nm      - memory modify (constant address)
printenv- print environment variables
reset   - Perform RESET of the CPU
run     - run commands in an environment variable
saveenv - save environment variables to persistent storage
setenv  - set environment variables
showvar - print local hushshell variables
sleep   - delay execution for some time
source  - run script from memory
test    - minimal test like /bin/sh
true    - do nothing, successfully
version - print monitor version

U-Boot source code is available is highly configurable, therefore the command list can be expanded or reduced to fit your application. Try:

OMAP3 beagleboard.org # bdi
arch_number = 0x0000060A
env_t       = 0x00000000
boot_params = 0x80000100
DRAM bank   = 0x00000000
-> start    = 0x80000000
-> size     = 0x08000000
DRAM bank   = 0x00000001
-> start    = 0x88000000
-> size     = 0x08000000
baudrate    = 115200 bps

This gives you some information about the board. It appears we have some RAM starting at 0x8000 0000.

Booting Linux

Here's what happens when you boot Linux:

OMAP3 beagleboard.org # print bootcmd
bootcmd=mmc init;fatload mmc 0 80300000 uImage;bootm 80300000
OMAP3 beagleboard.org # print bootargs
bootargs=console=ttyS2,115200n8 console=tty0 root=/dev/mmcblk0p2 rw rootfstype=t

Enter boot and Linux will start:

OMAP3 beagleboard.org # boot
mmc1 is available
reading uImage

2996196 bytes read
## Booting kernel from Legacy Image at 80300000 ...
   Image Name:   Angstrom/2.6.29/beagleboard
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2996132 Bytes =  2.9 MB
   Load Address: 80008000
   Entry Point:  80008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux.............................................................
[    0.000000] Linux version 2.6.29-omap1 (koen@dominion) (gcc version 4.3.3 (G9
[    0.000000] CPU: ARMv7 Processor [411fc083] revision 3 (ARMv7), cr=10c5387f

...

[94371.964385] eth0: link up, 100Mbps, full-duplex, lpa 0xC5E1
[94372.195861] eth0: link up, 100Mbps, full-duplex, lpa 0xC5E1

.-------.                                           
|       |                  .-.                      
|   |   |-----.-----.-----.| |   .----..-----.-----.
|       |     | __  |  ---'| '--.|  .-'|     |     |
|   |   |  |  |     |---  ||  --'|  |  |  '  | | | |
'---'---'--'--'--.  |-----''----''--'  '-----'-'-'-'
                -'  |
                '---'

The Angstrom Distribution beagleboard ttyS2

Angstrom 2009.X-stable beagleboard ttyS2

beagleboard login: 

Homework

There are many options that can be passed to the kernel at boot time. One of the most common ones is to set the display resolution. Check BeagleBoardFAQ#Display_resolutions_.231 for details.