u-boot 配置文件
发布时间:2020-12-15 18:45:44 所属栏目:百科 来源:网络整理
导读:一、配置文件名称和目录 这个配置文件的名称为 ? 开发板名称.txt。 这个配置文件的目录为 ? include/configs/ ?目录。 二、宏定义 整个文件的内容使用条件宏定义 ? ? #ifndef __CONFIG_H #define __CONFIG_H xxxxxxxx xxxxxxxx xxxxxxxx #endif ?/* __CONFIG
一、配置文件名称和目录 这个配置文件的名称为 ? 开发板名称.txt。 这个配置文件的目录为 ? include/configs/ ?目录。 二、宏定义 整个文件的内容使用条件宏定义 ? ? #ifndef __CONFIG_H #define __CONFIG_H xxxxxxxx xxxxxxxx xxxxxxxx #endif ?/* __CONFIG_H */ 来包含起来。 三、内容 1、定义CPU类型和开发板型号 定义 ? ?CPU 的体系结构: #define CONFIG_MIPS32 ? ? ? 1 ? /* MIPS32 CPU core */ ? ? ? ? ? 定义 ? ?CPU 的家族 #define CONFIG_ClxRISC ? ? ?1 ? /* ClxRISC core */ 定义 ? CPU ?的型号 #define CONFIG_CQ8401 ? ? ? 1 ? /* Clx8401 Soc */ 定义 ?开发板的名称 #define CONFIG_MINGDDIE ? ? 1 ? /* Mingddie board */ 2、设置时钟频率 #define CFG_HZ ? ? ? ? ?CFG_EXTAL? 这个 ? ? CFG_HZ ?宏定义在 ? ?net/net.c ?文件中使用到了。 3、定义串口频率 #define CFG_BAUDRATE_TABLE ?{ 9600,19200,38400,57600,115200 } 在这个目录下的每个配置文件都需要定义,一般不改变,在 common/cmd_nvedit.c 文件中需要使用到。 此 ?宏定义 ? 是串口要设置的 ? 比特率。 #define CONFIG_BAUDRATE ? ? 115200 此 ?宏定义 ?指明串口 比特率可以改变。 #define CFG_LOADS_BAUD_CHANGE ? 1 ? /* allow baudrate change ? ?*/ 此 ?宏定义 ?指明串口 ?下载显示进度,可以不定义,但是大多数都进行了定义。 #define CONFIG_LOADS_ECHO ? 1 ? /* echo on for serial download ?*/ 4、定义u-boot的命令 #define CONFIG_COMMANDS ? ? (CONFIG_CMD_DFL | ? ? ? ? ? ? ? ? ?CFG_CMD_ASKENV | ? ? ? ? ? ? ? ? ?CFG_CMD_DHCP ? | ? ? ? ? ? ? ? ? ?CFG_CMD_PING ? | ? ? ? ? ? ? ? ? ?CFG_CMD_IDE ? ?| ? ? ? ? ? ? ? ? ?CFG_CMD_PCI ? ?| ? ? ? ? ? ? ? ? ?CFG_CMD_EXT2FS | ? ? ? ? ? ? ? ? ?CFG_CMD_EXT2 ? | ? ? ? ? ? ? ? ? ?CFG_CMD_NET & ~CFG_CMD_FLASH) 可以自己添加,具体添加命令的步骤,可以参考《u-boot命令的添加》。 /* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */ #include <cmd_confdefs.h> 包含 ? ?cmd_confdefs.h ?这个头文件,必须在 ? CONFIG_COMMANDS ?这个宏定义之后。 5、定义环境变量 #define CONFIG_BOOTDELAY ? ?3 #define CONFIG_BOOTFILE ? ? "vmlinux-26" ? ?/* file to load */ #define CONFIG_BOOTARGS ? ? "mem=64M console=tty0 console=ttyS0,115200n8 ip=192.168.4.118 root=/dev/nfs nfsroot=192.168.4.120:/opt/cq8401 rw" #define CONFIG_BOOTCOMMAND ?"set serverip 192.168.4.120; set ipaddr 192.168.4.118; tftp;bootm;" #define CFG_AUTOLOAD ? ? ? ?"n" /* No autoload */ #define CONFIG_NET_MULTI #define CONFIG_ETHADDR ? ? ?00:50:c2:1e:af:3e ? /* Ethernet address */ 6、定义杂项 定义命令的 ?HELP 信息的显示。 #define CFG_LONGHELP ? ? ? ? ? ?/* undef to save memory ? ? ?*/ 定义u-boot命令行的提示符。 #define CFG_PROMPT ? ? ?"Mingddie # " ? /* Monitor Command Prompt ? ?*/ 定义u-boot 命令行的 ? I/O Buffer ?大小。 #define CFG_CBSIZE ? ? ?256 ? ? /* Console I/O Buffer Size ? */ 定义u-boot ?命令行 ?可显示的 ? Buffer 大小。 #define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) ? /* Print Buffer Size */ 定义u-boot 的命令最多有多少个参数。 #define CFG_MAXARGS ? ? 16 ? ? ?/* max number of command args */ 定义 ?内存 布局的 ? MALLOC 和 ?BOOTPARAMS 段的长度。 #define CFG_MALLOC_LEN ? ? ?128*1024 #define CFG_BOOTPARAMS_LEN ?128*1024 定义 ? SDRAM ?的起始地址。 #define CFG_SDRAM_BASE ? ? ?0x80000000 ?/* Cached addr */ 定义 ?初始化时的 ? 栈指针在 ? ?SDRAM 中的偏移。 #define CFG_INIT_SP_OFFSET ?0x400000 定义下载内核的 ? 加载地址。 #define CFG_LOAD_ADDR ? ? ? 0x80700000 ?/* default load address ?*/ 定义 ? u-boot 命令 ?mtest 的起始地址和结束地址。 #define CFG_MEMTEST_START ? 0x80100000 #define CFG_MEMTEST_END ? ? 0x80800000 定义 ?CQ8401 开发板网卡的 ? 接收和发送 ? buffer 数目。 #define CFG_RX_ETH_BUFFER ? 16 ?/* use 16 rx buffers on clx eth */ 7、定义 ?FLASH 的配置 定义 ?FLASH 的 BANK 数目。 #define CFG_MAX_FLASH_BANKS 1 ? /* max # of memory banks ? ?*/ 选择 ?FLASH 的初始化和读写函数。 #define CFG_FLASH_CFI ? ? ? 1 ? /* flash is CFI conformant ?*/ #define CFG_FLASH_CFI_DRIVER ? ?1 ? /* use common cfi driver ? ?*/ 设置 ?FLASH 的基本物理特性,初始化时使用。 #define CFG_FLASH_USE_BUFFER_WRITE 1 ? ?/* use buffered writes (20x faster) */ #define CFG_MAX_FLASH_SECT ?128 /* max # of sectors on one chip */ #define PHYS_FLASH_SECT_SIZE ? ?(128*1024) ?/* Size of a sector (128kB) */ #define PHYS_FLASH_1 ? ? ? ?0xbf000000 ?/* Flash Bank #1 */ #define CFG_FLASH_BASE ? ? ?PHYS_FLASH_1 ? ?/* Flash at 0xbf000000 - 0xbfffffff */ 定义 ?Monitor 的长度和基地址。 #define CFG_MONITOR_BASE ? ?0xbfc00000 #define CFG_MONITOR_LEN ? ? (256*1024) ?/* Reserve 256 kB for Monitor */ 定义 ? Flash 的读写超时。 #define CFG_FLASH_ERASE_TOUT ? ?(20*CFG_HZ) /* Timeout for Flash Erase */ #define CFG_FLASH_WRITE_TOUT ? ?(20*CFG_HZ) /* Timeout for Flash Write */ 定义环境变量是否保存在 ? ?Flash 中,选择 ? 环境变量保存的介质,不同的介质,选择common/目录下不同的函数。 #define CFG_ENV_IS_IN_FLASH 1 还可以选择 CFG_ENV_IS_IN_DATAFLASH ? 这个宏定义了 ?环境变量 ?是 ?Environment is in DataFlash CFG_ENV_IS_IN_EEPROM ? ? ?/* Environment is in EEPROM */ CFG_ENV_IS_IN_FLASH ? ? ? /* Environment is in Flash */ CFG_ENV_IS_IN_NAND ? ? ? ?/* Environment is in Nand Flash */ CFG_ENV_IS_NOWHERE ? ? ? ?/* Environment is nowhere */ CFG_ENV_IS_IN_NVRAM ? ? ? /* Environment is in NVRAM */ 定义环境变量所占用空间的总大小。 #define CFG_ENV_SECT_SIZE ? 0x20000 /* Total Size of Environment Sector */ #define CFG_ENV_SIZE ? ? ? ?CFG_ENV_SECT_SIZE 定义环境变量保存的起始地址。 #define CFG_ENV_ADDR ? ? ? ?(CFG_MONITOR_BASE + CFG_MONITOR_LEN) ? ?/* Environment after Monitor */ 定义 ? u-boot 命令 ? tftp 命令执行时是否可以读写 ?flash。 #define CFG_DIRECT_FLASH_TFTP ? 1 ? /* allow direct tftp to flash */ 定义 ? u-boot 命令 ?setenv 命令执行时是否可以设置 ? ?(ethaddr)和(serial#)环境变量。 #define CONFIG_ENV_OVERWRITE ? ?1 ? /* allow overwrite MAC address */ 8、 ?定义 ? ?SDRAM 的配置 定义 ? SDRAM 的 ?BANK 数目。 #define CONFIG_NR_DRAM_BANKS ? ?1 // SDRAM paramters #define SDRAM_BW16 ? ? ?0 ? ? ? /* Data bus width: 0-32bit,1-16bit */ #define SDRAM_BANK4 ? ? 1 ? ? ? /* Banks each chip: 0-2bank,1-4bank */ #define SDRAM_ROW ? ? ? 13 ? ? ?/* Row address: 11 to 13 */ #define SDRAM_COL ? ? ? 9 ?/* Column address: 8 to 12 */ ? ?/* 9 for 64M,10 for 128M */ #define SDRAM_CASL ? ? ?2 ? ? ? /* CAS latency: 2 or 3 */ //#define CFG_COL_NUMS ?SDRAM_COL-1 ? ? /* SDRAM Columns number,this parameter useful the DRAM ? ? size,8 for 64M,9 for 128M */ // SDRAM Timings,unit: ns #define SDRAM_TRAS ? ? ?45 ? ? ?/* RAS# Active Time */ #define SDRAM_RCD ? ? ? 20 ? ? ?/* RAS# to CAS# Delay */ #define SDRAM_TPC ? ? ? 20 ? ? ?/* RAS# Precharge Time */ #define SDRAM_TRWL ? ? ?7 ? ? ? /* Write Latency Time */ #define SDRAM_TREF ? ? ? ? ?7812 ? ?/* Refresh period: 8192 refresh cycles/64ms */ 9、 ?定义 ? CACHE 的配置 定义 ?Data Cache 大小。 #define CFG_DCACHE_SIZE ? ? 16384 定义 ?指令 ? Cache 大小。 #define CFG_ICACHE_SIZE ? ? 16384 定义 ?Cache line 大小。 #define CFG_CACHELINE_SIZE ?32
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |