Uboot移植文档v20Word格式.docx

上传人:b****4 文档编号:7265695 上传时间:2023-05-08 格式:DOCX 页数:31 大小:160.87KB
下载 相关 举报
Uboot移植文档v20Word格式.docx_第1页
第1页 / 共31页
Uboot移植文档v20Word格式.docx_第2页
第2页 / 共31页
Uboot移植文档v20Word格式.docx_第3页
第3页 / 共31页
Uboot移植文档v20Word格式.docx_第4页
第4页 / 共31页
Uboot移植文档v20Word格式.docx_第5页
第5页 / 共31页
Uboot移植文档v20Word格式.docx_第6页
第6页 / 共31页
Uboot移植文档v20Word格式.docx_第7页
第7页 / 共31页
Uboot移植文档v20Word格式.docx_第8页
第8页 / 共31页
Uboot移植文档v20Word格式.docx_第9页
第9页 / 共31页
Uboot移植文档v20Word格式.docx_第10页
第10页 / 共31页
Uboot移植文档v20Word格式.docx_第11页
第11页 / 共31页
Uboot移植文档v20Word格式.docx_第12页
第12页 / 共31页
Uboot移植文档v20Word格式.docx_第13页
第13页 / 共31页
Uboot移植文档v20Word格式.docx_第14页
第14页 / 共31页
Uboot移植文档v20Word格式.docx_第15页
第15页 / 共31页
Uboot移植文档v20Word格式.docx_第16页
第16页 / 共31页
Uboot移植文档v20Word格式.docx_第17页
第17页 / 共31页
Uboot移植文档v20Word格式.docx_第18页
第18页 / 共31页
Uboot移植文档v20Word格式.docx_第19页
第19页 / 共31页
Uboot移植文档v20Word格式.docx_第20页
第20页 / 共31页
亲,该文档总共31页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

Uboot移植文档v20Word格式.docx

《Uboot移植文档v20Word格式.docx》由会员分享,可在线阅读,更多相关《Uboot移植文档v20Word格式.docx(31页珍藏版)》请在冰点文库上搜索。

Uboot移植文档v20Word格式.docx

#endif

但是在board/smdk2410目录下源文件中都没有定义nand_init这个函数。

所以需要我们补充这个函数以及这个函数涉及的底层操作,NANDFlash的读写操作相对复杂,将在u-boot-1.1.6移植的后面部分介绍。

(2).修改顶层Makefile

cd/u-boot-1.1.6

geditMakefile

找到:

smdk2410_config 

:

unconfig

@$(MKCONFIG)$(@:

_config=)armarm920tsmdk2410NULLs3c24x0

在其后面添加:

fs2410_config 

_config=)armarm920tfs2410NULLs3c24x0

各项的意思如下:

arm:

CPU的架构(ARCH)

arm920t:

CPU的类型(CPU),其对应于cpu/arm920t子目录。

fs2410:

开发板的型号(BOARD),对应于board/fs2410目录。

NULL:

开发者/或经销商(vender)。

s3c24x0:

片上系统(SOC)。

(3). 

修改include/configs/fs2410.h:

修改:

#define 

CFG_PROMPT 

“SMDK2410#”

为:

“[Neusoft2410]#” 

这是u-boot的命令行提示符。

此处是bootloader启动后的提示符定义。

(4)修改board/fs2410/Makefile

将:

COBJS 

:

=smdk2410.oflash.o

改为:

=fs2410.oflash.o

当然,fs2410下的smdk2410.c要改成fs2410.c;

(5)依照你自己开发板的内存地址分配情况修改board/fs2410/lowlevel_init.S文件

这里我参考了FS2410开发板自带S3C2410_BIOS,代码如下:

#include<

config.h>

version.h>

/*someparametersfortheboard*/

/*

*

*Takenfromlinux/arch/arm/boot/compressed/head-s3c2410.S

*Copyright(C)2002SamsungElectronicsSW.LEE 

<

hitchcar@>

*/

