CFE Quick Start

CFE Quick Start


当前版本: 1.0
完成日期: 2011-2-23
作者: Jack Tan
Email: jiankemeng@gmail.com
版权声明: 转载请注明出处,商业用途请联系作者

1. CFE Boot Log

CFE version 1.2.4 for SWARM (64bit,MP,BE,MIPS)
Build Date: Tue Aug 30 06:45:43 PDT 2005 (mpl@lc-sj1-092)
Copyright (C) 2000,2001,2002,2003,2004,2005 Broadcom Corporation.

Initializing Arena.
Initializing PCI. [normal]
PCI bus 0 slot 1/0: Warning: SipReady already set
HyperTransport not initialized: InitDone not set
PCI bus 0 slot 0/0: SiByte, Inc. BCM1250 PCI Host Bridge (host bridge, rev 0x02)
PCI bus 0 slot 6/0: unknown vendor 0x1317 product 0x0985 (ethernet network, rev 0x11)
PCI bus 0 slot 7/0: unknown vendor 0x1045 product 0xc861 (USB serial bus, interface 0x10, rev 0x10)
Initializing Devices.
SWARM board revision 3
sbeth: found phy 1, vendor 000818 part 0E
sbeth: found phy 1, vendor 000818 part 0E
PCIIDE: 0 controllers found
Config switch: 2
CPU: BCM1250 B2
L2 Cache Status: OK
Wafer ID:   0x8FC26019  [Lot 9200, Wafer 19]
Manuf Test: Bin A [2CPU_FI_FD_F2 (OK)]
SysCfg: 0000000028DB0800 [PLL_DIV: 16, IOB0_DIV: CPUCLK/4, IOB1_DIV: CPUCLK/3]
CPU type 0x1040102: 800MHz
Total memory: 0x10000000 bytes (256MB)

Total memory used by CFE:  0x8FE9C000 - 0x8FFFFD00 (1457408)
Initialized Data:          0x8FEF69A0 - 0x8FEFD650 (27824)
BSS Area:                  0x8FEFD650 - 0x8FEFDD00 (1712)
Local Heap:                0x8FEFDD00 - 0x8FFFDD00 (1048576)
Stack Area:                0x8FFFDD00 - 0x8FFFFD00 (8192)
Text (code) segment:       0x8FE9C000 - 0x8FEF608D (368781)
Boot area (physical):      0x0FE5B000 - 0x0FE9B000
Relocation Factor:         I:F029C000 - D:F029C000

Automatic startup canceled via Ctrl-C

2. Config to bootstrap

2.0 Display devices

CFE> show devices

Device Name          Description
 -------------------  ---------------------------------------------------------
uart0                Si Byte DUART at 0x10060000 channel 0
promice0             Prom ICE AI2 Serial Port at 0x1FDFFC00
eeprom0              Microchip 24LC128 EEPROM on SMBus channel 1 dev 0x51
uart1                Si Byte DUART at 0x10060000 channel 1
flash0               New CFI flash at 1FC00000 size 2048KB
flash1               New CFI flash at 1F800000 size 2048KB
eeprom1              Microchip 24LC128 EEPROM on SMBus channel 0 dev 0x50
eth0                 Si Byte Ethernet at 0x10064000 (00-02-4C-FE-03-E6)
eth1                 Si Byte Ethernet at 0x10065000 (00-02-4C-FE-03-E7)
ide0.0               IDE disk unit 0 at 100B3E00
pcmcia0              PCMCIA ATA disk unit 0 at 11000000
clock0               ST M41T81 RTC on SMBus channel 1 dev 0x68
tcpconsole0          TCP Console

2.1 Config network

