l 初始化PCI
#if defined(CONFIG_PCI)&&!defined(CONFIG_BAB7xx) &&
!defined(CONFIG_CPC45)
pci_init ();
#endif
这里需要注意,由于我们没有定义CONFIG_PCI_PNP,因此必须提供初始配置表,位置在\board\user8240\user8240.c,这里只提供一个网口芯片的配置,其他PCI
初始化将交给操作系统映像完成。其中0x0f 是该芯片的pci device 号,在0~31 之间,必须与硬件相符,否则不能正确配置。
static struct pci_config_table pci_sandpoint_config_table[] =
{
{ PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x0f, PCI_ANY_ID,
pci_cfgfunc_config_device, { PCI_ENET0_IOADDR,PCI_ENET0_MEMADDR,
PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER }},
{ }
};
使用初始配置表可以使u-boot 不必要搜索所有PCI 器件,减小u-boot 大小,加快启动速度。
l 允许中断
interrupt_init (); /*参考\lib_ppc\interrupts.c*/
l 初始化网口芯片
#if (CONFIG_COMMANDS & CFG_CMD_NET)
#if defined(CONFIG_NET_MULTI)
WATCHDOG_RESET ();
puts ("Net: ");
#endif
eth_initialize (bd); /*参考\net\eth.c*/
#endif
相关的宏定义有:CONFIG_EEPRO100、CFG_RX_ETH_BUFFER、PCI_ENET0_IOADDR 和PCI_ENET0_MEMADDR。
最后程序进入main_loop()函数(\common\main.c),根据宏CONFIG_BOOTCOMMAND定义的启动方式获取操作系统映像,或者在控制台下选择其他启动方式。
4.5 u-boot 控制台命令和启动方式
当u-boot 的控制台串口打印出“Hit any key to stop autoboot:”后,按下任意键进入人工控制模式,在提示符“=>”后键入help
或者?,可以得到命令提示:
=> 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)
pci - list and access PCI Configuration Space
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
键入help [命令]可以得到具体的命令格式帮助,例如:
=> help setenv
setenv name value ...
- set environment variable 'name' to 'value ...'
setenv name
- delete environment variable 'name'
如果已经按照4.3 那样设置了user8240.h 中的宏定义CONFIG_PREBOOT 、 CONFIG_EXTRA_ENV_SETTINGS
和CONFIG_BOOTCOMMAND,那么将电路板网口与PC 机对接(或者都挂在HUB 上),在Windows 下设置网口IP
为192.0.0.2,打开一个tftp的server(Tornado 安装目录\ host\x86-win32\bin\Tftpd32.exe
即可),设置如下:
1
2
3
4
5
6
7
8
9
10
11 |