u-boot-2011.06在基于s3c2440开发板的移植之编译配置


在这篇文章的基础上,本文详细介绍u-boot-2011.06的NorFlash启动移植方法。

相关阅读:

U-Boot源代码下载地址

U-Boot-2011.06启动流程分析

u-boot-2011.06在基于s3c2440开发板的移植之编译配置

u-boot-2011.06在基于s3c2440开发板的移植之NorFlash启动

u-boot-2011.06在基于S3C2440开发板的移植之解决raise: Signal # 8 caught

u-boot-2011.06在基于s3c2440开发板的移植之支持NandFlash读写

u-boot-2011.06在基于s3c2440开发板的移植之硬件ECC

1.修改宏定义

打开include/configs/zhaocj2440.h文件

第38行“#define CONFIG_S3C2410        /*specifically a SAMSUNG S3C2410SoC */”改为:

38:#define CONFIG_S3C2440          /* specifically a SAMSUNG S3C2440 SoC */

目的是告之系统本开发板使用的是S3C2440处理器。

 

第131行“#define CONFIG_SYS_PROMPT     "SMDK2410 # "”改为:

131:#define CONFIG_SYS_PROMPT      "ZHAOCJ2440# "

目的是使命令行提示符显示为“ZHAOCJ2440# ”。

 

第185行“#define CONFIG_FLASH_CFI_LEGACY”改为:

185:#define CONFIG_SYS_CFI_FLASH_CONFIG_REGS    {0xFFFF}

因为在u-boot-2011.06中,使用的是CFI的NorFlash接口,所以不需要定义CONFIG_FLASH_CFI_LEGACY,而是要定义CONFIG_SYS_CFI_FLASH_CONFIG_REGS。

 

第191行“#define CONFIG_SYS_MAX_FLASH_SECT (19)”改为:

191:#define CONFIG_SYS_MAX_FLASH_SECT   (35)

因为本开发板使用的NorFlash是EN29LV160AB,它有35个扇区。

 

第212行“#define CONFIG_NAND_S3C2410”改为:

212:#define CONFIG_NAND_S3C2440

 

第213行“#define CONFIG_SYS_S3C2410_NAND_HWECC”改为:

213:#define CONFIG_SYS_S3C2440_NAND_HWECC

 

2.修改系统时钟频率

打开arch/arm/cpu/arm920t/start.s文件

第164行“# if defined(CONFIG_S3C2410)”改为:

164:# if defined(CONFIG_S3C2440)

 

第165行“ldr       r1, =0x3ff”改为:

165:ldr r1, =0x7fff

目的是屏蔽所有子中断。

 

第173行“mov     r1, #3”改为:

173:mov      r1, #5

目的是使FCLK:HCLK:PCLK= 1:4:8。

 

打开board/samsung/zhaocj2440/zhaocj2440.c文件

第42行至第44行的内容改为:

42:#define M_MDIV   92

43:#define M_PDIV    1

44:#define M_SDIV    1

本开发板的输入晶振频率为12MHz,通过上面的修改,则MPLL频率为400MHz。

 

第54行至第56行的内容改为:

54:#define U_M_MDIV     56

55:#define U_M_PDIV      2

56:#define U_M_SDIV      2

通过上面的修改,则UPLL频率为48MHz。

 

3.修改内存SDRAM时序

打开board/samsung/zhaocj2440/lowlevel_init.s文件

第54行至第126行的内容改为:

54:#define B1_BWSCON          (DW16)

55:#define B2_BWSCON          (DW16)

56:#define B3_BWSCON          (DW16)

57:#define B4_BWSCON          (DW32)

58:#define B5_BWSCON          (DW16)

59:#define B6_BWSCON          (DW32)

60:#define B7_BWSCON          (DW32)

61:

62:/* BANK0CON */

63:#define B0_Tacs                   0x3

64:#define B0_Tcos                   0x3

65:#define B0_Tacc                   0x7

66:#define B0_Tcoh                  0x3

67:#define B0_Tah                    0x3

68:#define B0_Tacp                  0x1

69:#define B0_PMC                  0x0

70:

71:/* BANK1CON */

72:#define B1_Tacs                   0x1

73:#define B1_Tcos                   0x1

74:#define B1_Tacc                   0x6

75:#define B1_Tcoh                  0x1

76:#define B1_Tah                    0x1

77:#define B1_Tacp                  0x0

