gdt-A20

导航

u-boot 2010.09 支持mini2440

     手头上只有mini2440的板子,移植也是针对它,感觉老了点,^.^!,本来uboot的版本想选定最新的,如2011.03等,但是uboot从2010年12月份的版本起,前面的初始化代码结构改动比较多,而且存在很多bug,尤其是开始搬运代码处的bug(没搬运代码就改变了全局变量,对norflash这是不可以的),开始琢磨着改,但是越到后来越发现,改就改回了旧式的结构,索性还不如用旧式结构的版本,因此移植的版本选定了旧式结构的最后一个版本2010.09。

    移植期间参考了Tekkaman Ninja 关于03版本的部分源代码,在此对其表示感谢!

          tekkamanninja.blog.chinaunix.net

 

 

    移植好后的uboot除了基本的norflash,nandflash,网卡功能外,还添加了i2c读写eeprom的测试,sd卡启动kernel等

         norflash型号:      SST39VF1601

      nandflash型号:      K9F2G08U0B

         eeprom型号:       AT24C08

               网卡型号:       DM9000

 

    移植好后的二进制下载链接如下:

 

          http://download.csdn.net/source/3297749

 

    针对I2C,以及SD卡的使用方法如下:

    1、I2C测试

         eeprom read addr off cnt

         eeprom write addr off cnt

         注:

             addr:内存地址

                off:eeprom的内的偏移地址

               cnt:要读取的大小

         例:

              [gdt-A20@MINI2440] ## md.b 0x34000000 4                               //读出0x34000000处4字节内存
              34000000: ec 73 ec 33    .s.3
              [gdt-A20@MINI2440] ## eeprom read 0x34000000 0 4                 //把eeprom便宜0处4字节读到0x34000000
                    EEPROM @0x50 read: addr 34000000  off 0000  count 4 ... have ack!! done
              [gdt-A20@MINI2440] ## md.b 0x34000000 4                              //再次打印0x34000000处内存
              34000000: 00 01 02 03    ....
              [gdt-A20@MINI2440] ## mm.b 0x34000000                               //修改0x34000000处内存
              34000000: 00 ? 7
                  34000001: 01 ? 7
                  34000002: 02 ? 7
                  34000003: 03 ? 7
                  34000004: ec ? q
                                                                       //q退出
              [gdt-A20@MINI2440] ## md.b 0x34000000 4                            //查看修改后内存             
              34000000: 07 07 07 07    ....
              [gdt-A20@MINI2440] ## eeprom write 0x34000000 0 4                //把刚才修改的0x34000000处内存写到eeprom
                    EEPROM @0x50 write: addr 34000000  off 0000  count 4 ... done
              [gdt-A20@MINI2440] ## md.b 0x36000000 4                            //查看另一地址0x36000000处内存       
              36000000: cc 33 cc 33    .3.3
              [gdt-A20@MINI2440] ## eeprom read 0x36000000 0 4                //这次把eeprom便宜0处4字节读到0x36000000
                    EEPROM @0x50 read: addr 36000000  off 0000  count 4 ... have ack!!done
              [gdt-A20@MINI2440] ## md.b 0x36000000 4                            //再次查看地址0x36000000处内存
              36000000: 07 07 07 07    ....

    2、sd卡测试

              我的是micro sd + sd适配器首先把sd卡格式化成fat32格式,然后放入内核镜像zImage.img

              首先介绍一下接下来要用到的sd相关一条命令

              fatload <interface> <dev[:part]> <addr> <filename> <bytes>

               interface:所用到接口,如:MMC、USB

               dev [:part]: 文件存放的设备 如:ide 0:1   

                         addr: 装载到内存的开始地址   

                         filename: 装载的文件名称   

                         bytes: copy的字节数

             好了,下面开始测试:

             [gdt-A20@MINI2440] ## mmc init                                                //sd卡设备信息测试
             mmc: Probing for SDHC ...
                mmc: SD 2.0 or later card found
                trying to detect SD Card...
                Manufacturer:       0x11, OEM "D?
                Product name:       "SD256", revision 2.0
                Serial number:      2801825483
                Manufacturing date: 9/2008
                CRC:                0x3b, b0 = 1
                READ_BL_LEN=15, C_SIZE_MULT=1, C_SIZE=3971
                size = 2344615936
                SD Card detected RCA: 0x7 type: SD
                mmc1 is available

 

             [gdt-A20@MINI2440] ## fatload mmc 0:1 0x30008040 zImage.img       //读取内核镜像到内存0x30008040
             reading zImage.img

                2147816 bytes read

             [gdt-A20@MINI2440] ## bootm 0x30008040                                 //跳转到内存0x30008040执行
             ## Booting kernel from Legacy Image at 30008040 ...
                   Image Name:   antony!#####
                   Created:      2011-04-19   5:53:12 UTC
                   Image Type:   ARM Linux Kernel Image (uncompressed)
                   Data Size:    2147752 Bytes = 2 MiB
                   Load Address: 30008000
                   Entry Point:  30008040
                   Verifying Checksum ... OK
                   Loading Kernel Image ... OK
               OK

              Starting kernel ...

 

      网上关于基本的uboot功能移植的文章很多,但关于诸如i2c,sd的很少,再有大多文章基于移植,而没有具体分析源码,准备在后面几篇博文中详细分析下诸如nandflash,i2c,sd,lcd部分的源码,也好再让自己加深一下印象  ^.^


 

posted on 2011-05-20 22:03  gdt-A20  阅读(719)  评论(0编辑  收藏  举报