CFE> ifconfig -auto eth0
or:
  CFE> ifconfig -addr=192.168.29.128 -gw=192.168.29.1 -mask=255.255.255.0 eth0

  Options

     -auto        Configure interface automatically via DHCP
     -off         Deactivate the specified interface
     -addr=*      Specifies the IP address of the interface
     -mask=*      Specifies the subnet mask for the interface
     -gw=*        Specifies the gateway address for the interface
     -dns=*       Specifies the name server address for the interface
     -domain=*    Specifies the default domain for name service queries
     -speed=*     Sets the interface speed (auto,10fdx,10hdx,100fdx,
                  100hdx,1000fdx,1000hdx)
     -loopback=*  Sets the loopback mode (off,internal,external)  External
                  loopback causes the phy to be placed in loopback mode
     -hwaddr=*    Sets the hardware address (overrides environment)

2.2 Load & execute

CFE support loading ELF, SREC, uboot image (uImage) and binary format.

CFE> load -elf 192.168.29.11:vlm-boards/8336/vmlinux              # load vmlinux at virtual 0x2000 0000 via tftp
CFE> load -srec 192.168.29.11:vlm-boards/8336/vmlinux.srec        # load vmlinux.srec at virtual 0x2000 0000 via tftp
CFE> load -uboot 192.168.29.11:vlm-boards/8336/uImage             # load uImage at virtual 0x2000 0000 via tftp

  Options:

     -raw         Load the file as a raw binary  (default)
     -z           Load compressed file

     -tftp        Load the file using the TFTP protocol (default)
     -fatfs       Load the file from a FAT file system
     -rawfs       Load the file from an unformatted file system
     -http        Load the file using the HTTP protocol

     -max=*       Specify the maximum number of bytes to load (raw only)
     -addr=*      Specify the load address (hex) (raw only)
     -noclose     Don't close network link before executing program

CFE> go                                                             # go to the start address(entry address) to execute
CFE> go  0x804117f0

CFE support loading file from devices. We can use following command to load kernel from a IDE disk:

CFE> load -elf -fatfs ide0.0:vmlinux

Generally, we use ‘boot’ to load the kernel and go to the entry address (load + go):

CFE> boot -elf 192.168.29.11:vlm-boards/8336/vmlinux 

Loader:elf Filesys:tftp Dev:eth0 File:192.168.29.11:vlm-boards/8336/vmlinux Options:(null)
Loading: 0xffffffff80100000/4399238 0xffffffff80532086/200090 Entry at 0x804117f0
Closing network.
Starting program at 0x804117f0

Linux version 2.6.26-rc7-WR3.0zz_standard (root@Pek-JTan-d1) (gcc version 4.1.2 (Wind River Linux Sourcery G++ 4.1-91)) #2 PREEMPT Wed Jun 25 12:52:52 CST 2008
console [early0] enabled
CPU revision is: 01040102 (SiByte SB1)
FPU revision is: 000f0102
Checking for the multiply/shift bug... no.
Checking for the daddiu bug... no.
Broadcom SiByte BCM1250 B2 @ 800 MHz (SB1 rev 2)
Board type: SiByte BCM91250A (SWARM)
This kernel optimized for board runs with CFE
Determined physical RAM map:
 memory: 000000000fe9be00 @ 0000000000000000 (usable)
Initrd not found or empty - disabling initrd
......

2.3 Setting environment varible

CFE use STARTUP as the automatic bootstrap commands and LINUX_CMDLINE as the kernel arguments::

CFE> printenv
Variable Name        Value
-------------------- --------------------------------------------------
BOOT_CONSOLE         uart0
ETH0_HWADDR          00-02-4c-fe-03-e6
ETH1_HWADDR          00-02-4c-fe-03-e7
STARTUP              ifconfig -auto eth0; boot -srec 192.168.29.11:/vlm-boards/8336/kernel
LINUX_CMDLINE        root=/dev/nfs rw nfsroot=192.168.29.11:/export/pxeboot/vlm-boards/8336/rootfs ip=dhcp
CPU_TYPE             1250
CPU_SPEED            800
CPU_REVISION         B2
CPU_NUM_CORES        2
CFE_VERSION          1.2.4
CFE_BOARDNAME        SWARM
CFE_MEMORYSIZE       256

