移植U-Boot-2008.10到友善之臂mini2440(七 完)

U-Boot移植支持S3C2410和S3C2440处理器
本文详细介绍了如何将U-Boot代码修改为同时支持S3C2410和S3C2440处理器,包括修改文件、头文件引用、函数调用等关键步骤。移植后,U-Boot在嵌入式系统中运行良好,实现了NandFlash和NorFlash启动。


1.2.14 搜索以下文件,把支持S3C2410的宏定义改成同时支持S3C2410和S3C2440


(1) 文件 u-boot-2008.10/cpu/arm920t/s3c24x0/i2c.c :

 #include <s3c2400.h>

//#elif defined(CONFIG_S3C2410)

#elif defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440)

#include <s3c2410.h>

 ......

        S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();

//#ifdef CONFIG_S3C2410

#if defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440)

        return (gpio->GPEDAT & 0x8000) >> 15;

 ......

        S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();

//#ifdef CONFIG_S3C2410

#if defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440)

        gpio->GPEDAT = (gpio->GPEDAT & ~0x4000) | (x&1) << 14;

 #endif

 ......

        if ((status & I2CSTAT_BSY) || GetI2CSDA () == 0) {

//#ifdef CONFIG_S3C2410

#if defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440)

               ulong old_gpecon = gpio->GPECON;

 #endif

 ......

             /* bus still busy probably by (most) previously interrupted transfer */

//#ifdef CONFIG_S3C2410

#if defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440)

               /* set I2CSDA and I2CSCL (GPE15, GPE14) to GPIO */

 ......

               /* restore pin functions */

//#ifdef CONFIG_S3C2410

#if defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440)

               gpio->GPECON = old_gpecon;

 #endif

 

(2)文件u-boot-2008.10/cpu/arm920t/s3c24x0/serial.c :

  #include <common.h>

//#if defined(CONFIG_S3C2400) || defined (CONFIG_S3C2410) || defined (CONFIG_TRAB)

#if defined(CONFIG_S3C2400) || defined (CONFIG_S3C2410) || defined (CONFIG_TRAB) || defined(CONFIG_S3C2440)

 

 #if defined(CONFIG_S3C2400) || defined(CONFIG_TRAB)

 #include <s3c2400.h>

//#elif defined(CONFIG_S3C2410)

#elif defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440)

#include <s3c2410.h>

 #endif

 

(3) 以下三个文件的修改相同:

u-boot-2008.10/cpu/arm920t/s3c24x0/usb.c u-boot-2008.10/cpu/arm920t/s3c24x0/usb_ohci.c u-boot-2008.10/drivers/rtc/s3c24x0_rtc.c

 

修改头文件的引用:

 #if defined(CONFIG_S3C2400)

 # include <s3c2400.h>

//#elif defined(CONFIG_S3C2410)

#elif defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440)

# include <s3c2410.h>

 #endif

 

(4)文件u-boot-2008.10/include/common.h :

 

ulong  get_OPB_freq (void);

 ulong  get_PCI_freq (void);

 #endif

//#if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410) || \

        //defined(CONFIG_LH7A40X) || defined(CONFIG_S3C6400)

 #if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410) || \

        defined(CONFIG_LH7A40X) || defined(CONFIG_S3C6400) || defined(CONFIG_S3C2440)

void    s3c2410_irq(void);

 #define ARM920_IRQ_CALLBACK s3c2410_irq

 ulong  get_FCLK (void);

 

(5) 文件u-boot-2008.10/include/s3c24x0.h :

        S3C24X0_REG32  PRIORITY;

        S3C24X0_REG32  INTPND;

        S3C24X0_REG32  INTOFFSET;

//#ifdef CONFIG_S3C2410

#if defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440)

        S3C24X0_REG32  SUBSRCPND;

        S3C24X0_REG32  INTSUBMSK;

 #endif

……

 /* DMAS (see manual chapter 8) */

 typedef struct {

        S3C24X0_REG32  DISRC;

//#ifdef CONFIG_S3C2410

#if defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440)

        S3C24X0_REG32  DISRCC;

 #endif

        S3C24X0_REG32  DIDST;

//#ifdef CONFIG_S3C2410

#if defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440)

        S3C24X0_REG32  DIDSTC;

 #endif

        S3C24X0_REG32  DCON;

……

 #ifdef CONFIG_S3C2400

        S3C24X0_REG32  res[1];

 #endif

//#ifdef CONFIG_S3C2410

#if defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440)

        S3C24X0_REG32  res[7];

 #endif

 } /*__attribute__((__packed__))*/ S3C24X0_DMA;

……

        S3C24X0_REG32  CLKCON;

        S3C24X0_REG32  CLKSLOW;

        S3C24X0_REG32  CLKDIVN;

 

#if defined (CONFIG_S3C2440)

        S3C24X0_REG32 CAMDIVN;

#endif

 } /*__attribute__((__packed__))*/ S3C24X0_CLOCK_POWER;

 ……

        S3C24X0_REG32  res[8];

        S3C24X0_REG32  DITHMODE;

        S3C24X0_REG32  TPAL;

//#ifdef CONFIG_S3C2410

#if defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440)

        S3C24X0_REG32  LCDINTPND;

        S3C24X0_REG32  LCDSRCPND;

        S3C24X0_REG32  LCDINTMSK;

……

        S3C24X0_REG32  MISCCR;

        S3C24X0_REG32  EXTINT;

 #endif

//#ifdef CONFIG_S3C2410

#if defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440)

        S3C24X0_REG32  GPACON;

        S3C24X0_REG32  GPADAT;

        S3C24X0_REG32  res1[2];

 

 

    移植成功后,U-BOOT在嵌入式系统中运行良好。同时支持 Nand Flash 和 Nor Flash 启动(仍需改进)。

附:U-Boot各个版本的下载地址 ftp://ftp.denx.de/pub/u-boot/

 

参考博文:

http://blog.youkuaiyun.com/hugerat/archive/2009/01/21/3847025.aspx

http://expowinzax.blog.163.com/blog/static/12408013200922222038567/

http://blog.chinaunix.net/u1/34474/showart.php?id=1808274

 

    非常感谢以上文章的帮助!

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值