#defineBWSCON 

0x48000000

/*BWSCON*/

#defineDW8 

(0x0)

#defineDW16 

(0x1)

#defineDW32 

(0x2)

#defineWAIT 

(0x1<

<

2)

#defineUBLB 

3)

#defineB1_BWSCON 

(DW16)

#defineB2_BWSCON 

#defineB3_BWSCON 

(DW16+WAIT+UBLB)

#defineB4_BWSCON 

#defineB5_BWSCON 

#defineB6_BWSCON 

(DW32)

#defineB7_BWSCON 

/*BANK0CON*/

#defineB0_Tacs 

0x3 

/* 

0clk*/

#defineB0_Tcos 

#defineB0_Tacc 

0x7 

/*14clk*/

#defineB0_Tcoh 

#defineB0_Tah 

#defineB0_Tacp 

0x1

#defineB0_PMC 

0x0 

/*normal*/

/*BANK1CON*/

#defineB1_Tacs 

#defineB1_Tcos 

#defineB1_Tacc 

#defineB1_Tcoh 

#defineB1_Tah 

#defineB1_Tacp 

0x3

#defineB1_PMC 

0x0

#defineB2_Tacs 

#defineB2_Tcos 

#defineB2_Tacc 

0x7

#defineB2_Tcoh 

#defineB2_Tah 

#defineB2_Tacp 

#defineB2_PMC 

#defineB3_Tacs 

#defineB3_Tcos 

4clk*/

#defineB3_Tacc 

#defineB3_Tcoh 

0x1 

1clk*/

#defineB3_Tah 

#defineB3_Tacp 

6clk*/

#defineB3_PMC 

#defineB4_Tacs 

#defineB4_Tcos 

#defineB4_Tacc 

0x6 

#defineB4_Tcoh 

#defineB4_Tah 

#defineB4_Tacp 

#defineB4_PMC 

#defineB5_Tacs 

#defineB5_Tcos 

#defineB5_Tacc 

#defineB5_Tcoh 

#defineB5_Tah 

#defineB5_Tacp 

#defineB5_PMC 

#defineB6_MT 

/*SDRAM*/

#defineB6_Trcd 

#defineB6_SCAN 

/*9bit*/

#defineB7_MT 

#defineB7_Trcd 

/*3clk*/

#defineB7_SCAN 

/*REFRESHparameter*/

#defineREFEN 

/*Refreshenable*/

#defineTREFMD 

/*CBR(CASbeforeRAS)/Autorefresh*/

#defineTrp 

/*2clk*/

#defineTrc 

/*7clk*/

#defineTchr 

0x2 

#defineREFCNT 

1113 

/*period=15.6us,HCLK=60Mhz,(2048+1-15.6*60)*/

/**************************************/

_TEXT_BASE:

.word 

TEXT_BASE

.globllowlevel_init

lowlevel_init:

/*memorycontrolconfiguration*/

/*maker0relativethecurrentlocationsothatit*/

/*readsSMRDATAoutofFLASHratherthanmemory!

*/

ldr 

r0,=SMRDATA

r1,_TEXT_BASE

sub 

r0,r0,r1

r1,=BWSCON 

/*BusWidthStatusController*/

add 

r2,r0,#13*4

0:

r3,[r0],#4

str 

r3,[r1],#4

cmp 

r2,r0

bne 

0b

/*everythingisfinenow*/

mov 

pc,lr

.ltorg

/*theliteralpoolsorigin*/

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)

.word0x32

.word0x30

(6)测试编译能否成功:

执行

makefs2410_config

make

如果没有问题,在u-boot-1.1.6目录下就生成u-boot.bin,因为到这一步只是做了点小改动,并未涉及敏感问题,测试一下可增加点信心,烧到扳子看到如图1所示。

