Uboot_tiny6410

Uboot_tiny6410
Uboot_tiny6410

移植u-boot-2010.09到Tiny6410开发板

Hyz

一、开发环境

Fedora13、tiny6410开发板

二、u-boot

1.版本:u-boot-2010.09

2.下载地址:www.denx.de/pub/u-boot/

三、移植

(一)首先需建立交叉编译环境

1.将光盘Linux 目录中的arm-linux-gcc-4.5.1-v6-vfp-20101103.tgz 复制到Fedora9 某个目录下如tmp/,然后进入到该目录,执行解压命令:

#cd /tmp

#tar xvzf arm-linux-gcc-4.5.1-v6-vfp-20101103.tgz –C /

注意:C 后面有个空格,并且C 是大写的,它是英文单词“Change”的第一个字母,

在此是改变目录的意思。

如果你没有arm-linux-gcc-4.5.1-v6-vfp-20101103.tgz请到我的QQ空间下载。

执行该命令,将把 arm-linux-gcc 安装到/opt/FriendlyARM/toolschain/4.5.1 目录。

2.把编译器路径加入系统环境变量,运行命令

#gedit /root/.bashrc

编辑/root/.bashrc 文件,注意“bashrc”前面有一个“.”,修改最后一行为export PATH=$PATH: /opt/FriendlyARM/toolschain/4.5.1/bin,注意路径一定要写对,否则将不会有

效。

如图,保存退出。

重新登录系统(不必重启机器,开始->logout 即可),使以上设置生效,在命令行输入arm-linux-gcc –v,会出现如下信息,这说明交叉编译环境已经成功安装。

(二)解压安装源代码

1.首先创建工作目录

工作目录/opt/FriendlyARM/tiny6410/linux

执行命令:#mkdir –p /opt/FriendlyARM/mini6410/linux

2.将源代码放到linux系统下(使用sharefoder等)

如:放到/mnt/hgfs/share下

3.解压安装u-boot源代码

在工作目录/opt/FriendlyARM/mini6410/linux 中执行:

#cd /opt/FriendlyARM/tiny6410/linux

#tar xvzf /mnt/hgfs/share/u-boot-2010.09.tar.gz

会自动生成u-boot-2010.09文件夹

(三)对u-boot-2010.09源代码进行修改

1.打开顶层目录下的Makefile,并在ARM1176处添加下面红色部分内容

######################################################################### ## ARM1176 Systems

######################################################################### smdk6400_noUSB_config \

smdk6400_config : unconfig

@mkdir -p $(obj)include $(obj)board/samsung/smdk6400

@mkdir -p $(obj)nand_spl/board/samsung/smdk6400

@echo "#define CONFIG_NAND_U_BOOT" > $(obj)include/config.h

@echo "CONFIG_NAND_U_BOOT = y" >> $(obj)include/config.mk

@if [ -z "$(findstring smdk6400_noUSB_config,$@)" ]; then \

echo "RAM_TEXT = 0x57e00000" >> $(obj)board/samsung/smdk6400/config.tmp;\

else \

echo "RAM_TEXT = 0xc7e00000" >> $(obj)board/samsung/smdk6400/config.tmp;\

fi

@$(MKCONFIG) smdk6400 arm arm1176 smdk6400 samsung s3c64xx

@echo "CONFIG_NAND_U_BOOT = y" >> $(obj)include/config.mk

tiny6410_noUSB_config \

tiny6400_config : unconfig

@mkdir -p $(obj)include $(obj)board/samsung/tiny6410

@mkdir -p $(obj)nand_spl/board/samsung/tiny6410

@echo "#define CONFIG_NAND_U_BOOT" > $(obj)include/config.h

@echo "CONFIG_NAND_U_BOOT = y" >> $(obj)include/config.mk

@if [ -z "$(findstring tiny6410_noUSB_config,$@)" ]; then \ echo "RAM_TEXT = 0x57e00000" >> $(obj)board/samsung/tiny6410/config.tmp;\

else

\

echo "RAM_TEXT = 0xc7e00000" >> $(obj)board/samsung/tiny6410/config.tmp;\

fi

@$(MKCONFIG) tiny6410 arm arm1176 tiny6410 samsung s3c64xx

@echo "CONFIG_NAND_U_BOOT = y" >> $(obj)include/config.mk

2.arch/arm/cpu/arm1176/s3c64xx/cpu_init.S

bne check_dmc1_ready

nop

#if defined(CONFIG_TINY6410)

#define SROM_BC1_REG_Tacs (0x0) // 0clk address set-up

