U-boot-2009.03移植之七:第一阶段之mini2440.h的理解和修改

移植u-boot-2009.03的第一阶段是支持2440。
在对start.s的修改之后,接下来是修改include/configs/mini2440.h 文件
附录上修改后文件的源码
可以看出,这个文件主要定义了跟mini2440板子密切相关的一些宏定义。
分别是:
1:High Level Configuration Options 高级配置选项,包括CPU等
2:Size of malloc() pool  内存池
3:Hardware drivers 在这个部分屏蔽了以前对8900网络芯片的支持,改为对DM9000的支持
4: BOOTP options  启动选项
5:Command line configuration.命令行配置,包括启动参数和网络参数等,这些都是UBOOT的启动默认参数,可以通过printenv命

令查看,可以通过setenv命令修改和saveenv保存。但是值得注意的是,我们能修改的,只是处于内存中的启动参数,对于在flash中

的,始终是这个文件中设置的这些参数,因此这些是默认参数
6:Miscellaneous configurable options与系统相关的一些配置
7:Stack sizes与内存堆栈相关的一些配置
8:FLASH and environment organization针对开发板flash的一些配置,值得注意的是,修改了nand对应的一些寄存器以支持2440,

这部分参考了u-boot-1.3.4的移植,
参考http://home.eeworld.com.cn/my/space.php?uid=135723&do=blog&id=25347
对于这个部分也有些是根据2009的移植攻略改的, 增加对CFI接口NOR Flash的支持,
参考http://blog.csdn.net/Charistain_huang/archive/2010/04/09/5469007.aspx
另外就是后面会针对128M nand有专门的修改介绍,也会在这部分代码中有体现

一下为修改后的源码
#ifndef __CONFIG_H
#define __CONFIG_H
#define CONFIG_CMD_NAND
#define CONFIG_CMD_ENV
#define CONFIG_ENV_IS_IN_NAND       1
#define CONFIG_ENV_OFFSET         0x40000
//#define CONFIG_ENV_IS_IN_FLASH 1
#define CONFIG_ENV_SIZE  0x20000
#define CONFIG_CMDLINE_TAG  1
#define CONFIG_SETUP_MEMORY_TAGS 1
#define CONFIG_INITRD_TAG 1
/*
 * 1:High Level Configuration Options
 * (easy to change)
 */
#define CONFIG_ARM920T  1 /* This is an ARM920T Core */
#define CONFIG_S3C2440  1 /* in a SAMSUNG S3C2410 SoC     */
#define CONFIG_SMDK2410  1 /* on a SAMSUNG SMDK2410 Board  */

/* input clock of PLL */
#define CONFIG_SYS_CLK_FREQ 12000000/* the SMDK2410 has 12MHz input clock */


#define USE_920T_MMU  1
#undef CONFIG_USE_IRQ   /* we don't need IRQ/FIQ stuff */

/*
 * 2:Size of malloc() pool
 */
#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + 128*1024)
#define CONFIG_SYS_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */

/*
 * 3:Hardware drivers
 */
//#define CONFIG_DRIVER_CS8900 1 /* we have a CS8900 on-board */
//#define CS8900_BASE  0x19000300
//#define CS8900_BUS16  1 /* the Linux driver does accesses as shorts */
//===================================FOR dm9000 by hadise=============================//
#define CONFIG_DRIVER_DM9000 1
#define CONFIG_DM9000_BASE 0x20000300
#define DM9000_IO CONFIG_DM9000_BASE
#define CONFIG_DM9000_USE_16BIT 1
#define DM9000_DATA 0x20000004
//===================================================================================================//
/*
 * select serial console configuration
 */
#define CONFIG_SERIAL1          1 /* we use SERIAL 1 on SMDK2410 */

/************************************************************
 * RTC
 ************************************************************/
#define CONFIG_RTC_S3C24X0 1

/* allow to overwrite serial and ethaddr */
#define CONFIG_ENV_OVERWRITE

#define CONFIG_BAUDRATE  115200


/*
 *4: BOOTP options
 */
#define CONFIG_BOOTP_BOOTFILESIZE
#define CONFIG_BOOTP_BOOTPATH
#define CONFIG_BOOTP_GATEWAY
#define CONFIG_BOOTP_HOSTNAME


/*
 * 5:Command line configuration.
 */
#include <config_cmd_default.h>

#define CONFIG_CMD_CACHE
#define CONFIG_CMD_DATE
#define CONFIG_CMD_ELF

#define CONFIG_CMD_NET
#define CONFIG_BOOTDELAY 3
#define CONFIG_BOOTARGS "root=/dev/mtdblock2 init=/linuxrc devfs=mount console=ttySAC0,115200"
#define CONFIG_ETHADDR 08:00:3e:26:0a:5b
#define CONFIG_NETMASK          255.255.255.0
#define CONFIG_IPADDR  192.168.0.23
#define CONFIG_SERVERIP  192.168.0.87
#define CONFIG_BOOTFILE  "zImage.img"
/*#define CONFIG_BOOTFILE "elinos-lart" */
/*#define CONFIG_BOOTCOMMAND "tftp; bootm" */
#define CONFIG_BOOTCOMMAND "tftp 0x30008000 zImage.img/; bootm 30008000"
#if defined(CONFIG_CMD_KGDB)
#define CONFIG_KGDB_BAUDRATE 115200  /* speed to run kgdb serial port */
/* what's this ? it's not used anywhere */
#define CONFIG_KGDB_SER_INDEX 1  /* which serial port to use */
#endif

/*
 * 6:Miscellaneous configurable options
 */
#define CONFIG_SYS_LONGHELP    /* undef to save memory  */
#define CONFIG_SYS_PROMPT  "SMDK2410 # " /* Monitor Command Prompt */
#define CONFIG_SYS_CBSIZE  256  /* Console I/O Buffer Size */
#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16) /* Print Buffer Size */
#define CONFIG_SYS_MAXARGS  16  /* max number of command args */
#define CONFIG_SYS_BARGSIZE  CONFIG_SYS_CBSIZE /* Boot Argument Buffer Size */

#define CONFIG_SYS_MEMTEST_START 0x30000000 /* memtest works on */
#define CONFIG_SYS_MEMTEST_END  0x33F00000 /* 63 MB in DRAM */

#undef  CONFIG_SYS_CLKS_IN_HZ  /* everything, incl board info, in Hz */

#define CONFIG_SYS_LOAD_ADDR  0x33000000 /* default load address */

/* the PWM TImer 4 uses a counter of 15625 for 10 ms, so we need */
/* it to wrap 100 times (total 1562500) to get 1 sec. */
#define CONFIG_SYS_HZ   1562500

/* valid baudrates */
#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }

/*-----------------------------------------------------------------------
 * 7:Stack sizes
 *
 * The stack sizes are set up in start.S using the settings below
 */
#define CONFIG_STACKSIZE (128*1024) /* regular stack */
#ifdef CONFIG_USE_IRQ
#define CONFIG_STACKSIZE_IRQ (4*1024) /* IRQ stack */
#define CONFIG_STACKSIZE_FIQ (4*1024) /* FIQ stack */
#endif

/*-----这部分是增加的代码,以增加对CFI接口NOR Flash的支持,根据2009攻略-------------------------
 * Physical Memory Map
 */
#define CONFIG_NR_DRAM_BANKS 1    /* we have 1 bank of DRAM */
#define PHYS_SDRAM_1  0x30000000 /* SDRAM Bank #1 */
#define PHYS_SDRAM_1_SIZE 0x04000000 /* 64 MB */

#define PHYS_FLASH_1  0x00000000 /* Flash Bank #1 */

#define CONFIG_SYS_FLASH_BASE  PHYS_FLASH_1

/*-----------------------------------------------------------------------
 * 8:FLASH and environment organization
 */

#define CONFIG_AMD_LV400 1 /* uncomment this if you have a LV400 flash */
#if 0
#define CONFIG_AMD_LV800 1 /* uncomment this if you have a LV800 flash */
#endif

#define CONFIG_SYS_MAX_FLASH_BANKS 1 /* max number of memory banks */
#ifdef CONFIG_AMD_LV800
#define PHYS_FLASH_SIZE  0x00100000 /* 1MB */
#define CONFIG_SYS_MAX_FLASH_SECT (19) /* max number of sectors on one chip */
#define CONFIG_ENV_ADDR  (CONFIG_SYS_FLASH_BASE + 0x0F0000) /* addr of environment */
#endif
#ifdef CONFIG_AMD_LV400
#define PHYS_FLASH_SIZE  0x00080000 /* 512KB */
#define CONFIG_SYS_MAX_FLASH_SECT (11) /* max number of sectors on one chip */
#define CONFIG_ENV_ADDR  (CONFIG_SYS_FLASH_BASE + 0x070000) /* addr of environment */
#endif

/* 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 */
 /* Total Size of Environment Sector */
#define  CONFIG_S3C2440            1

//===========1.3.4part========================//
#define  CONFIG_SETUP_MEMORY_TAGS           1
#define  CONFIG_CMDLINE_TAGS           1
#define SECTORSIZE 2048
#define ADDR_COLUMN 2
#define ADDR_PAGE   2
#define ADDR_COLUMN_PAGE 4
#define CONFIG_SYS_NAND_BASE    0x4e000000
#define CONFIG_SYS_MAX_NAND_DEVICE 1
#define NAND_MAXS_CHIPS 1
#define NAND_MAX_FLOORS 1
#define NAND_SECTOR_SIZE SECTORSIZE
#define NAND_BLOCK_MASK (SECTORSIZE-1)
#define CONFIG_S3C2440_NAND_BOOT 1
#define NAND_ChipID_UNKNOWN   0x00
#define CONFIG_MTD_NAND_VERIFY_WRITE 1
//=======================================================//
#endif /* __CONFIG_H */

 

注意到,在1.3.4的攻略中提到对这个文件的修改中,还包含了以下语句,但是我们这里的mini2440.h没有包含,是因为我们直接把这些语句放在了start.S中

@#ifdef CONFIG_S3C2440_NAND_BOOT

#define NAND_CTL_BASE 0x4E000000

/* Offset */

#define oNFCONF 0x00

#define oNFCONT 0x04

#define oNFCMD 0x08

#define oNFSTAT 0x20

#define LENGTH_UBOOT 0x40000

 

我不知道自己移植的时候为何改成了这样,其实也可以尝试按照攻略,把这部分代码添加在mini2440.h中,而不是start.s中,个人认为这样做的规范性好一些。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值