上一節(jié)S3C2440移植uboot之啟動(dòng)過(guò)程概述我們我們分析了uboot啟動(dòng)流程,這節(jié)將開(kāi)始新建一塊單板支持S3C2440。 目錄 1.新建單板1.1 將2410的單板文件夾拷貝成2440:cd /work/system/u-boot-2012.04.01/board/samsung cp smdk2410 smdk2440 -rf 1.2 將2410的頭文件拷貝成2440cd ../../include/configs/ cp smdk2410.h smdk2440.h
2.修改boards.cfg,使uboot支持2440單板:仿照 smdk2410 arm arm920t - samsung s3c24x0 添加: smdk2440 arm arm920t - samsung s3c24x0
3.修改uboot系統(tǒng)時(shí)鐘??從start.s開(kāi)始分析啟動(dòng)過(guò)程,閱讀代碼發(fā)現(xiàn)不足:UBOOT里先以60MHZ的時(shí)鐘計(jì)算參數(shù)來(lái)設(shè)置內(nèi)存控制器,但是MPLL還未設(shè)置 4.燒寫(xiě)修改后的uboot??燒寫(xiě)測(cè)試時(shí),由于新的uboot較大,可以使用nor上的舊uboot,通過(guò)DNW燒寫(xiě)新的uboot到nor上面. usb 1 30000000 //使用usb下載到SDRAM上,1表示一直下載,直到完成 //然后打開(kāi)DNW,傳輸新的uboot.bin給usb protect off all //關(guān)閉nor的寫(xiě)保護(hù) erase 0 +7FFFF //擦除nor上的 0~7FFFF地址內(nèi)容, (512k*1024-1)=+7FFF=擦除長(zhǎng)度=512kb,要大于新的uboot.bin才行 cp.b 30000000 0 80000 //將SDRAM上的新的uboot.bin,拷貝到nor上(燒寫(xiě)512K)
#define S3C2440_MPLL_400MHZ ((0x5c<<12)|(0x01<<4)|(0x01)) /* 2. 設(shè)置時(shí)鐘 */ ldr r0, =0x4c000014 // mov r1, #0x03; // FCLK:HCLK:PCLK=1:2:4, HDIVN=1,PDIVN=1 mov r1, #0x05; // FCLK:HCLK:PCLK=1:4:8 str r1, [r0] /* 如果HDIVN非0,CPU的總線(xiàn)模式應(yīng)該從“fast bus mode”變?yōu)椤癮synchronous bus mode” */ mrc p15, 0, r1, c1, c0, 0 /* 讀出控制寄存器 */ orr r1, r1, #0xc0000000 /* 設(shè)置為“asynchronous bus mode” */ mcr p15, 0, r1, c1, c0, 0 /* 寫(xiě)入控制寄存器 */ /* MPLLCON = S3C2440_MPLL_200MHZ */ ldr r0, =0x4c000004 ldr r1, =S3C2440_MPLL_400MHZ str r1, [r0] /* 啟動(dòng)ICACHE */ mrc p15, 0, r0, c1, c0, 0 @ read control reg orr r0, r0, #(1<<12) mcr p15, 0, r0, c1, c0, 0 @ write it back ??修改start.s如下 lowlevel_init: /* memory control configuration */ /* make r0 relative the current location so that it */ /* reads SMRDATA out of FLASH rather than memory ! */ ldr r0, =SMRDATA ldr r1, _TEXT_BASE sub r0, r0, r1 ldr r1, =BWSCON /* Bus Width Status Controller */ add r2, r0, #13*4 0: ldr r3, [r0], #4 str r3, [r1], #4 cmp r2, r0 bne 0b /* everything is fine now */ mov pc, lr .ltorg /* the literal pools origin */ 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 ((B0_Tacs<<13)+(B0_Tcos<<11)+(B0_Tacc<<8)+(B0_Tcoh<<6)+(B0_Tah<<4)+(B0_Tacp<<2)+(B0_PMC)) .word ((B1_Tacs<<13)+(B1_Tcos<<11)+(B1_Tacc<<8)+(B1_Tcoh<<6)+(B1_Tah<<4)+(B1_Tacp<<2)+(B1_PMC)) .word ((B2_Tacs<<13)+(B2_Tcos<<11)+(B2_Tacc<<8)+(B2_Tcoh<<6)+(B2_Tah<<4)+(B2_Tacp<<2)+(B2_PMC)) .word ((B3_Tacs<<13)+(B3_Tcos<<11)+(B3_Tacc<<8)+(B3_Tcoh<<6)+(B3_Tah<<4)+(B3_Tacp<<2)+(B3_PMC)) .word ((B4_Tacs<<13)+(B4_Tcos<<11)+(B4_Tacc<<8)+(B4_Tcoh<<6)+(B4_Tah<<4)+(B4_Tacp<<2)+(B4_PMC)) .word ((B5_Tacs<<13)+(B5_Tcos<<11)+(B5_Tacc<<8)+(B5_Tcoh<<6)+(B5_Tah<<4)+(B5_Tacp<<2)+(B5_PMC)) .word ((B6_MT<<15)+(B6_Trcd<<2)+(B6_SCAN)) .word ((B7_MT<<15)+(B7_Trcd<<2)+(B7_SCAN)) .word ((REFEN<<23)+(TREFMD<<22)+(Trp<<20)+(Trc<<18)+(Tchr<<16)+REFCNT) .word 0x32 .word 0x30 .word 0x30 ??修改后 SMRDATA: .long 0x22011110 //BWSCON .long 0x00000700 //BANKCON0 .long 0x00000700 //BANKCON1 .long 0x00000700 //BANKCON2 .long 0x00000700 //BANKCON3 .long 0x00000700 //BANKCON4 .long 0x00000700 //BANKCON5 .long 0x00018005 //BANKCON6 .long 0x00018005 //BANKCON7 .long 0x008C04F4 // REFRESH .long 0x000000B1 //BANKSIZE .long 0x00000030 //MRSRB6 .long 0x00000030 //MRSRB7 ??上傳修改的u-boot-2012.04.01\arch\arm\cpu\arm920t\ start.s和u-boot-2012.04.01\board\samsung\smdk2440 s3c2440.c,lowlevel_init.S到ubuntu重新編譯、 5.燒寫(xiě)uboot,發(fā)現(xiàn)串口已有數(shù)據(jù),但是亂碼??測(cè)試設(shè)置的內(nèi)存是否成功 5.1進(jìn)入arch\arm\cpu\arm920t\s3c24x0\Speed.c下的get_HCLK ()函數(shù):
5.2編譯測(cè)試??make時(shí),發(fā)現(xiàn)以下幾個(gè)error: 5.3所以就直接去掉該文件,不讓編譯器編譯即可,步驟如下所示:(1)直接進(jìn)入s3c2410_nand.c的目錄,打開(kāi)Makefile: ??如上圖所示,需要去掉CONFIG_NAND_S3C2410宏定義才行 (3)屏蔽include/configs/smdk2440.h下的CONFIG_CMD_NAND宏定義 fs/yaffs2/libyaffs2.o: In function `yaffs_StartUp': /home/book/Par_Uboot/mk_uboot/u-boot-2012.04.01/fs/yaffs2/yaffscfg.c:210: undefined reference to `nand_info' Makefile:472: recipe for target 'u-boot' failed make: *** [u-boot] Error 1 ??這個(gè)時(shí)候再將smdk2440.h中的#define CONFIG_YAFFS2注釋掉,然后先make distclean 再重新上傳配置和編譯 /* * File system */ #define CONFIG_CMD_FAT #define CONFIG_CMD_EXT2 #define CONFIG_CMD_UBI #define CONFIG_CMD_UBIFS #define CONFIG_CMD_MTDPARTS #define CONFIG_MTD_DEVICE #define CONFIG_MTD_PARTITIONS //#define CONFIG_YAFFS2 #define CONFIG_RBTREE ??重新燒寫(xiě)進(jìn)norflash,打印如下圖所示: 配置時(shí)鐘 cpu_init_crit: u-boot-2012.04.01\arch\arm\cpu\arm920t\start.s board_early_init_f, relocate_code(addr_sp, id, addr): u-boot-2012.04.01\board\samsung\smdk2440 SMRDATA u-boot-2012.04.01\board\samsung\smdk2440\lowlevel_init.S _serial_setbrg: u-boot-2012.04.01\drivers\serial\serial_s3c24x0.c serial_init: u-boot-2012.04.01\arch\arm\lib\board.c //#define CONFIG_YAFFS2 #define CONFIG_S3C2440 u-boot-2012.04.01\include\configs\smdk2440.h ??下一節(jié)S3C2440移植uboot之支持NAND啟動(dòng)我們將修改uboot支持NAND啟動(dòng)。 |
|
來(lái)自: 丹楓無(wú)跡 > 《待分類(lèi)》