uboot116的移植目标板TQ24401 编译测试Word格式.docx
《uboot116的移植目标板TQ24401 编译测试Word格式.docx》由会员分享,可在线阅读,更多相关《uboot116的移植目标板TQ24401 编译测试Word格式.docx(11页珍藏版)》请在冰豆网上搜索。
这两句的含义,可参见韦东山编著的《嵌入式Linux应用开发完全手册》的bootloader部分--第15章,第249页u-boot配置过程。
4.使用支持softfloat的交叉编译器:
crosstools_3.4.1_soft(光盘附带)。
5.编译测试
配置
makejzy2440_config
编译:
make
具体u-boot编译,连接过程参看韦东山《嵌入式Linux应用开发完全手册》第254页。
6.清除上次编译的结果:
makemrproper
u-boot1.1.6的移植(目标板TQ2440)4.lds设置
17:
34阅读43评论0
(四).lds文件设置
注:
蓝色部分为修改或者改动部分,红色部分为jzy23注解。
在board/jzy2440/u-boot.lds里修改:
SECTIONS
{
.=0x00000000;
.=ALIGN(4);
.text
:
cpu/arm920t/start.o
(.text)
board/jzy2440/boot_init.o(.text)
//添加这句
*(.text)
}
.rodata:
{*(.rodata)}
.data:
{*(.data)}
.got:
{*(.got)}
.=.;
__u_boot_cmd_start=.;
.u_boot_cmd:
{*(.u_boot_cmd)}
__u_boot_cmd_end=.;
__bss_start=.;
.bss:
{*(.bss)}
_end=.;
u-boot1.1.6的移植(目标板TQ2440)5代码重定向
15:
55阅读81评论0
(五)代码重定向
start.S里修改:
#ifndefCONFIG_SKIP_RELOCATE_UBOOT
relocate:
/*relocateU-BoottoRAM
*/
adr
r0,_start
/*r0<
-currentpositionofcode(r0=0)
ldr
r1,_TEXT_BASE
/*testifwerunfromflashorRAM(r1=0x33f80000*/
cmp
r0,r1
/*don'
trelocduringdebug
beq
clear_bss
/*(原来为stack_setup)*/
r2,_armboot_start
/*(r2为_start的地址=0x3ff80000)*/
r3,_bss_start
/*(在连接文件中定义)*/
sub
r2,r3,r2
#if1
/*(增加)*/
bl
CopyCode2Ram
/*r0:
source,r1:
dest,r2:
size*/
/*(跳转到CopyCode2Ram函数)*/
#else
add
r2,r0,r2
//r2<
-sourceendaddress
copy_loop:
ldmia
r0!
{r3-r10}
//copyfromsourceaddress[r0]
stmia
r1!
//copyto
targetaddress[r1]
r0,r2
//untilsourceendaddreee[r2]
ble
copy_loop
#endif
#endif
//CONFIG_SKIP_RELOCATE_UBOOT*/
2.在board/jzy2440/boot_init.c中与CopyCode2Ram()相关的函数与定义如下:
#include<
common.h>
s3c2410.h>
#defineGSTATUS1
(*(volatileunsignedint*)0x560000B0)
#defineBUSY
1
//供外部调用的函数*/
voidnand_init_ll(void);
intnand_read_ll(unsignedchar*buf,unsignedlongstart_addr,intsize);
//NANDFlash操作的总入口,它们将调用S3C2410或S3C2440的相应函数*/
staticvoidnand_reset(void);
staticvoidwait_idle(void);
staticvoidnand_select_chip(void);
staticvoidnand_deselect_chip(void);
staticvoidwrite_cmd(intcmd);
staticvoidwrite_addr(unsignedintaddr);
staticunsignedcharread_data(void);
//S3C2410的NANDFlash处理函数*/
staticvoids3c2410_nand_reset(void);
staticvoids3c2410_wait_idle(void);
staticvoids3c2410_nand_select_chip(void);
staticvoids3c2410_nand_deselect_chip(void);
staticvoids3c2410_write_cmd(intcmd);
staticvoids3c2410_write_addr(unsignedintaddr);
staticunsignedchars3c2410_read_data(void);
//S3C2440的NANDFlash处理函数*/
staticvoids3c2440_nand_reset(void);
staticvoids3c2440_wait_idle(void);
staticvoids3c2440_nand_select_chip(void);
staticvoids3c2440_nand_deselect_chip(void);
staticvoids3c2440_write_cmd(intcmd);
staticvoids3c2440_write_addr(unsignedintaddr);
staticunsignedchars3c2440_read_data(void);
//S3C2410的NANDFlash操作函数*/
//复位*/
staticvoids3c2410_nand_reset(void)
s3c2410_nand_select_chip();
s3c2410_write_cmd(0xff);
//复位命令
s3c2410_wait_idle();
s3c2410_nand_deselect_chip();
//等待NANDFlash就绪*/
staticvoids3c2410_wait_idle(void)
inti;
S3C2410_NAND*s3c2410nand=(S3C2410_NAND*)0x4e000000;
volatileunsignedchar*p=(volatileunsignedchar*)&
s3c2410nand->
NFSTAT;
while(!
(*p&
BUSY))
for(i=0;
i<
10;
i++);
//
发出片选信号*/
staticvoids3c2410_nand_select_chip(void)
s3c2410nand->
NFCONF&
=~(1<
<
11);
//取消片选信号*/
staticvoids3c2410_nand_deselect_chip(void)
NFCONF|=(1<
//发出命令*/
staticvoids3c2410_write_cmd(intcmd)
NFCMD;
*p=cmd;
//发出地址*/
staticvoids3c2410_write_addr(unsignedintaddr)
NFADDR;
*p=addr&
0xff;
*p=(addr>
>
9)&
17)&
25)&
//读取数据*/
staticunsignedchars3c2410_read_data(void)
NFDATA;
return*p;
//S3C2440的NANDFlash操作函数*/
staticvoids3c2440_nand_reset(void)
s3c2440_nand_select_chip();
s3c2440_write_cmd(0xff);
s3c2440_wait_idle();
s3c2440_nand_deselect_chip();
staticvoids3c2440_wait_idle(void)
S3C2440_NAND*s3c2440nand=(S3C2440_NAND*)0x4e000000;
s3c2440nand->
staticvoids3c2440_nand_select_chip(void)
s3c2440nand->
NFCONT&
1);
staticvoids3c2440_nand_deselect_chip(void)
NFCONT|=(1<
staticvoids3c2440_write_cmd(intcmd)
staticvoids3c2440_write_addr(unsignedintaddr)
*/(不是8!
)*/
staticunsignedchars3c2440_read_data(void)
//在第一次使用NANDFlash前,复位一下NANDFlash*/
staticvoidnand_reset(void)
//判断是S3C2410还是S3C2440*/
if((GSTATUS1==0x32410000)||(GSTATUS1==0x32410002))
s3c2410_nand_reset();
else
s3c2440_nand_reset();
staticvoidwait_idle(void)
staticvoidnand_select_chip(void)
staticvoidnand_deselect_chip(void)
}
staticvoidwrite_cmd(intcmd)
s3c2410_write_cmd(cmd);
s3c2440_write_cmd(cmd);
staticvoidwrite_addr(unsignedintaddr)
s3c2410_write_addr(addr);
s3c2440_write_addr(addr);
staticunsignedcharread_data(void)
returns3c2410_read_data();
returns3c2440_read_data();
//初始化NANDFlash*/
voidnand_init_ll(void)
#defineTACLS
0
#defineTWRPH0
3
#defineTWRPH1
{
//使能NANDFlash控制器,初始化ECC,禁止片选,设置时序*/
NFCONF=(1<
15)|(1<
12)|(1<
11)|(TACLS<
8)|(TWRPH0<
4)|(TWRPH1<
0);
}
else
//设置时序*/
NFCONF=(TACLS<
12)|(TWRPH0<
8)|(TWRPH1<
4);
NFCONT=(1<
4)|(1<
1)|(1<
//复位NANDFlash*/
nand_reset();
#defineNAND_SECTOR_SIZE
512
#defineNAND_BLOCK_MASK
(NAND_SECTOR_SIZE-1)
//读函数*/
intnand_read_ll(unsignedchar*buf,unsignedlongstart_addr,intsize)
inti,j;
if((start_addr&
NAND_BLOCK_MASK)||(size&
NAND_BLOCK_MASK)){
return;
//选中芯片*/
nand_select_chip();
for(i=start_addr;
i<
(start_addr+size);
){
//发出READ0命令*/