Chinaunix首页 | 论坛 | 博客
  • 博客访问: 17753
  • 博文数量: 12
  • 博客积分: 1420
  • 博客等级: 上尉
  • 技术积分: 105
  • 用 户 组: 普通用户
  • 注册时间: 2009-12-24 13:10
文章存档

2010年(10)

2009年(2)

我的朋友

分类: 嵌入式

2010-11-28 00:02:27

1 修改Makefile文件

u-boot-1.1.6的根目录下,打开Makefile文件,添加如下代码:

z228_config:   unconfig

       @./mkconfig $(@:_config=) arm arm926ejs z228 NULL z228

我们解释一下代码:

arm,就表示现在用的是CPU的架构是arm体系结构。

arm926ejs,指明这是cpu的内核类型,它对应于cpu/ arm926ejs目录。

z228,这是开发板的型号,它的目录在board/z228目录下。

NULL,表示开发者或者经销商是谁(vender)。

z228,表示开发板上的cpu.

2 建立自己的开发板文件

board目录下建立z228文件夹,在z228中添加几个文件,它们是lowlevel_init.S(这个文件主要完成对SDRAM的初始化,cpu/ arm926ejs/start.s调用lowlevel_init)z228.cz228.c是和我选择的名字有关,在z228中叫z228.c)、u-boot.lds(在该文件中定义了程序的入口点,代码段、数据段等分配情况)config.mk(这个文件指定TEXT_BASE的地址)Makefileflash.cflash.c是关于开发板中flash的最底层的驱动程序,它主要实现了对flash的基本操作,如读、写、擦除等操作。

3 建立自己的开发板时钟文件

cpu/ arm926ejs/目录下建立z228文件夹,参照cpu/ arm926ejs/versatile中的文件,在z228目录中添加时钟文件。

4 建立自己的配置文件

include/configs目录下建立配置文件z228.h

 

#ifndef __CONFIG_H

#define __CONFIG_H

 

/*

 * High Level Configuration Options

 * (easy to change)

 */

#define CONFIG_ARM926EJS      1     /* This is an arm926ejs CPU core  */

#define CONFIG_Z228                   1     /* in Z228 Development Board  */

#define CONFIG_ARCH_Z228    1   /* Specifically, a Z228 */

 

#define CFG_MEMTEST_START       0x00200000

#define CFG_MEMTEST_END         0x00ffffff

 

/*

 * Clock configuration of Z228

 */

#define CONFIG_Z228_13MCLK                      13100000

#define CONFIG_Z228_12MCLK                      12092000

#define CONFIG_Z228_EXTCLK                       CONFIG_Z228_12MCLK

 

/* Default mode CPU working at 133MHz */

#ifdef CONFIG_Z228_133M

#define CONFIG_Z228_SCLK                            (CONFIG_Z228_EXTCLK * 10)

#endif

 

/* Normal mode CPU working at 266MHz */

#define CONFIG_Z228_266M

#ifdef CONFIG_Z228_266M

#define CONFIG_Z228_SCLK                            (CONFIG_Z228_EXTCLK * 20)

#endif

 

#define CONFIG_Z228_ARM926EJ_CORE_CLK   (CONFIG_Z228_SCLK)

#define CONFIG_Z228_HCLK                           (CONFIG_Z228_SCLK / 2)

#define CONFIG_Z228_PCLK                            (CONFIG_Z228_HCLK / 2)

#define CONFIG_Z228_TIMCLK                       (CONFIG_Z228_PCLK / 2)   

 

#define CFG_HZ                                (CONFIG_Z228_TIMCLK / 256) 

 

#define CFG_TIMERBASE           0x20022000      /* Timer 0 and 1 base fixed for Z228*/

 

/* Timer Interval should very long enough for time counting */

#define CFG_TIMER_INTERVAL  300000

#define CFG_TIMER_RELOAD     (CFG_TIMER_INTERVAL >> 8)   /* Divide by 256 */

 

#define CFG_TIMER_CTRL          0x8a                  /* Enable, Clock / 256, 32bit timer */

 

/* Disable timeout waiting in Flash and Ethernet operation */

#undef Z228_FLASH_TIMEOUT                       

 

/* Set Z228 MPMC TIMEOUT value to stop the Linux/WinCE LCD blinking, the specific value will be modified again later */

#define CONFIG_Z228_MPMCTIMEOUT

 

/*

 * control registers

 */

#define Z228_SCTL_BASE            0x20020000    /* System controller fixed for Z228 */

 

/*

 * System controller bit assignment

 */

#define Z228_REFCLK     0

#define Z228_TIMCLK     1

 

#define Z228_TIMER1_EnSel  15

#define Z228_TIMER2_EnSel  17

#define Z228_TIMER3_EnSel  19

#define Z228_TIMER4_EnSel  21

 

#define CONFIG_CMDLINE_TAG              1     /* enable passing of ATAGs  */

#define CONFIG_SETUP_MEMORY_TAGS     1

#define CONFIG_MISC_INIT_R          1     /* call misc_init_r during start up */

/*

 * Size of malloc() pool

 */

#define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024)

#define CFG_GBL_DATA_SIZE    128 /* size in bytes reserved for initial data */

 

 

/*

 * Hardware drivers

 */

#define CONFIG_COMMANDS    (CFG_CMD_IMI | CFG_CMD_LOADB | CFG_CMD_MEMORY | CFG_CMD_FLASH | CFG_CMD_ENV )

 

/*

 * Serial interface Configuration fixed for Z228

 */

