新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設計應用 > minis3c2440移植之uboot移植

minis3c2440移植之uboot移植

作者: 時間:2016-11-24 來源:網絡 收藏


ldr r0, =CLKDIVN
mov r1,#5
str r1,[r0]

mrc p15,0,r1,c1,c0,0
orr r1, r1,#0xc0000000
mcr p15,0,r1,c1,c0,0

mov r1,#CLK_CTL_BASE
mov r2,#MDIV_405
add r2,r2,#PSDIV_405
str r2,[r1,#0x4]
#else
在#endif 之后添加以下Nandflash設置代碼:
#endif
#define LENGTH_UBOOT 0x60000
#define NAND_CTL_BASE 0x4E000000
#ifdef CONFIG_S3C2440_NAND_BOOT

@reset NAND
//#define oNFCONF 0x00
//#define oNFCONT 0x04
//#define oNFSTAT 0x08
//#define oNFCMD 0x20
mov r1,#NAND_CTL_BASE
ldr r2,=( (7<<12)|(7<<8)|(7<<4)|(0<<0))
str r2,[r1,#oNFCONF]
ldr r2,[r1,#oNFCONF]
ldr r2,=((1<<4)|(0<<1)|(1<<0))
str r2,[r1,#oNFCONT]
ldr r2,[r1,#oNFCONT]
ldr r2,=(0x6)
str r2,[r1,#oNFSTAT]
ldr r2,[r1,#oNFSTAT]
mov r2,#0xff
strb r2,[r1,#oNFCMD]
mov r3,#0
nand1:
add r3,r3,#0x1
cmp r3,#0xa
blt nand1
nand2:
ldr r2,[r1,#oNFSTAT]
tst r2,#0x4
beq nand2
ldr r2,[r1,#oNFCONT]
orr r2,r2,#0x2
str r2,[r1,#oNFCONT]
@get read to call C functions (for nand_read())
ldr sp,DW_STACK_START
mov fp,#0
@copy U-Boot to Ram
ldr r0,=TEXT_BASE
mov r1,#0x0
mov r2, #LENGTH_UBOOT //the u-boot¿s lenth
bl nand_read_ll
tst r0,#0x0
beq ok_nand_read
bad_nand_read:
loop2: b loop2
ok_nand_read:
@verify
mov r0,#0
ldr r1,=TEXT_BASE
mov r2,#0x400
go_next:
ldr r3,[r0],#4
ldr r4,[r1],#4
teq r3,r4
bne notmatch
subs r2,r2,#4
beq stack_setup
bne go_next

notmatch:
loop3: b loop3 @CONFIG_S3C2440_NAND_BOOT
#endif
在對BSS段清零操作代碼之后添加以點燈操作代碼:
#if defined(CONFIG_TOCORE2440_LED)
mov r1, #GPIO_CTL_BASE
add r1, r1, #oGPIO_B
ldr r2,=0x156aa
str r2, [r1, #oGPIO_CON]
mov r2, #0xff
str r2, [r1, #oGPIO_UP]
mov r2, #0x1c0
str r2, [r1, #oGPIO_DAT]
#endif
在_start_armboot: .word start_armboot跳轉代碼之后添加以下對堆棧段設置的代碼:
#define STACK_BASE 0x33f00000
#define STACK_SIZE 0x10000
.align 2
DW_STACK_START: .word STACK_BASE+STACK_SIZE-4
至此start.S文件修改完畢,整個配置文件修改完成。
3.在u-boot根目錄下執(zhí)行清理配置文件命令make distclean,并執(zhí)行命令make tocore2440_config命令,完成對u-boot的配置,添加交叉編譯工具環(huán)境變量:export PATH=/armtools/bin:$PATH(交叉編譯工具解壓在更目錄下),再執(zhí)行make命令,完成U-boot編譯。


Linux內核編譯步驟(支持S3C2440)
1. 修改Makefile文件:
修改arch宏定義:ARCH?=arm (line176)
修改CROSS_COMPILE為CROSS_COMPILE?=arm-linux- (line177)
2.執(zhí)行命令cp arch/arm/configs/smdk2410_defconfig .config,完成對smdk2410配置信息的拷貝。執(zhí)行命令make menuconfig命令,實現(xiàn)對.config文件的配置信息的設置。
3. 對.config配置方法如下:
a.進入配置System Type --->項:
選擇S3C24XX Implementations --->項,進入后選定SMDK2440項和其子項SMDK2440 with S3C2440 CPU module,推出到上級菜單,選定arm900T支持項Support ARM920T processor,至此完成對System Type項的設置。
b.進入配置Floating point emulation --->項:
進入后選定NWFPE math emulation和其子項Support extended precision,至此完成對Floating point emulation項的設置。
c.進入配置Device Drivers --->驅動項:
1)配置Memory Technology Devices (MTD) --->項,進入選定Memory Technology Device (MTD) support項和MTD partitioning support項,并進入配置NAND Flash Device Drivers --->項,進入后選定NAND Flash support for S3C2410/S3C2440 SoC項NAND Flash support for S3C2410/S3C2440 SoC和其子項S3C2410 NAND driver debug項,退出到Device Drivers二級菜單。
2)配置Block devices --->項,進入后選定Loopback device support項,修改Default RAM disk size (kbytes)項的值為65535,退到上級菜單
3)配置Network device support --->項,進入之后選定Network device support項,進入Ethernet (10 or 100Mbit) --->項選擇網DM9000支持項DM9000 support,退出到Device Drivers二級菜單
4)進入Character devices --->項的子項Serial drivers --->檢查是否選定Samsung S3C2410/S3C2440/S3C2442/S3C2412 Serial port support和其子項Support for console on S3C2410 serial port,若未選定,則選定退出到主菜單。
d.配置File systems --->項,進入之后選定Ext2 extended attributes項、Ext2 execute in place support、Ext3 journalling file system support項和ROM file system support項,進入Network File Systems --->項,選定NFS file system support項,退出到主菜單
e.退出,保存。
4.修改arch/arm/march_s3c2410/目錄下的文件common-smdk.c文件:
將struct mtd_partition smdk_default_nand_part[]修改為:
static struct mtd_partition smdk_default_nand_part[] = {
[0] = {
.name = "Kernel",
.size = SZ_2M,
.offset = 0,
},
[1] = {
.name = "root partition",
.offset = SZ_2M,
.size = (64*SZ_1M-2* SZ_1M),
},
[2] = {
.name = "other2",
.offset = SZ_64M,
.size = (64*SZ_1M),
},
[3] = {
.name = "other3",
.offset = SZ_128M,
.size = (64*SZ_1M),
},
#if 0

[2] = {
.name = "S3C2410 flash partition 2",
.offset = SZ_4M,
.size = SZ_4M,
},
[3] = {
.name = "S3C2410 flash partition 3",
.offset = SZ_8M,
.size = SZ_2M,
},
[4] = {
.name = "S3C2410 flash partition 4",
.offset = SZ_1M * 10,
.size = SZ_4M,
},
[5] = {
.name = "S3C2410 flash partition 5",
.offset = SZ_1M * 14,
.size = SZ_1M * 10,
},
[6] = {
.name = "S3C2410 flash partition 6",
.offset = SZ_1M * 24,
.size = SZ_1M * 24,
},
[7] = {
.name = "S3C2410 flash partition 7",
.offset = SZ_1M * 48,
.size = SZ_16M,
}
#endif
};
5.修改arch/arm/march_s3c2410/目錄下的march-smdk2410.c文件:
修改函數(shù)void __init smdk2440_map_io():將主頻設置為12000000。 代碼為s3c24xx_init_clocks(12000000);
6.執(zhí)行make clean清除命令,再執(zhí)行make uImage命令,完成make命令之后將在arch/arm/boot目錄下產生uImage文件。至此整個內核的修改和編譯全部完成。




上一頁 1 2 下一頁

評論


技術專區(qū)

關閉