After booting up, CFE automatically execute “ifconfig -auto eth0; boot -srec 192.168.29.11:/vlm-boards/8336/kernel”

So, maybe you need to reset the LINUX_CMDLINE:

CFE> setenv LINUX_CMDLINE "root=/dev/nfs rw nfsroot=192.168.29.11:/export/pxeboot/vlm-boards/8336/rootfs  ip=192.168.29.148"

If you want to store the environment variable permanently in the NVRAM, you need to use the -p option.

     -p           Store environment variable permanently in the NVRAM device, if present
     -ro          Causes variable to be read-only (cannot be changed in the future, implies -p)

3. Memory commands

3.1 Disassemble instructions

CFE> u 0xbfc01000 5
BFC01000: 24040000    addiu    a0,zero,#0
BFC01004: 0000328c    syscall  #202
BFC01008: 1000ffff    beq      zero,zero,0xffffffffbfc01008
BFC0100C: 00000000    sll      zero,zero,#0
BFC01010: 3c08bfc0    lui      t0,#49088

3.2 Dump memory

CFE> d -b 0xbfc01000 0x30
FFFFFFFFBFC01000: 24 04 00 00 00 00 32 8C 10 00 FF FF 00 00 00 00  $.....2.........
FFFFFFFFBFC01010: 3C 08 BF C0 01 00 00 08 00 00 00 00 27 BB FD B0  <...........'...
FFFFFFFFBFC01020: 00 1B D8 FA 00 1B D8 F8 FF 60 00 40 FF 61 00 48  .........`.@.a.H

CFE> d -h 0xbfc01000 16
FFFFFFFFBFC01000: 2404 0000 0000 328C 1000 FFFF 0000 0000  $.....2.........
FFFFFFFFBFC01010: 3C08 BFC0 0100                           <.....          

CFE> d -q 0xbfc01000 16
FFFFFFFFBFC01000: 240400000000328C 1000FFFF00000000  $.....2.........
FFFFFFFFBFC01010: 3C08BFC001000008                   <.....

3.3 Modify memory

CFE> e -w 0x80000000 0x12345678
CFE> d -w 0x80000000
FFFFFFFF80000000: 12345678 277BDE48 03600008 241A0008  .4Vx'{.H.`..$...
FFFFFFFF80000010: 00000000 00000000

If you omit the data, CFE will enter “memory edit” mode:

CFE> e -w 0x80000000
Type '.' to exit, '-' to back up, '=' to dump memory.
FFFFFFFF80000000: [12345678]:

3.4 Fill memory

Usage:

 f [-b|-h|-w|-q] addr length pattern
CFE> f -h 80000000 0x10 0x55aa
CFE> d -h 80000000 0x30
FFFFFFFF80000000: 55AA 55AA 55AA 55AA 55AA 55AA 55AA 55AA  U.U.U.U.U.U.U.U.
FFFFFFFF80000010: 55AA 55AA 55AA 55AA 55AA 55AA 55AA 55AA  U.U.U.U.U.U.U.U.
FFFFFFFF80000020: 0000 0000 0000 0000 0000 0000 0000 0000  ................

4. Flash commands

4.1 show flash

This command is to display information of a flash device:

CFE> show flash flash0
FLASH: Base 000000001FC00000 size 00200000 type 03(Flash) flags 00000001
NVRAM: Not supported by this flash

4.2 update flash

To update flash we use ‘flash’ command.

Under most circumstances, the file to be written to flash must be the output of the mkflashimage program in the cfe/hosttools directory.The mkflashimage program writes a header on the front of the flash image that contains version information, the file’s length and a CRC to prevent inadvertently writing a bad image into the system’s boot ROM.

CFE> flash flash0 flash1                                          # backup flash0's data into flash1
CFE> flash -noheader 192.168.29.11:vlm-boards/8336/cfe            # write data to default device flash0 via tftp
CFE> flash uart0 flash0                                           # read S-records from uart0 and write the data to flash0

 OPTIONS
     -noerase     Don't erase flash before writing
     -offset=*    Begin programming at this offset in the flash device
     -size=*      Size of source device when programming from flash to flash
     -noheader    Override header verification, flash binary without checking

5. Miscellaneous

5.1 Reset system

CFE> reset -yes -sysreset                                                      # Full system reset
CFE> reset -yes -cpu                                                           # Reset the CPUs
CFE> reset -yes -softreset                                                     # Soft reset of the entire chip

5.2 Show TLB

CFE> show tlb
Entry 00  C0000FFFA007E000 0000000000000000 0000000000000000
Entry 01  C0000FFFA007C000 0000000000000000 0000000000000000
Entry 02  C0000FFFA007A000 0000000000000000 0000000000000000
Entry 03  C0000FFFA0078000 0000000000000000 0000000000000000
Entry 04  C0000FFFA0076000 0000000000000000 0000000000000000
Entry 05  C0000FFFA0074000 0000000000000000 0000000000000000
......
......

5.3 Show PCI

CFE> show pci
PCI bus 0 slot 0/0: SiByte, Inc. BCM1250 PCI Host Bridge (host bridge, rev 0x02)
PCI bus 0 slot 1/0: SiByte, Inc. BCM1250 HyperTransport Host Bridge (host bridge, rev 0x02)
PCI bus 0 slot 6/0: unknown vendor 0x1317 product 0x0985 (ethernet network, rev 0x11)
PCI bus 0 slot 7/0: unknown vendor 0x1045 product 0xc861 (USB serial bus, interface 0x10, rev 0x10)
PCI bus 1 slot 1/0: Alliance Semiconductor SP1011 HyperTransport-PCI Bridge (PCI bridge)
PCI bus 2 slot 1/0: Intel product 0x1079 (ethernet network, rev 0x03)
PCI bus 2 slot 1/1: Intel product 0x1079 (ethernet network, rev 0x03)

5.4 Help

CFE> help
Available commands:

copydisk            Copy a remote disk image to a local disk device via TFTP
phy set             Set the value of a PHY register
phy dump            Dump the registers on the PHY
randmemtest         Tests memory using random access pattern
memorytest          Tests all available memory
test ether          Do an ethernet test, reading packets from the net
test fatfs          Do a FAT file system test
test disk           Do a disk test, read/write sectors on the disk
test timer          Test the timer
defeature           Set the state of the defeature mask
map pci             Define a BAR0 window available to PCI devices
cpu1                Controls a test program running on CPU1
set date            Set current date
set time            Set current time
set console         Change the active console device
sleep               Wait for some period of time
loop                Loop a command
memtest             Test memory.
pci dump            Dump PCI configuration space.
reserve             Mark a region of memory as reserved
autoboot            Automatic system bootstrap.
batch               Load a batch file into memory and execute it
save                Save a region of memory to a remote file via TFTP
ttcp                TCP test command.
tcp constest        tcp console test.
tcp listen          port listener.
tcp connect         TCP connection test.
rlogin              mini rlogin client.
ping                Ping a remote IP host.
arp                 Display or modify the ARP Table.
show boot           Display boot block from device,
show spd            Display contents of memory SPD
show temp           Display CPU temperature
show time           Display current time according to RTC
show agents         Display list of SOC agents
show soc            Display SOC register contents
show defeature      Show the state of the defeature mask
show pci            Display information about PCI buses and devices
show heap           Display information about CFE's heap
show memory         Display the system physical memory map.
unsetenv            Delete an environment variable.
......
......

For more information about a command, enter 'help command-name'
CFE> help show pci

  SUMMARY

     Display information about PCI buses and devices

  USAGE

     show pci [-v] [[port:]bus/dev/func]

     Displays information about PCI and LDT buses and devices in the
     system.  If you specify a bus/dev/func triplet, only that device
      will be displayed.

  OPTIONS

     -v           Display verbose information
     -init        Reinitialize and rescan the PCI bus

发表评论

7 + 7 = ?