minis3c2440移植之uboot移植
(以下步驟適用于s3c2440開(kāi)發(fā)板)
1、修改Makefile文件:
a.修改交叉編譯宏(CROSS_COMPILE?=)修改為(CROSS_COMPILE?=arm-linux-);
tocore2440_config: unconfig
@$(MKCONFIG) $(@:_config=) arm arm920t tocore2440 tocore
包含六個(gè)參數(shù):$1. tocore2440 表示在include/configs/目錄下必須包含tocore2440.h文件;$2. arm表示在主目錄下包含lib_arm目錄,在include/目錄下包含asm_arm目錄;$3.arm920t表示CPU型號(hào),在cpu目錄下包含arm920t目錄;$4.tocore2440芯片型號(hào);$5.廠商目錄(if($5!=NULL),則在board目錄下有$5/$4目錄,else,則在board目錄下有$4目錄);$6. s3c24x0表示在include/asm_arm/包含arch_ s3c24x0目錄;
d.以上部分表示在移植U-boot前首先要添加開(kāi)發(fā)板自己的配置頭文件,并在board目錄下建立自己的開(kāi)發(fā)板目錄,修改s3c24x0(cpu/arm920t/s3c24x0,include/asm_arm/archs3c24x0)文件,改為支持2440開(kāi)發(fā)板,修改過(guò)程如下:
1)
2)
if (pllreg == MPLL)
return((CONFIG_SYS_CLK_FREQ * m * 2) / (p << s)); //得到2440開(kāi)發(fā)板的頻率
#endif
c.將get_HCLK()函數(shù)修改為2440支持,將原函數(shù)返回改為:
#if defined(CONFIG_S3C2440)
#else
#endif
d.修改time.c文件,添加宏定義#defined (CONFIG_S3C2440)(line33)
2、添加配置文件
2)注釋2410宏定義:
//#define
//#define CONFIG_SBC2410X
#define CONFIG_S3C2440
#define CONFIG_TOCORE2440
#define CONFIG_TOCORE2440_LED
#define CONFIG_S3C2440_NAND_BOOT
4)注釋CS8900網(wǎng)卡宏定義(在line72添加#if 0,在line76 添加#endif),添加DM9000網(wǎng)卡宏定義:
#define CONFIG_DM9000_USE_16BIT
#define CONFIG_DM9000_BASE
#define DM9000_IO
#define DM9000_DATA
#define CONFIG_DM9000_NO_SROM
#undef CONFIG_DM9000_DEBUG
#define CONFIG_NET_MULTI
#define CONFIG_CMD_ASKENV
#define CONFIG_CMD_DHCP
#define CONFIG_CMD_PING
#define CONFIG_CMD_NAND
#define CONFIG_CMD_SAVEENV
#define CONFIG_BOOTDELAY
#define CONFIG_BOOTARGS "console=ttySAC0 root=/dev/nfs "
#define CONFIG_ETHADDR
#define CONFIG_IPADDR
#define CONFIG_SERVERIP
#define CONFIG_BOOTCOMMAND
#define CONFIG_SYS_PROMPT
#define CONFIG_SYS_LOAD_ADDR
#define CONFIG_ENV_ADDR
#define CONFIG_ENV_IS_IN_NAND 1
#define CONFIG_ENV_OFFSET
#define CONFIG_ENV_SIZE
#define MTDPARTS_DEFAULT "mtdparts=nandflash0:384k(bootloader),"
#define NAND_MAX_CHIPS 1
#define CONFIG_MTD_NAND_VERIFY_WRITE
#if defined(CONFIG_TOCORE2440_LED)
#define GPIO_CTL_BASE 0x56000000
#define oGPIO_B 0x10
#define oGPIO_CON 0x0
#define oGPIO_DAT 0x4
#define oGPIO_UP 0x8
#endif
#define STACK_BASE 0x33f00000
#define STACK_SIZE 0x10000
//#define CONFIG_ENV_ADDR
//#define
//#define CONFIG_ENV_SIZE
添加Nandflash設(shè)置:
#if defined(CONFIG_CMD_NAND)
#define CONFIG_NAND_S3C2410
#define CONFIG_SYS_MAX_NAND_DEVICE
#endif
#define CONFIG_SETUP_MEMORY_TAGS
#define CONFIG_INITRD_TAG
#define CONFIG_CMDLINE_TAG
#define CONFIG_SYS_HUSH_PARSER
#define CONFIG_SYS_PROMPT_HUSH_PS2
#define CONFIG_CMDLINE_EDITING
#ifdef CONFIG_CMDLINE_EDITING
#undef CONFIG_AUTO_COMPLETE
#else
#define CONFIG_AUTO_COMPLETE
#endif
#define CONFIG_SYS_NAND_BASE 0x4E000000
#define NAND_CTL_BASE 0x4E000000
#define bINT_CTL(Nb) __REG(INT_CTL_BASE + (Nb))
#define oNFCONF 0x00
#if defined(CONFIG_S3C2440)
#define CONFIG_S3C2440_NAND_BOOT 1
#define oNFCONT 0x04
#define oNFCMD 0x08
#define oNFADDR 0x0c
#define oNFDATA 0x10
#define oNFSTAT 0x20
#define oNFECC 0x2c
#define rNFCONF (*(volatile unsigned int *)0x4e000000)
#define rNFCONT (*(volatile unsigned int *)0x4e000004)
#define rNFCMD (*(volatile unsigned char *)0x4e000008)
#define rNFADDR (*(volatile unsigned char *)0x4e00000c)
#define rNFDATA (*(volatile unsigned char *)0x4e000010)
#define rNFSTAT (*(volatile unsigned int *)0x4e000020)
#define rNFECC (*(volatile unsigned int *)0x4e00002c)
#endif
#if defined(CONFIG_S3C2410)
#define CONFIG_S3C2410_NAND_BOOT 1
#define oNFCONF 0x00
#define oNFCMD 0x04
#define oNFADDR 0x08
#define oNFDATA 0x0c
#define oNFSTAT 0x10
#define oNFECC 0x14
#define rNFCONF (*(volatile unsigned int *)0x4e000000)
#define rNFCMD (*(volatile unsigned char *)0x4e000004)
#define rNFADDR (*(volatile unsigned char *)0x4e000008)
#define rNFDATA (*(volatile unsigned char *)0x4e00000c)
#define rNFSTAT (*(volatile unsigned int *)0x4e000010)
#define rNFECC (*(volatile unsigned int *)0x4e000014)
#define rNFECC0 (*(volatile unsigned char *)0x4e000014)
#define rNFECC1 (*(volatile unsigned char *)0x4e000015)
#define rNFECC2 (*(volatile unsigned char *)0x4e000016)
#endif
至此tocore2440.h文件修改完畢
b.建立目錄/board/tocore/tocore2440,將/board/samsung/smdk2440下的文件拷貝至/board/tocore/tocore2440下,拷貝nand_read.c(開(kāi)發(fā)板自帶)文件至該目錄下。修改Makefile文件(line28)
COBJS
c.修改lowlevel_init.S文件,添加如下支持2440代碼:
#define Trp
#define REFCNT
#else
#define Trp
#define REFCNT
#endif
#define M_PDIV
#define M_SDIV
#endif
#endif
在#elif USB_CLOCK==1之后修改為:
//#define U_M_MDIV
//#define U_M_PDIV
#if defined(CONFIG_S3C2440)
#define U_M_MDIV 0x38
#define U_M_PDIV 0x2
#endif
修改board_init()函數(shù):
將gpio->GPGCON的值改為 0xFF95FF3A;
將gpio->GPHCON 的值改為 0x0016FAAA
在gpio->GPHUP = 0x000007FF之后添加一下宏定義:
gpio->EXTINT0=0x22222222;
gpio->EXTINT1=0x22222222;
gpio->EXTINT2=0x22222222;
在dcache_enable()函數(shù)之后添加以下低昂等操作代碼:
#if defined(CONFIG_TOCORE2440_LED)
#endif
在board_init()函數(shù)之后添加以下函數(shù):
#ifdef CONFIG_DRIVER_DM9000
int board_eth_init(bd_t *bis)
{
}
#endif
至此tocore2440.c文件修改完畢
//bl coloured_LED_init
//bl red_LED_on
在#if defined (CONFIG_S3C2400) || defined (CONFIG_S3C2410)之后添加2440的支持:|| defined(CONFIG_S3C2440)
2)在line146之后添加對(duì)時(shí)鐘設(shè)置代碼:
#define CLK_CTL_BASE
#define MDIV_405
#define PSDIV_405
#define MDIV_200
#define PSDIV_200
#endif
在line163之后添加工作頻率設(shè)置匯編代碼
#if defined(CONFIG_S3C2440)
評(píng)論