Upload
akhilesh-chaudhry
View
219
Download
0
Embed Size (px)
Citation preview
8/15/2019 U Boot44B0 Porting
1/10
U-Boot在 44B0X开发板上的移植以及代码分析
章永阳 2003-10-301. u-boot介绍
u-boot 是一个 open source 的 bootloader ,目前版本是 0.4.0。u-boot 是在 ppcboot 以及
armboot的基础上发展!,"#$%是 0.4.0版本,&'(的)*+,-,./在012
3456开发789:;?开发@代码,?AB的开发板C1。D一EF的是GH
ABIJK在LMN< samsung 44B0X的开发板。
OPQIJRS u-bootTU#V以W ucLinuxXYZ3 flash,[HRS\]的^_`a
8bc bootloader d。e是[fghi的jk以及8blm的!n,fg的opqrstu
S。vw上,^_`a8bc bootloader d的 u-boot./ƒ¥基> s3c24b0的
开发板目,‡O¦§,V以Ÿ'¨的目。
2) 在 cpu目–—˜ arm#tdmi目!©Sƒ¥ start.",interrupts.c以及 cpu.c!serial.cª个
¡g。•«HRS[š开›˜¬¡g,XY[arm#20tŸ,#l'¨£¤。
3) 在 include$configs目–®ˆ e44b0ii.h,在¯°±上²³的´-µ™。4) ¶Ž u-boot·目–%a&efilelˆ3
1. e44b0ii'config ( unconfig
2. .$m&config *+('config,) arm arm#tdmi e44b0ii
) ¸¹ma&e e44bii'config!zº»¼½¾|V以开›…g'代码移植的¿‡ 3. u-boot
的À5’“
1)ÁÀ’“
u-boot是一个ÂÃ4’“。[上ÄV以ÅÆ,Ç移植¿‡的fgÈɨ(ÊËÌÍÎ
pc/ rier d!以ÏÐÎp+thernet rier)!lashÎpclashÎpd!"BÎpc"B
rier d。目前,Ñ7 "BÍ–a8bUÒH是Ó分~S,N以Ô€»¼移植"BÎp。Î
pÂÕ上是 u-boot的¨
在 flash rom9£Þ分çÄ
e44b0ii的 flashèé 2%+7bits)!K在W 0-40000ê 28&‡O u-boot的Þëìí。=> u-boot
9¼一Úîïðñ,æz ip òó,^_¡g¢™,V在ÛܹÑ7 seten ôõö!Ñ7
saeen÷Þ在 40000-0000cê 84& d¯øìí°。zºÞ在÷Þö的îïðñ,u-boot^
_WXYÙ e44b0ii uclinux 9断向ñ8bòó在
8/15/2019 U Boot44B0 Porting
2/10
0x0c00 0000ÿ,N以H能W8b–aŽ 0x0c00 0000Æ,Ñt–aŽ 0x0c07 0000ÿ。
4. start."代码’“
1)-µ3Í
一个V执¹的 :mage~须¼一个3Í点G且只能¼一个D一的²³3Í,Ñt¯个3ͱ
在om+flash)的 0x0òó。æz start."9的.globl 'start
'start(
值Ò注意的是你~须告诉编译器知道¯个3Í,¯个¿‡©S是l连Y器脚本¡g
cldsd。
2)设õ异t向ñ+xception ;ector)
异t向ñ表,V%O9断向ñ表,~须是[ 0òó开›,连续的Þ±。z–Ø的|ƒ„了
Ÿþ+reset)!未-µÿŠcundef d!fg9断+"
8/15/2019 U Boot44B0 Porting
3/10
ldr pc!,?andle:% $Am9A$
b .
b .
ldr pc!,?andleX0 $AmA$
ldr pc!,?andleX1ldr pc!,?andle::9
ldr pc!,?andle":D
ldr pc!,?andleX0
ldr pc!,?andleX1 $AmA$
b .
b .
ldr pc!,?andle9 $Am5/A$
b .
b .
b .
b .
b . $Am5/A$
b .
b .
ldr pc!,?andle/9 $Am5BA$
b .
b .
b .
b . b . $Am5BA$
b .
b .
ldr pc!,nter6
8/15/2019 U Boot44B0 Porting
4/10
.eEu ?andle::9! 0xc000034
.eEu ?andleX1! 0xc000037
.eEu ?andleX0! 0xc00003c
.eEu ?andle:%! 0xc000040
.eEu ?andle:%4! 0xc000044
.eEu ?andle:%3! 0xc000047
.eEu ?andle:%2! 0xc00004c
.eEu ?andle:%1! 0xc00000
.eEu ?andle:%0! 0xc00004
.eEu ?andle01! 0xc00007
.eEu ?andle
8/15/2019 U Boot44B0 Porting
5/10
Þ ban& , ban&èé,scl&!以及8个 ban& mode。
$AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
A "et memor> control registers A
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA$
memsetup(adr r0!"%//
ldmia r0!Jr1-r13K
ldr r0!,0x01c70000 $$B'loop(
ldmia r0M! Jr3-r10K
stmia r1M! Jr3-r10K
cmp r0! r2
ble cop>'loop
8)+›,IJ
K3LMN4设õ'¨N4的IJ。
:nit"tac&s(
$AonNt use /%!such as stmfd!ldmfd......
";9stac& is initialiIed beforeA$
mrs r0!cpsr
bic r0!r0!O0X1
orr r1!r0!O0xB $A@%DP@D:@A$
msr cpsr!r1 $Andef%odeA$
ldr sp!ndef"tac& orr r1!r0!O0X# $A/BD%DP@D:@A$
8/15/2019 U Boot44B0 Porting
6/10
8/15/2019 U Boot44B0 Porting
7/10
' default
flash'protect+L/'6D9'"!
9'%D@:D'B/"!
9'%D@:D'B/"Rmonitor'flash'len-1!
Sflash'infoG0H)TOendif
A$
flash'infoG0H.siIe ,6?Z"'L/"?'":CT
return +6?Z"'L/"?'":C)T
K
flash'initY)+›,‘分,¯°的©S目的是cd flash的e?是XùE。
int flash'erase +flash'info't Ainfo! int s'first! int s'last)
J
olatile unsigned char Aaddr , +olatile unsigned char A)+info-QstartG0H)T
int flag! prot! sect! l'sectT
$$ulong start! noF! lastT
u32 target/ddrT
u32 target"iIeT
$AI>> note(:t is reEuired and canNt be omittedA$
r@9/9?B0,+ +0x2000000QQ12)18 )P+0QQ12)T $$flash area+Ban&0) must be non-cachable
area.
r"Z"9,r"Z"9 S +[0x7)T $$Frite buffer has to be off for proper timing.
if ++s'first 0) PP +s'first Q s'last)) J
if +info-Qflash'id ,, L/"?'@5@D
8/15/2019 U Boot44B0 Porting
8/10
K else J
printf +V- no sectors to eraseWnV)T
K
return 1T
Kif ++info-Qflash'id ,, L/"?'@5@D A$
8/15/2019 U Boot44B0 Porting
9/10
if +flag)
enable'interrupts+)T
$A Fait at least 70us - letNs Fait 1 ms A$
udela> +1000)T
$AA
8/15/2019 U Boot44B0 Porting
10/10