#define SROM_BC1_REG_Tcos (0x4) // 4clk chip selection set-up

#define SROM_BC1_REG_Tacc (0xE) // 14clk access cycle

#define SROM_BC1_REG_Tcoh (0x1) // 1clk chip selection hold

#define SROM_BC1_REG_Tah (0x4) // 4clk address holding time

#define SROM_BC1_REG_Tacp (0x6) // 6clk page mode access cycle

#define SROM_BC1_REG_PMC (0x0) // normal(1data)page mode configuration

#define SROM_BW_REG_DATA ((1<<7) | (1<<6) | (1<<4))

#define SROM_BW_REG_BC1 (0xf << 4)

#define SROM_BC1_REG_DATA ((SROM_BC1_REG_Tacs << 28) | \

(SROM_BC1_REG_Tcos << 24) | \

(SROM_BC1_REG_Tacc << 16) | (SROM_BC1_REG_Tcoh << 12) | \

(SROM_BC1_REG_Tah << 8) | (SROM_BC1_REG_Tacp << 4) | \

(SROM_BC1_REG_PMC))

ldr r0, =ELFIN_SROM_BASE

ldr r1, [r0, #SROM_BW_REG_DATA]

mov r2, #(~SROM_BW_REG_BC1)

and r1, r1, r2

mov r2, #SROM_BW_REG_DATA

orr r1, r1, r2

str r1, [r0, #INDEX_SROM_BW_REG]

ldr r1, =SROM_BC1_REG_DATA

str r1, [r0, #INDEX_SROM_BC1_REG]

#endif

mov pc, lr

3.arch\arm\cpu\arm1176\s3c64xx\Makefile增加红色部分

COBJS-$(CONFIG_S3C6400) += cpu_init.o speed.o

COBJS-$(CONFIG_S3C6410) += cpu_init.o speed.o

COBJS-y += timer.o

4.arch\arm\include\asm\arch-s3c64xx\s3c64x0.h

#ifndef __S3C64XX_H__

#define __S3C64XX_H__

/*#if defined(CONFIG_SYNC_MODE) && defined(CONFIG_S3C6400) */

#if defined(CONFIG_SYNC_MODE) && defined(CONFIG_S3C6400) ||defined(CONFIG_S3C6410)

5.arch\arm\include\asm\arch-s3c64xx\s3c6400.h添加红色部分

#define ELFIN_SROM_BASE 0x70000000

#define SROM_BW_REG __REG(ELFIN_SROM_BASE + 0x0)

#define SROM_BC0_REG __REG(ELFIN_SROM_BASE + 0x4)

#define SROM_BC1_REG __REG(ELFIN_SROM_BASE + 0x8)

#define SROM_BC2_REG __REG(ELFIN_SROM_BASE + 0xC)

#define SROM_BC3_REG __REG(ELFIN_SROM_BASE + 0x10)

#define SROM_BC4_REG __REG(ELFIN_SROM_BASE + 0x14)

#define SROM_BC5_REG __REG(ELFIN_SROM_BASE + 0x18)

#define INDEX_SROM_BW_REG 0x0

#define INDEX_SROM_BC0_REG 0x4

#define INDEX_SROM_BC1_REG 0x8

#define INDEX_SROM_BC2_REG 0xC

#define INDEX_SROM_BC3_REG 0x10

#define INDEX_SROM_BC4_REG 0x14

#define INDEX_SROM_BC5_REG 0x18

6.在board\samsung建立tiny6410的文件夹,并把smdk6400文件的所有文件复

制过去

进入board\samsung\tiny6410\lowlevel_init.S

/* LED on only #8 */

#if 0

ldr r0, =ELFIN_GPIO_BASE

ldr r1, =0x55540000

str r1, [r0, #GPNCON_OFFSET]

ldr r1, =0x55555555

str r1, [r0, #GPNPUD_OFFSET]

ldr r1, =0xf000

str r1, [r0, #GPNDAT_OFFSET]

#endif

wakeup_reset:

/* Clear wakeup status register */

ldr r0, =(ELFIN_CLOCK_POWER_BASE + WAKEUP_STAT_OFFSET)

ldr r1, [r0]

str r1, [r0]

/* LED test */

#if 0

ldr r0, =ELFIN_GPIO_BASE

ldr r1, =0x3000

str r1, [r0, #GPNDAT_OFFSET]

#endif

上面两处红色部分屏蔽掉。

添加一个标志定义!defined(CONFIG_S3C6410)

/*#ifndef CONFIG_S3C6400*/

#if !defined(CONFIG_S3C6400) && !defined(CONFIG_S3C6410)

ldr r1, [r0, #OTHERS_OFFSET]

bic r1, r1, #0xC0

orr r1, r1, #0x40

str r1, [r0, #OTHERS_OFFSET]

wait_for_async:

ldr r1, [r0, #OTHERS_OFFSET]

and r1, r1, #0xf00

cmp r1, #0x0

bne wait_for_async

#endif

下面同样也是

/* #elif !defined(CONFIG_S3C6400) */

#elif !defined(CONFIG_S3C6400)&&!defined(CONFIG_S3C6410)

/* According to 661558um_S3C6400X_rev10.pdf 0x20 is reserved */ ldr r1, [r0, #OTHERS_OFFSET]

bic r1, r1, #0x20

str r1, [r0, #OTHERS_OFFSET]

#endif

mov pc, lr

board\samsung\mini6410\Makefile中添加

COBJS-y := smdk6400.o

COBJS-y := tiny6410.o

SOBJS := lowlevel_init.o

屏蔽掉下面三处红色部分:

#include

#include

#include

/*

static void cs8900_pre_init(void)

{

SROM_BW_REG &= ~(0xf << 4);

SROM_BW_REG |= (1 << 7) | (1 << 6) | (1 << 4);

SROM_BC1_REG = ((CS8900_Tacs << 28) + (CS8900_Tcos << 24) +

(CS8900_Tacc << 16) + (CS8900_Tcoh << 12) +

(CS8900_Tah << 8) + (CS8900_Tacp << 4) +

CS8900_PMC);

}

*/

int board_init(void)

{

DECLARE_GLOBAL_DATA_PTR;

/*cs8900_pre_init();*/

/* NOR-flash in SROM0 */

/* Enable WAIT */

SROM_BW_REG |= 4 | 8 | 1;

gd->bd->bi_arch_number = MACH_TYPE;

gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;

return 0;

}

修改如下部分:

int checkboard(void)

{

/*printf("Board: SMDK6400\n");*/

printf("Board: TINY6410\n");

return 0;

}

#ifdef CONFIG_ENABLE_MMU

/*

ulong virt_to_phy_smdk6400(ulong addr)

{

if ((0xc0000000 <= addr) && (addr < 0xc8000000))

return addr - 0xc0000000 + 0x50000000;

else

printf("do not support this address : %08lx\n", addr);

return addr;

}*/

ulong virt_to_phy_tiny6410(ulong addr)

{

if ((0xc0000000 <= addr) && (addr < 0xc8000000))

return addr - 0xc0000000 + 0x50000000;

else

printf("do not support this address : %08lx\n", addr);

return addr;

}

#endif

/*

ulong board_flash_get_legacy (ulong base, int banknum, flash_info_t *info) {

if (banknum == 0) { // non-CFI boot flash

info->portwidth = FLASH_CFI_16BIT;

info->chipwidth = FLASH_CFI_BY16;

info->interface = FLASH_CFI_X16;

return 1;

} else

return 0;

}

*/

#ifdef CONFIG_CMD_NET

/*

int board_eth_init(bd_t *bis)

{

int rc = 0;

#ifdef CONFIG_CS8900

rc = cs8900_initialize(0, CONFIG_CS8900_BASE);

#endif

return rc;

}

*/

int board_eth_init(bd_t *bi)

{

int rc = 0;

#if defined(CONFIG_DRIVER_DM9000)

rc = dm9000_initialize(bi);

#endif

return rc;

}

#endif

7.drivers\net\dm9000x.c增加红色部分

DM9000_ior(DM9000_MRCMDX); /* Dummy read */

/* Get most updated data,

only look at bits 0:1, See application notes DM9000 */ rxbyte = DM9000_inb(DM9000_DATA) & 0x03;

#if 1

u8 temp;

temp=DM9000_ior(DM9000_MRRH);

temp=DM9000_ior(DM9000_MRRL);

#endif

8.drivers\usb\host\ohci-hcd.c增加红色部分

#if defined(CONFIG_ARM920T) || \

defined(CONFIG_S3C24X0) || \

defined(CONFIG_S3C6400) || \

defined(CONFIG_S3C6410) || \

defined(CONFIG_440EP) || \

defined(CONFIG_PCI_OHCI)|| \

defined(CONFIG_MPC5200) || \

defined(CONFIG_SYS_OHCI_USE_NPS)

9.include\configs\tiny6410.h

//#define CONFIG_S3C6400 1 /* in a SAMSUNG S3C6400 SoC */ #define CONFIG_S3C6410 1 /* in a SAMSUNG S3C6400 SoC */ #define CONFIG_S3C64XX 1 /* in a SAMSUNG S3C64XX Family */ #define CONFIG_SMDK6400 1 /* on a SAMSUNG SMDK6400 Board */ #define CONFIG_TINY6410 1

//#define MACH_TYPE 1270

#define MACH_TYPE 2520

把cs8900网卡换掉

#if 0

#define CONFIG_NET_MULTI

#define CONFIG_CS8900 /* we have a CS8900 on-board */ #define CONFIG_CS8900_BASE 0x18800300

#define CONFIG_CS8900_BUS16 /* follow the Linux driver */ #endif

#define CONFIG_NET_MULTI 1

#define CONFIG_DRIVER_DM9000 1

#define CONFIG_DM9000_NO_SROM 1

#define CONFIG_DM9000_USE_16BIT 1

#define CONFIG_DM9000_BASE 0x18000300

#define DM9000_IO CONFIG_DM9000_BASE

#define DM9000_DATA (CONFIG_DM9000_BASE+4)

#define CONFIG_ETHADDR 12:34:56:78:90:01

#define CONFIG_NETMASK 255.255.255.0

#define CONFIG_IPADDR 192.168.40.122

#define CONFIG_SERVERIP 192.168.40.22

#define CONFIG_GATEWAYIP 192.168.40.1

#define CONFIG_CMD_PING

#define CONFIG_CMD_ELF

#define CONFIG_CMD_FAT

#define CONFIG_CMD_EXT2

#undef CONFIG_CMD_IMLS

/#define CONFIG_BOOTDELAY 3

//#define CONFIG_SYS_PROMPT "SMDK6400 # " /* Monitor Command Prompt */

改成你自己喜欢的提示字符这里是"TINY6410 # "

#define CONFIG_SYS_PROMPT "TINY6410 # " /* Monitor Command Prompt */

提高主频

Setting SYNC ASYNC

----------------------------------

667_133_66 X O

533_133_66 O O

400_133_66 X O

400_100_50 O O

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

#define CONFIG_CLK_667_133_66

//#define CONFIG_CLK_533_133_66

换掉这句

#define CONFIG_AMD_LV800

//#define CONFIG_SYS_FLASH_CFI 1 /* Use CFI parameters (needed?) */

#define CONFIG_SYS_NO_FLASH 1 /* Use CFI parameters (needed?) */

屏蔽下面的

#if 0

/* Use drivers/cfi_flash.c, even though the flash is not CFI-compliant */ #define CONFIG_FLASH_CFI_DRIVER 1

#define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_16BIT

#define CONFIG_FLASH_CFI_LEGACY

#define CONFIG_SYS_FLASH_LEGACY_512Kx16

/* timeout values are in ticks */

#define CONFIG_SYS_FLASH_ERASE_TOUT (5 * CONFIG_SYS_HZ) /* Timeout for Flash Erase */

#define CONFIG_SYS_FLASH_WRITE_TOUT (5 * CONFIG_SYS_HZ) /* Timeout for Flash Write */

#endif

#define CONFIG_ENV_SIZE 0x4000 /* Total Size of Environment Sector */

/*

* SMDK6400 board specific data

*/

这句也要改

//#define CONFIG_IDENT_STRING " for SMDK6400"

#define CONFIG_IDENT_STRING " for TINY6410"

10.include\common.h

添加红色部分

#ifdef CONFIG_4xx

ulong get_OPB_freq (void);

ulong get_PCI_freq (void);

#endif

#if defined(CONFIG_S3C24X0) || \

defined(CONFIG_LH7A40X) || \

defined(CONFIG_S3C6400) || \

defined(CONFIG_S3C6410) || \

defined(CONFIG_EP93XX)

11.顶层的MAKEALL

添加一句

####################################################################### ##

## ARM11 Systems

####################################################################### ##

LIST_ARM11=" \

cp1136 \

omap2420h4 \

apollon \

imx31_litekit \

imx31_phycore \

imx31_phycore_eet \

mx31ads \

mx31pdk \

mx31pdk_nand \

qong \

smdk6400 \

tnetv107x_evm \

tiny6410 \

12.顶层的MAINTAINERS

Alex Züpke

lart SA1100

dnp1110 SA1110

hyz

MINI6410 ARM1176JZF-S (S3C6410)

13.nand_spl\board\samsung\mini6410\config.mk

修改为红色部分

Alex Züpke

lart SA1100

dnp1110 SA1110

hyz

MINI6410 ARM1176JZF-S (S3C6410)

相关主题
相关文档
最新文档