78:#define B1_PMC                  0x0

79:

80:#define B2_Tacs                   0x1

81:#define B2_Tcos                   0x1

82:#define B2_Tacc                   0x6

83:#define B2_Tcoh                  0x1

84:#define B2_Tah                    0x1

85:#define B2_Tacp                  0x0

86:#define B2_PMC                  0x0

87:

88:#define B3_Tacs                   0x1

89:#define B3_Tcos                   0x1

90:#define B3_Tacc                   0x6

91:#define B3_Tcoh                  0x1

92:#define B3_Tah                    0x1

93:#define B3_Tacp                  0x0

94:#define B3_PMC                  0x0

95:

96:#define B4_Tacs                   0x1

97:#define B4_Tcos                   0x1

98:#define B4_Tacc                   0x6

99:#define B4_Tcoh                  0x1

100:#define B4_Tah                  0x1

101:#define B4_Tacp                 0x0

102:#define B4_PMC                0x0

103:

104:#define B5_Tacs                 0x1

105:#define B5_Tcos                 0x1

106:#define B5_Tacc                 0x6

107:#define B5_Tcoh                0x1

108:#define B5_Tah                  0x1

109:#define B5_Tacp                 0x0

110:#define B5_PMC                0x0

111:

112:#define B6_MT                  0x3

113:#define B6_Trcd                 0x1

114:#define B6_SCAN                     0x1

115:

116:#define B7_MT                  0x3

117:#define B7_Trcd                 0x1

118:#define B7_SCAN                     0x1

119:

120:/* REFRESH parameter */

121:#define REFEN                  0x1

122:#define TREFMD               0x0

123:#define Trp                 0x1

124:#define Trc                 0x1

125:#define Tchr                0x2

126:#define REFCNT                1268

 

4.修改NandFlash相关内容。

尽管本次移植没有涉及到NandFlash,但为了能够编译成功,必须修改下面有关NandFlash的内容。

 

进入u-boot-2011.06目录,执行下列命令:

cp drivers/mtd/nand/s3c2410_nand.c drivers/mtd/nand/s3c2440_nand.c

打开drivers/mtd/nand/s3c2440_nand.c文件,把该文件内的所有有关“2410”的地方一律改为“2440”。

再打开drivers/mtd/nand/Makefile文件

第48行“COBJS-$(CONFIG_NAND_S3C2410) += s3c2410_nand.o”改为

48:COBJS-$(CONFIG_NAND_S3C2440) += s3c2440_nand.o

 

编译u-boot,把编译生成的新的u-boot.bin烧写到NorFlash中。开发板上电启动后,则在超级终端(或类似的软件)中显示的结果为:

 

U-Boot 2011.06 (Jul 30 2011 - 23:40:44)

 

DRAM: 64 MiB

Flash: 2 MiB

NAND: raise: Signal # 8 caught

raise: Signal # 8 caught

raise: Signal # 8 caught

raise: Signal # 8 caught

raise: Signal # 8 caught

raise: Signal # 8 caught

No NAND device found!!!

0 MiB

*** Warning - bad CRC, using defaultenvironment

 

In:   serial

Out:  serial

Err:  serial

Net:  CS8900-0

ZHAOCJ2440 #

 

从上述显示的内容可以看出本开发板的一些基本的信息,如DRAM为64M,NorFlash为2M,由于我没有设置NandFlash,因此系统没有检测到NandFlash,命令提示符也已经修改为“ZHAOCJ2440 # ”。

 

在提示符下输入flinfo,则会把NorFlash的更详细的信息显示出来:

 

Bank # 1: CFI conformant flash (16 x16)  Size: 2 MB in 35 Sectors

  AMDStandard command set, Manufacturer ID: 0x1C,Device ID: 0x2249

 Erase timeout: 16384 ms, write timeout: 1 ms

 

 Sector Start Addresses:

 00000000   RO   00004000  RO   00006000   RO  00008000   RO   00010000  RO

 

 00020000   RO   00030000  RO   00040000   RO  00050000   RO   00060000  RO

 

 00070000   RO   00080000        00090000        000A0000        000B0000

 

  000C0000        000D0000        000E0000        000F0000        00100000

 

 00110000        00120000        00130000        00140000        00150000

 

 00160000        00170000        00180000        00190000        001A0000

 

 001B0000        001C0000        001D0000        001E0000        001F0000

相关内容