关键词:U-Boot; 移植; arm926ejs; SPEAr310
SPEAr3xx是ST ARM926EJ-S核,集成丰富外设的MPU,其针对Ethernet运用的型号为SPEAr310,功能列表如下:
Main Features
The following main functionalities are implemented in SPEAr310 embedded MPU device :
● ARM926EJ-S core @333 MHz, 16+16 KB-I/D cache, configurable TCM-I/D size, MMU,
TLB, JTAG and ETM trace module (multiplexed interfaces).
● Dynamic power saving features.
● High performance linked list 8-channel DMA.
● Multi-port memory controller: 8/16 bit mobileDDR@166 MHz or DDR2@333 MHz.
● 2 x USB2.0 Host (High-Full-Low speed); integrated PHY transceiver.
● USB2.0 Device (High-Full-Low speed); integrated PHY transceiver.
● Ethernet 10/100 MAC with MII Interface (IEEE-802.3)
● I2C (High-Fast-Low speed) Master/Slave.
● Cryptographic co-processor (C3)
● IrDA controller with a data rate from 9.6 Kbps to 4 Mbps.
● Touchscreen support (using ADC).
● RTC - WDT - SYSCTR - MISC internal control registers.
● ADC (1us/1MSPS) 8 analog input channels; 10 bit resolution.
● JPEG codec accelerator single clock per pixel encoding decoding.
● 6 x 16 bits general purpose Timers with programmable prescaler (only 4 timers with
capture mode).
● 32KB ROM & up to 8 KB internal SRAM
● Flexible static memory controller (FSMC) up to 16-bit data bus width, supporting NAND
Flash
● 6 x UARTs (UART0 baud rate upto 3 Mbps, UART1..5 baud rate up to 5 Mbps)
● External Memory Interface (EMI) with 8/16 / 32 bit NOR Flash interface feature
● 4 x Ethernet MAC 10/100 Mbps (SMII PHY interface).
● 1 x SSP Master/Slave (Motorola SPI-Texas-National) up to 40 Mbps.
● TDM/E1 HDLC 128 bits 8 Mbps(TDM) / 32bits 2 Mbps (E1)
● 2 x RS485 HDLC 3.88 Mbps.
● Boundary scan.
● JTAG (IEEE1149.1) interface.
● ETM9 interface and Embedded ICE-RT
● Possible NAND Flash booting
● Up to 102 GPIOs with interrupt capability.
官方手册:http://www.denx.de/wiki/DULG/Manual;
源码:ftp://ftp.denx.de/pub/u-boot/;
硬件由宿主机、目标板和调试器组成。宿主机需要建立嵌入式Linux开发环境,包括安装linux系统;安装交叉开发工具链(cross-develop-tools,其中cross-compiler-tools要与目标CPU类型一致);宿主机网络等参数配置。
通常宿主机的linux系统在Window下的VmWare虚拟机安装运行,常用的PC linuxOS为Fedora和ubuntu。
注意:linuxOS要用完整版本安装,一定要选择所有开发组件。
Fedora:http://fedoraproject.org/zh_CN/get-fedora-all;(i386 - 安装DVD)
通过boot-mode管脚选择从PNor/SNor/Nand Flash或USB启动,我简述Snor Flash启动。
ROM:SNor Flash,start-addr=0xf8000000,size=8MB/16MB;
RAM:DDR2,start-addr=0x0,size=64MB/128MB;
上电后启动流程
step1:
0xFFFF0000: BootROM
BootROM initializes SMI or NOR Flash or USB device port for update.
Load Xloader to internal RAM and jump to its entry.
step2:
0xD2800B00: XLoader
Xloader initializes PLLs and DDR.
Load U-Boot to external RAM and jump to its entry.
step3:
LoadAddr: U-Boot
U-Boot initializes Ethernet and other peripherals, also run a monitor.
Load Linux Kernel to DDR and jump to
step4:
run Linux Kernel
执行文件在ROM中的位置:
BootROM固化在MPU内部不可修改;XLoader.bin存放于SNor Flash Sector0(0xF8000000~0xF800FFFF),由BootROM加载于RAM 0xD2800000,Entry=0xD2800B00;
XLoader初始化Flash,DDR,加载bootloader,跳转执行;可编码实现加载U-boot或 Vx的BootRom;
u-boot.img存放于SNor Flash Sector1-4(0xF8010000~0xF803FFFF),由XLoader加载至RAM运行;
WindowsXP,VMware7.1.0+Fedora11(推荐Fedora12),PC内存2G以上,否则太慢;
VMware网络连接为bridges模式;
可从ST 获取开发包,开发包包含Xloader、u-boot、linux kernel源代码和所需交叉开发工具。安装ST 开发包至指定目录即可.
开发包安装
1、下载软件包
ftp://www.stlinux.com/pub/stlinux/2.3/iso/STLinux-2.3-spear-20100601.iso
user: anonymous
2、挂载ISO文件
将文件STLinux-2.3-spear-20100601.iso挂载至/media/cdrom:
# mount -o loop,ro -t iso9660 -r /home/hsy/ STLinux-2.3-spear-20100601.iso /media/cdrom
3、安装
以root用户安装
# cd /media/cdrom
# chmod +x intall
# ./install all-arm-spear
Spear开发包安装至/opt/STM/STLinux-2.3
4、u-boot for spear源代码
xloader路径:/opt/STM/STLinux-2.3/devkit/sources/xloader-spear
u-boot路径:/opt/STM/STLinux-2.3/devkit/sources/u-boot
kernel路径:/opt/STM/STLinux-2.3/devkit/sources/kernel
rootfs路径:/opt/STM/STLinux-2.3/devkit/sources/rootfs-2.1
在local目录下建立符号连接,方便操作,如’st-xloader-rc’指向xloader-spear的项目目录’:
# ln -s /opt/STM/STLinux-2.3/devkit/sources/xloader-spear/xloader-arm-spear-rc st-xloader-rc
5、交叉编译器
位于/opt/STM/STLinux-2.3/devkit/arm/bin
需要在主机上对环境变量进行设置,命令如下:
# export PATH=$PATH:.:/opt/STM/STLinux-2.3/devkit/arm/bin
# export CROSS_COMPILE=arm-linux
6、编译连接
进入xloader for spear根目录:
# cd /opt/STM/STLinux-2.3/devkit/sources/xloader-arm-spear/
make命令,生成适用于SPEAr310的xloader_image.bin(带有elf头):
# make clean
# make SOC=SPR310 DDRFREQ=333 DDRSIZE=128M
进入u-boot for spear根目录:
# cd /opt/STM/STLinux-2.3/devkit/sources/u-boot/u-boot-arm-spear-1.3.1_stm23_005
make命令,生成ROM为SNOR Flash的u-boot执行文件:
# make mrproper; make spear310_config; make ENV=SNOR FLASH=SNOR