Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4602663
  • 博文数量: 385
  • 博客积分: 21208
  • 博客等级: 上将
  • 技术积分: 4393
  • 用 户 组: 普通用户
  • 注册时间: 2006-09-30 13:40
文章分类

全部博文(385)

文章存档

2015年(1)

2014年(3)

2012年(16)

2011年(42)

2010年(1)

2009年(2)

2008年(34)

2007年(188)

2006年(110)

分类: LINUX

2007-01-12 20:52:01

  2410 uboot 移植笔记

主要参考了luofuchong 大侠

和bekars大侠
http://dev.csdn.net/article/84/84538.shtm
 
bekars大侠的很可能就是原创, 有时间再研究一下。

过程:
  下载 luofuchong 上面的链接里面的u-boot.是1.1.4的,打上他提供的补丁之后,在Makefile中指定 ARCH=arm,和
  CROSS_COMPILE=/opt/host/armv4l/bin/armv4l-unknown-linux-

  make smdk2410_config
  make
 
  出现了错误:
  /root/uboot/u-boot-1.1.4/include/asm/processor.h:52: parse error before `1'
/root/uboot/u-boot-1.1.4/include/asm/processor.h:52: warning: no semicolon at end of struct or union
/root/uboot/u-boot-1.1.4/include/asm/processor.h:54: parse error before `}'
/root/uboot/u-boot-1.1.4/include/asm/processor.h:58: field `insn' has incomplete type
 
google了一下,修改办法:


 以下是错误所指的文件的相关部分:
(每行前面是行号)
51: union debug_insn {
52: u32 arm;
53: u16 thumb;
54: };

56: struct debug_entry {
57: u32 address;
58: union debug_insn insn;
59: };

第一种:
感谢tpu的关注,将52行的arm改为arm1就可以了,可能是引用这个union的文件中用的是arm1,所以造成不一致,出错,^_^,真不知道这样的错误是怎么出的?

第二种:
 修改成: union debug_insn { u32 arm_mode; u16 thumb_mode; }

 
把生成的u-boot.bin烧到板子上去

 U-Boot 1.1.4 (Jun 29 2006 - 10:44:44)
U-Boot code: 33F80000 -> 33F9716C BSS: -> 33F9B2B8
RAM Configuration:
Bank #0: 30000000 64 MB
Flash: 2 MB
*** Warning - bad CRC, using default environment
In: serial
Out: serial
Err: serial
S3C2410 #


hujun2410=> go 0x30008000
## Starting application at 0x30008000 ...
undefined instruction
pc : [<33f0000c>]    lr : [<33f8601c>]
sp : 33f07cd8  ip : 0000107e  fp : 33f07ce4
r10: 33f07d0c  r9 : 00000000  r8 : 33f4ffdc
r7 : 33f07d10  r6 : 00000002  r5 : 00000000  r4 : 30008000
r3 : fc000000  r2 : 30008000  r1 : 000000c1  r0 : 00000000
Flags: Nzcv  IRQs off  FIQs off  Mode SVC_32
Resetting CPU ...

hujun2410=>tftp
出现很多ARP.... 忘了, 反正网卡cs8900 id 没有读出来

cs8900 id is 0x7ccc       //我加入调试语句,出来的
应该是0x630e


分析:
证明nand Flash 已经识别出来了,就是cs8900 的id 识别不正确, 应该是0x63e, 

我的板子用的nGCS2作片选, vivi里面定义CS8900_BASE=0x1100 0300 ,我的vivi可以用tftp下载,
本来想在vivi 里面找点线索,无奈做板子的提供的这个vivi 有些源码没有公开,(鄙视之。。。)
只有头文件。
 
nGCS2,2410 DATASHEET对应的地址是 0x1000 0000 ,

我把CS8900_BASE 设成0x1100 0300, 0x1000 0300  都试了, 都不行,
还有我看vivi里面有BWCON  寄存器的设置, 曾在2.6驱动中也在这个上面花了不少时间,但uboot里面没有,是否可以从这里入手解决呢?

郁闷了一阵子之后,查阅了bootloader的资料,又发现了lowlevel_init.S文件有
BWCON和BANKCON 的设置, 这时候再把别人的移植文档看了一下,在bekars的文档里发现了一点蛛丝马迹
进行如下修改:
    1:首先肯定CS8900_BASE(在include/configs/smdk2410.h)设成0x1100 0300 是对的。
    2:在lowlevel_init.S 里修改
    SMRDATA:
   /* .word (0+(B1_BWSCON<<4)+(B2_BWSCON<<8)+(B3_BWSCON<<12)+(B4_BWSCON<<16)+(B5_BWSCON<<20)+(B6_BWSCON<<24)+(B7_BWSCON<<28))*/
    .word  0x22111d10       //修改BWSCON,设置为0x22111d10
   
    .word ((B0_Tacs<<13)+(B0_Tcos<<11)+(B0_Tacc<<8)+(B0_Tcoh<<6)+(B0_Tah<<4)+(B0_Tacp<<2)+(B0_PMC))//nGCS0
   
    .word ((B1_Tacs<<13)+(B1_Tcos<<11)+(B1_Tacc<<8)+(B1_Tcoh<<6)+(B1_Tah<<4)+(B1_Tacp<<2)+(B1_PMC))//nGCS1
   
    /*.word ((B2_Tacs<<13)+(B2_Tcos<<11)+(B2_Tacc<<8)+(B2_Tcoh<<6)+(B2_Tah<<4)+(B2_Tacp<<2)+(B2_PMC))*/
        .word   0x1f7c   //修改BANKCON2,设置为0x22111d10
       
这两个值和硬件连接是相关的,必须根据自己的板子作出相应调整。 
关于这两个值怎么来的, 参见我的cs8900移植到2.6上的经历便知。试验证明是正确的。  


在成功之前 还调试了一次,因为我看vivi 中  BWSCON,设置为0x22111110, 而BANKCON2,设置为0x00000700
所以我照此设置,得到

U-Boot 1.1.4 (Jan 12 2007 - 18:11:19)
                                                                                         
U-Boot code: 33F80000 -> 33F9DA98  BSS: -> 33FA2108
RAM Configuration:
Bank #0: 30000000 64 MB
Nor Flash: 512 kB
Nand Flash:    64 MB
*** Warning - bad CRC or NAND, using default environment
                                                                                         
                                                                                         
In:    serial
Out:   serial
Err:   serial
id is 0x7c0e        //cs8900  id 仍然有问题。
hujun2410=> go 0x30000000
## Starting application at 0x30000000 ...




正确的uboot启动信息如下:

U-Boot 1.1.4 (Jan 12 2007 - 19:38:27)
                                                                                         
U-Boot code: 33F80000 -> 33F9DA98  BSS: -> 33FA2108
RAM Configuration:
Bank #0: 30000000 64 MB
Nor Flash: 512 kB
Nand Flash:    64 MB
                                                                                         
In:    serial
Out:   serial
Err:   serial
Hit any key to stop autoboot:  
按下空格键之后,
hujun2410=> ping  59.69.74.87(是我的host pc )
host is alive  说明cs8900正常工作了。


hujun2410=> nand read 30008000 30000 1d0000; go 30008000
                                                                                         
NAND read: device 0 offset 196608, size 1900544 ...  1900544 bytes read: OK
## Starting application at 0x30008000 ...
Uncompressing Linux.......................................................................Linux version 2.6.14 (root@hujunlinux) (gcc version 3.4.1) #9 Thu Jan 11 20:37:59 EST 2007CPU: ARM920Tid(wb) [41129200] revision 0 (ARMv4T)
Machine: SMDK2410
ATAG_INITRD is deprecated; please update your bootloader.
Memory policy: ECC disabled, Data cache writeback
CPU S3C2410A (id 0x32410002)
S3C2410: core 202.800 MHz, memory 101.400 MHz, peripheral 50.700 MHz
S3C2410 Clocks, (c) 2004 Simtec Electronics
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
CPU0: D VIVT write-back cache
CPU0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
CPU0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
Built 1 zonelists
Kernel command line: console=ttySAC0 root=/dev/nfs nfsroot=59.69.74.87:/public/root_nfs ifirq: clearing pending ext status 00000800
irq: clearing subpending status 00000002
PID hash table entries: 512 (order: 9, 8192 bytes)
timer tcon=00500000, tcnt a509, tcfg 00000200,00000000, usec 00001e4c
Console: colour dummy device 80x30
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 64MB = 64MB total
Memory: 62208KB available (2081K code, 462K data, 108K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
softlockup thread 0 started up.
NET: Registered protocol family 16
USB Control, (c) 2006 sbc2410
S3C2410: Initialising architecture
SCSI subsystem initialized
usbcore: registered new driver usbfs
usbcore: registered new driver hub
NetWinder Floating Point Emulator V0.97 (double precision)
devfs: 2004-01-31 Richard Gooch (rgooch@atnf.csiro.au)
devfs: devfs_debug: 0x0
devfs: boot_options: 0x1
Initializing Cryptographic API
s3c2410-lcd s3c2410-lcd: no platform data for lcd, cannot attach
s3c2410-lcd: probe of s3c2410-lcd failed with error -22
Console: switching to colour frame buffer device 80x25
fb0: Virtual frame buffer device, using 1024K of video memory
S3C2410 RTC, (c) 2004 Simtec Electronics
s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2410
s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2410
s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2410
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
nbd: registered device at major 43
usbcore: registered new driver ub
Cirrus Logic CS8900A driver for Linux (Modified for SMDK2410)
pSMDK2410_ETH_IO=0x11000000,vSMDK2410_ETH_IO=0xe0000000
eth0: CS8900A rev E at 0xe0000300 irq=52, no eeprom , addr: 08: 0:3E:26:0A:5B
NFTL driver: nftlcore.c $Revision: 1.97 $, nftlmount.c $Revision: 1.40 $
usbmon: debugfs is not available
s3c2410-ohci s3c2410-ohci: S3C24XX OHCI
s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1
s3c2410-ohci s3c2410-ohci: irq 42, io mem 0x49000000
usb usb1: Product: S3C24XX OHCI
usb usb1: Manufacturer: Linux 2.6.14 ohci_hcd
usb usb1: SerialNumber: s3c24xx
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
Initializing USB Mass Storage driver...
usbcore: registered new driver usb-storage
USB Mass Storage support registered.
mice: PS/2 mouse device common for all mice
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 4096 (order: 2, 16384 bytes)
TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
TCP reno registered
TCP bic registered
NET: Registered protocol family 1
IP-Config: Complete:
      device=eth0, addr=59.69.74.159, mask=255.0.0.0, gw=59.69.74.1,
     host=matrix4, domain=, nis-domain=arm9.net,
     bootserver=59.69.74.87, rootserver=59.69.74.87, rootpath=
Looking up port of RPC 100003/2 on 59.69.74.87
Looking up port of RPC 100005/1 on 59.69.74.87
VFS: Mounted root (nfs filesystem).
Mounted devfs on /dev
Freeing init memory: 108K
NETDEV WATCHDOG: eth0: transmit timed out
NETDEV WATCHDOG: eth0: transmit timed out
init started:  BusyBox v0.60.5 (2003.09.05-09:25+0000) multi-call binary
[01/Jan/1970:00:00:12 +0000] boa: server version Boa/0.94.13
[01/Jan/1970:00:00:12 +0000] boa: server built Feb 28 2004 at 21:47:23.
[01/Jan/1970:00:00:12 +0000] boa: starting server pid=710, port 80
NETDEV WATCHDOG: eth0: transmit timed out
NETDEV WATCHDOG: eth0: transmit timed out
                                                                                         
Please press Enter to activate this console.
                                                                                         
                                                                                         
BusyBox v0.60.5 (2003.09.05-09:25+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.
                                                                                         
我使用的是nfs做文件系统,
在uboot中
hujun2410=> setenv bootargs  console=ttySAC0 root=/dev/nfs nfsroot=59.69.74.87:/public/root_nfs ip=59.69.74.159:59.69.74.87:59.69.74.1:255.0.0.0:matrix4.arm9.net:eth0:off
hujun2410=> setenv bootcmd nand read 30008000 30000 1d0000\;go 30008000
hujun2410=> saveenv
Saving Environment to NAND...
Erasing Nand...Writing to Nand... done

这样就可以了。好了,现在按一下你的复位键就启动了。


参考资料:

uboot 英文手册
uboot-sourceForge
这个比较快
http://coosign.blogchina.com/1318487.html   uboot 中文手册
 
阅读(8429) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~