#define CFG_PL011_SERIAL

#define CONFIG_PL011_CLOCK  (CONFIG_Z228_PCLK / 2)

#define CONFIG_PL01x_PORTS   { (void *)CFG_SERIAL0, (void *)CFG_SERIAL1, (void *)CFG_SERIAL2, (void *)CFG_SERIAL3}

#define CONFIG_CONS_INDEX  0

 

#define CONFIG_BAUDRATE        115200

#define CFG_BAUDRATE_TABLE      { 1200, 9600, 19200, 38400, 57600, 115200 }

#define CFG_SERIAL0            0x20030000

#define CFG_SERIAL1            0x20031000

#define CFG_SERIAL2            0x20032000

#define CFG_SERIAL3            0x20033000

 

 

#define CONFIG_ZERO_BOOTDELAY_CHECK

#define CONFIG_BOOTP_MASK CONFIG_BOOTP_DEFAULT

 

/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */

#include

 

#define CONFIG_BOOTDELAY    3

 

#define CONFIG_BOOTARGS "mem=64M init=/linuxrc console=ttyAMA0,9600  root=/dev/mtdblock2 rw rootfstype=jffs2"

#define CONFIG_BOOTARGS_DEBUG "mem=64M init=/linuxrc console=ttyAMA0,115200  root=/dev/mtdblock2 rw rootfstype=jffs2"

 

 

#define CONFIG_BOOTCOMMAND "cp.b 0xc4040000 0x7fc0 0x200000 ; bootm"

 

#define CONFIG_CMDLINE_EDITING

 

/*

 * Static configuration when assigning fixed address

 */

 

#define CONFIG_ENV_OVERWRITE

 

#define CONFIG_ETHADDR 08:00:3e:26:0a:5c

#define CONFIG_NETMASK 255.255.255.0     /* talk on MY local net */

#define CONFIG_IPADDR      192.168.102.88          /* static IP I currently own */

#define CONFIG_SERVERIP  192.168.102.100        /* current IP of my dev pc */

#define CONFIG_BOOTFILE     "uImage"       /* file to load */

#define CONFIG_GATEWAYIP 192.168.102.254    /* Gateway IP setting */

 

/*

 * Miscellaneous configurable options

 */

#define CFG_LONGHELP       /* undef to save memory     */

#define CFG_PROMPT     "Satir # " /* Monitor Command Prompt   */

#define CFG_CBSIZE       256        /* Console I/O Buffer Size  */

/* Print Buffer Size */

#define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16)

#define CFG_MAXARGS 32          /* max number of command args   */

#define CFG_BARGSIZE  CFG_CBSIZE     /* Boot Argument Buffer Size    */

 

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

#define CFG_LOAD_ADDR    0x7fc0    /* default load address */

 

/*-----------------------------------------------------------------------

 * 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

 

/*-----------------------------------------------------------------------

 * Physical Memory Map

 */

#define CONFIG_NR_DRAM_BANKS    1    /* we have 1 bank of DRAM */

#define PHYS_SDRAM_1            0x00000000      /* SDRAM Bank #1 */

#define PHYS_SDRAM_1_SIZE       0x04000000      /* 64 MB */

 

/* 1 bank of FLASH, total 16M Bytes */

#define CFG_MAX_FLASH_BANKS          1                   /* max number of memory banks */

#define PHYS_FLASH_1                0xc0000000  /* nSMCS0 */

#define PHYS_FLASH_1_SIZE        0x00000000     /* 0MB */

#define PHYS_FLASH_2             0xc4000000  /* nSMCS3 remap area */

#define PHYS_FLASH_2_SIZE        0x01000000     /* 16MB */

#define CFG_FLASH_BASE          (PHYS_FLASH_2)  /* nSMCS3 */

#define CFG_FLASH_BANKS_LIST    {/* PHYS_FLASH_1, */PHYS_FLASH_2 }

 

#define PHYS_FLASH_SECT_SIZE    (128*1024)  /* Size of a sector (128KB) */

#define CFG_MAX_FLASH_SECT     (512)   /* max number of sectors on one chip */

 

#define CFG_MONITOR_BASE    (CFG_FLASH_BASE) /* 0xc4000000 for U-Boot */

#define CFG_ENV_ADDR        (CFG_MONITOR_BASE + PHYS_FLASH_SECT_SIZE)

#define CFG_MONITOR_LEN     PHYS_FLASH_SECT_SIZE    /* Reserve 1 sector */

 

/*-----------------------------------------------------------------------

 * FLASH and environment organization

 */

 

/* Timeout values are in ticks */

#define CFG_FLASH_ERASE_TOUT   (20*CFG_HZ)     /* Timeout for Flash Erase */

#define CFG_FLASH_WRITE_TOUT   (20*CFG_HZ)     /* Timeout for Flash Write */

#define CFG_MAX_FLASH_SECT              (512)

 

#define CFG_ENV_IS_IN_FLASH     1               /* env in flash instead of CFG_ENV_IS_NOWHERE */

//#define CFG_ENV_IS_NOWHERE     1               /* env in flash instead of CFG_ENV_IS_NOWHERE */

#define CFG_ENV_SECT_SIZE       (128*1024)      /* 128 KB sectors */

#define CFG_ENV_SIZE            CFG_ENV_SECT_SIZE         /* Total Size of Environment Sector */

#define CFG_ENV_OFFSET          ( CFG_MONITOR_BASE + CFG_MONITOR_LEN )  /* environment starts here  */

 

#endif                                               /* __CONFIG_H */

阅读(408) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~