当然也有make不成功的时候,如按照上述步骤编译u-boot-1.1.5的时候,出现“没有规则创建'

all'

需要的目标'

hello_world.srec'

”,如图1所示,解决方法:

把example文件夹下的Makefile中的

第147行 

%.srec:

%改成:

%.o 

第150行

%.bin:

%.o

网上还有一种改法,我没试过,不作说明。

(7)在board/fs2410加入NANDFlash读函数,建立nand_read.c,加入如下内容(copyfromvivi):

#include"

linux/mtd/mtd.h"

linux/mtd/nand.h"

#define__REGb(x)(*(volatileunsignedchar*)(x))

#define__REGi(x)(*(volatileunsignedint*)(x))

#defineNF_BASE0x4e000000

#defineNFCONF__REGi(NF_BASE+0x0)

#defineNFCMD__REGb(NF_BASE+0x4)

#defineNFADDR__REGb(NF_BASE+0x8)

#defineNFDATA__REGb(NF_BASE+0xc)

#defineNFSTAT__REGb(NF_BASE+0x10)

#defineBUSY1

inlinevoidwait_idle(void){

inti;

while(!

(NFSTAT&

BUSY))

for(i=0;

i<

10;

i++);

}

#defineNAND_SECTOR_SIZE512

#defineNAND_BLOCK_MASK(NAND_SECTOR_SIZE-1)

/*lowlevelnandreadfunction*/

int

nand_read_ll(unsignedchar*buf,unsignedlongstart_addr,intsize)

{

inti,j;

if((start_addr&

NAND_BLOCK_MASK)||(size&

NAND_BLOCK_MASK)){

return-1;

/*invalidalignment*/

}

/*chipEnable*/

NFCONF&

=~0x800;

for(i=start_addr;

i<

(start_addr+size);

){

/*READ0*/

NFCMD=0;

/*WriteAddress*/

NFADDR=i&

0xff;

NFADDR=(i>

>

9)&

17)&

25)&

wait_idle();

for(j=0;

j<

NAND_SECTOR_SIZE;

j++,i++){

*buf=(NFDATA&

0xff);

buf++;

/*chipDisable*/

NFCONF|=0x800;

/*chipdisable*/

return0;

}

(8)接着修改board/fs2410/Makefile

COBJS:

=fs2410.oflash.onand_read.o

(9)修改cpu/arm920t/start.S文件

2410的启动代码可以在外部的NANDFLASH上执行,启动时,NANDFLASH的前4KB(地址为0x00000000,OM[1:

0]=0)将被装载到SDRAM中被称为Setppingstone的地址中,然后开始执行这段代码。

启动以后,这4KB的空间可以做其他用途,在start.S加入搬运代码如下:

...........

copy_loop:

ldmiar0!

{r3-r10}/*copyfromsourceaddress[r0]*/

stmiar1!

{r3-r10}/*copytotargetaddress[r1]*/

cmpr0,r2/*untilsourceendaddreee[r2]*/

blecopy_loop

下面红色是要添加的内容,添加到蓝色的部分中间,蓝色是已经有的代码

/********************************************************/

#ifdefCONFIG_S3C2410_NAND_BOOT/*这个一定要放在堆栈设置之前*/

blcopy_myself

#endif/*CONFIG_S3C2410_NAND_BOOT*/

#endif/*CONFIG_SKIP_RELOCATE_UBOOT*/

/*Setupthestack*/

stack_setup:

..................

…………..

/**************************************************************************

*

*copyu-boottoram放在start.S靠后的位置

*************************************************************************

*/

#ifdefCONFIG_S3C2410_NAND_BOOT

/*

@copy_myself:

copyu-boottoram

*/

copy_myself:

movr10,lr

@resetNAND

movr1,#NAND_CTL_BASE

ldrr2,=0xf830@initialvalue

strr2,[r1,#oNFCONF]

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 法律文书 > 辩护词

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2