第一次移植uboot(1)

第一次移植uboot,因此把移植步骤记录下来:

/*2010.11.17--2010.11.18*/
/*u-boot-1.1.4中smdk2410到fl2440(s3c2440)移植*/
交叉编绎工具:cross-3.3.2.tar.bz2
默认当前目录为:u-boot-1.1.4
要修改的文件:(1)examples/Makefile (2)Makefile (3)board/fl2440
(4)board/fl2440/fl2440.c (5)board/fl2440/Makefile
(6)include/configs/fl2440.h (7)cpu/arm920t/start.S
(8)include/configs/fl2440.h (8)include/s3c24x0.h
(9)include/s3c2440.h (10)cpu/arm920t/s3c24x0/interrupts.c
(11)cpu/arm920t/s3c24x0/speed.c (12)cpu/arm920t/s3c24x0/serial.c
(13)board/fl2440/fl2440.c (14)cpu/arm920t/s3c24x0/speed.c
(15)include/s3c24x0.h

 

1. 修改examples/Makefile
   126 %.srec:% -> %.srec:%.o
   129 %.bin:%  -> %.bin:%.o
   不修改的话smdk2410编绎不通过
2. Makefile下依照smdk2410_config添加:
   fl2440_config :
        @./mkconfig $(@:_config=) arm arm920t fl2440 NULL s3c24x0
3. cp -r board/smdk2410 board/fl2440
4. mv board/fl2440/smdk2410.c board/fl2440/fl2440.c
5. 修改board/fl2440/Makefile第28行:
   OBJS    := smdk2410.o flash.o -> OBJS    := fl2440.o flash.o
6. cp include/configs/smdk2410.h include/configs/fl2440.h

   到此fl2440可以编译通过

7. 修改cpu/arm920t/start.S
   <1>128行(# define CLKDIVN        0x4C000014)后加:

 
   <2>修改143行为:
#if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440)
   <3>158行(# endif)后加:

 
   <4>169行(str     r1, [r0])后加:

 
   <5>因为从NAND FLASH(k9f2g08u0a)起动uboot,所以197行到201行(即

copy_loop循环)改为:
 
   start.S修改完

8. 修改include/configs/fl2440.h
   <1>37行#define CONFIG_S3C2410          1
      改为:#define CONFIG_S3C2440          1

   此时编译fl2440,报错board_init函数中S3C24X0_GPIO未定义

9. 修改include/s3c24x0.h
   453行(#endif)后加:

 
   此时编译fl2440,报错s3c24x0_rtc.c中SetRTC_Access函数中S3C24X0_RTC未定

9. cp include/s3c2410.h include/s3c2440.h
   <1>修改include/s3c2440.h
      31行:#ifndef __S3C2410_H__
      改为:#ifndef __S3C2440_H__
      32行:#define __S3C2410_H__
      改为:#define __S3C2440_H__
   <2>修改rtc/s3c24x0_rtc.c
      36行(#include <s3c2410.h>)后加:
#elif defined(CONFIG_S3C2440)
#include <s3c2440.h>

   此时编译fl2440,报错:u-boot-1.1.4/cpu/arm920t/interrupts.c:80: undefined reference to `reset_cpu'

10. 修改cpu/arm920t/s3c24x0/interrupts.c
   <1>33行(#if defined(CONFIG_S3C2400) || defined (CONFIG_S3C2410) || defined (CONFIG_TRAB))
      改为:#if defined(CONFIG_S3C2400) || defined (CONFIG_S3C2410) || defined (CONFIG_TRAB) || defined(CONFIG_S3C2440)
   <2>39行(#include <s3c2410.h>)后加:
#elif defined(CONFIG_S3C2440)
#include <s3c2440.h>

    此时编译fl2440,报错:u-boot-1.1.4/cpu/arm920t/s3c24x0/interrupts.c:71: undefined reference to

`get_PCLK'

11. 修改cpu/arm920t/s3c24x0/speed.c
    <1>33行(#if defined(CONFIG_S3C2400) || defined (CONFIG_S3C2410) || defined (CONFIG_TRAB))
      改为:#if defined(CONFIG_S3C2400) || defined (CONFIG_S3C2410) || defined (CONFIG_TRAB) || defined(CONFIG_S3C2440)
    <2>38行(#include <s3c2410.h>)后加:
#elif defined(CONFIG_S3C2440)
#include <s3c2440.h>

    此时编译fl2440,报错:u-boot-1.1.4/lib_arm/board.c:79: undefined reference to `serial_init'

12. 修改cpu/arm920t/s3c24x0/serial.c
    <1>22行(#if defined(CONFIG_S3C2400) || defined (CONFIG_S3C2410) || defined (CONFIG_TRAB))
      改为:#if defined(CONFIG_S3C2400) || defined (CONFIG_S3C2410) || defined (CONFIG_TRAB) || defined(CONFIG_S3C2440)
    <2>27行(#include <s3c2410.h>)后加:
#elif defined(CONFIG_S3C2440)
#include <s3c2440.h>

    此时编译fl2440成功!
    此时用H-FLASHER把u-boot.bin烧入NAND FLASH程序可运行,但因时钟问题串

口输出乱码!
  
13. 修改board/fl2440/fl2440.c
    <1>33行(#define FCLK_SPEED 1)改为:
#define FCLK_SPEED 2
    <2>42行(#define M_SDIV  0x1)后加:
#elif FCLK_SPEED==2             /* Fout = 400MHz */
#define M_MDIV  0x5c
#define M_PDIV  0x1
#define M_SDIV  0x1
    <3>49行(#define USB_CLOCK 1)改为:
#define USB_CLOCK 2
    <4>58行(#define U_M_SDIV        0x2)后加:
#elif USB_CLOCK==2
#define U_M_MDIV        0x38
#define U_M_PDIV        0x2
#define U_M_SDIV        0x2

14. 修改cpu/arm920t/s3c24x0/speed.c
   <1>72行(return((CONFIG_SYS_CLK_FREQ * m) / (p << s));)改为:

 
   <2>90行(return((clk_power->CLKDIVN & 0x2) ? get_FCLK()/2 : get_FCLK

());)改为:


15. 修改include/s3c24x0.h中S3C24X0_CLOCK_POWER结构体为:
   typedef struct {
        S3C24X0_REG32   LOCKTIME;
        S3C24X0_REG32   MPLLCON;
        S3C24X0_REG32   UPLLCON;
        S3C24X0_REG32   CLKCON;
        S3C24X0_REG32   CLKSLOW;
        S3C24X0_REG32   CLKDIVN;
#ifdef CONFIG_S3C2440
        S3C24X0_REG32   CAMDIVN;
#endif
} /*__attribute__((__packed__))*/ S3C24X0_CLOCK_POWER;

   此时编译运行uboot,串口即可正常输出并显示!
   (修改include/configs/fl2440.h中宏#define CFG_PROMPT "SMDK2410 # "为

#define CFG_PROMPT "FL2440 # ")

 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值