nuc972-evb配置文件解析

时间:2024-03-06 12:45:27

NUC970 配置文件位于 include/configs/nuc970_evb.h

#ifndef __CONFIG_H
#define __CONFIG_H

#define EXT_CLK	        12000000        /* 12 MHz crystal */

外部采用12M晶振

#define CONFIG_SYS_TEXT_BASE		0xE00000
#define CONFIG_SYS_LOAD_ADDR            0x8000
#define CONFIG_SYS_MEMTEST_START         0xA00000
#define CONFIG_SYS_MEMTEST_END           0xB00000
#define CONFIG_ARCH_CPU_INIT
#undef  CONFIG_USE_IRQ               
#define CONFIG_CMDLINE_TAG	1	/* enable passing of ATAGs	*/
#define CONFIG_SETUP_MEMORY_TAGS 1
#define CONFIG_INITRD_TAG	1
/*#define CONFIG_NUC970_HW_CHECKSUM */
/*#define CONFIG_SYS_USE_SPIFLASH */
#define CONFIG_SYS_USE_NANDFLASH  
#define CONFIG_ENV_IS_IN_NAND 
/*#define CONFIG_ENV_IS_IN_SPI_FLASH */
/*#define CONFIG_ENV_IS_IN_MMC */
#define CONFIG_BOARD_EARLY_INIT_F
#define CONFIG_BOARD_LATE_INIT
#define CONFIG_HW_WATCHDOG
#define CONFIG_SYS_BOOTM_LEN		0x1000000 /* 16MB max kernel size */
#define CONFIG_BOOTDELAY	1

/*启动中 指定只有esc按键才能进入uboot*/
#define	CONFIG_AUTOBOOT_KEYED 1
#define CONFIG_AUTOBOOT_PROMPT	"Press ESC to abort autoboot in %d seconds"
#define CONFIG_AUTOBOOT_DELAY_STR	"linux"
#define CONFIG_AUTOBOOT_STOP_STR	"\x1b" //esc按键

#define CONFIG_SYS_SDRAM_BASE   0
#define CONFIG_NR_DRAM_BANKS    2     /* there are 2 sdram banks for nuc970 */
#define CONFIG_SYS_INIT_SP_ADDR 0xBC008000

#define CONFIG_BAUDRATE         115200
#define CONFIG_SYS_BAUDRATE_TABLE       {115200, 57600, 38400}

/*#define CONFIG_NUC970_EMAC1*/
/*#define CONFIG_CMD_NET */
#define CONFIG_ETHADDR                  00:00:00:11:66:88
#define CONFIG_SYS_RX_ETH_BUFFER        16 // default is 4, set to 16 here.

/*#define CONFIG_KPI_NUC970*/

/*#undef CONFIG_SYS_ICACHE_OFF */
/*#undef CONFIG_SYS_DCACHE_OFF */
/*#define CONFIG_SYS_ICACHE_OFF*/
#define CONFIG_SYS_DCACHE_OFF

/*
* BOOTP options
*/
#if 1
#define CONFIG_BOOTP_BOOTFILESIZE	1
#define CONFIG_BOOTP_BOOTPATH		1
#define CONFIG_BOOTP_GATEWAY		1
#define CONFIG_BOOTP_HOSTNAME		1
#define CONFIG_BOOTP_SERVERIP /* tftp serverip not overruled by dhcp server */
#endif

/*
* Command line configuration.
*/
#if 0
#include <config_cmd_default.h>

#undef CONFIG_CMD_LOADS
#undef CONFIG_CMD_SOURCE
#endif

#if 0
#ifdef CONFIG_SYS_USE_SPIFLASH
#undef CONFIG_CMD_IMLS  /*====================> SPI only */
#undef CONFIG_CMD_JFFS2
#endif

#ifdef CONFIG_KPI_NUC970
/*#define CONFIG_KPI_PA_PORT   1 */   /* KPI select PA port */
#define CONFIG_KPI_PH_PORT   1  /* KPI select PH port */
#define CONFIG_KPI_ROW_NUM   3  /* row number is 1~4 */
#define CONFIG_KPI_COL_NUM   3  /* col number is 1~8 */
#define CONFIG_KPI_DEBOUNCE  8  /* debounce length setting: 0~13 */
#endif
#endif

#ifdef CONFIG_SYS_USE_NANDFLASH
#define CONFIG_CMD_NAND		1
#define CONFIG_CMD_UBI         1 
#define CONFIG_CMD_UBIFS       1 
#define CONFIG_MTD_UBI_WL_THRESHOLD  4096 /* CWWeng 2017.2.13 */
#define CONFIG_MTD_UBI_BEB_LIMIT  20 /* CWWeng 2017.2.13 */
#define CONFIG_CMD_MTDPARTS    1 
#define CONFIG_MTD_DEVICE      1 
#define CONFIG_MTD_PARTITIONS  1 
#define CONFIG_RBTREE          1 
#define CONFIG_LZO             1 
#define CONFIG_SYS_NAND_ONFI_DETECTION 1

#define MTDIDS_DEFAULT "nand0=nand0"
/*#define MTDPARTS_DEFAULT "mtdparts=nand0:0x200000@0x0(u-boot),0x1400000@0x200000(kernel),-(user)"*/
/*#define MTD_ACTIVE_PART "nand0,2"*/
#define MTDPARTS_DEFAULT "mtdparts=nand0:8M(bootstrap/uboot/kernel)ro,16M(rootfs),16M(appbin),-(appdapa)"

mtdparts nandflash分区配置信息,此信息和kernel里.config里id,地址要求一致

#define MTD_ACTIVE_PART "nand0,1"
/* #define CONFIG_CMD_NAND_YAFFS2 1 */
/* #define CONFIG_YAFFS2          1 */
#define CONFIG_SYS_MAX_NAND_DEVICE	1
#define CONFIG_SYS_NAND_BASE	0xB000D000
#define CONFIG_SYS_NAND_ECCBYTES        12
#ifdef CONFIG_ENV_IS_IN_NAND
#define CONFIG_ENV_OFFSET       0x80000
#define CONFIG_ENV_SIZE         0x10000
#define CONFIG_ENV_SECT_SIZE    0x20000
#define CONFIG_ENV_RANGE	        (4 * CONFIG_ENV_SECT_SIZE)  /* Env range : 0x80000 ~ 0x100000 */
#define CONFIG_ENV_OVERWRITE
#endif
#define CONFIG_BOOTCOMMAND	"nboot 0x7fc0 0 0x200000 ;"\
				"bootm 0x7fc0"
#endif

nboot 0x7fc0 0 0x200000 命令将 Linux 内核镜像文件从 NAND flash 偏移量 0x200000 这个地址读取到 DDR 0x7fc0 的地址.。

bootm 0x7fc0 命令是用来启动由 mkimage 工具产生的 Linux 内核或其他应用程序。相较于 bootm 命令, go 命令是来启动 “非” 经由 mkimage 工具产生的。

#define CONFIG_SYS_NAND_U_BOOT_OFFS     0x100000   /* Offset to RAM U-Boot image */

#define CONFIG_SPL_TEXT_BASE	0x200
#define CONFIG_SPL_STACK 	0xBC008000

#define CONFIG_SPL_NAND_SIMPLE
#define CONFIG_SPL_NAND_LOAD
#define CONFIG_SPL_NAND_BASE
#define CONFIG_SPL_NAND_DRIVERS
#define CONFIG_SPL_NAND_ECC

#ifdef CONFIG_SPL_BUILD /* CONFIG_NAND_SPL */
/* base address for uboot */
#define CONFIG_SYS_PHY_UBOOT_BASE       (CONFIG_SYS_SDRAM_BASE + 0xE00000)

#define CONFIG_SYS_NAND_U_BOOT_DST      CONFIG_SYS_PHY_UBOOT_BASE       /* NUB load-addr      */
#define CONFIG_SYS_NAND_U_BOOT_START    CONFIG_SYS_NAND_U_BOOT_DST      /* NUB start-addr     */

#define CONFIG_SYS_NAND_U_BOOT_SIZE     (500 * 1024)    /* Size of RAM U-Boot image   */

#endif 


#if 0
/* SPI flash */
#ifdef CONFIG_SYS_USE_SPIFLASH
#define CONFIG_SPI              1
#ifdef CONFIG_ENV_IS_IN_SPI_FLASH
#define CONFIG_ENV_OFFSET       0x80000
#define CONFIG_ENV_SIZE         0x10000
#define CONFIG_ENV_SECT_SIZE    0x10000
#define CONFIG_ENV_OVERWRITE
#endif 
#endif
#endif

/*#define CONFIG_SYS_PROMPT		"U-Boot> "  */
#define CONFIG_SYS_CBSIZE		256
#define CONFIG_SYS_MAXARGS		16
#define CONFIG_SYS_PBSIZE		(CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
#define CONFIG_SYS_LONGHELP		1
#define CONFIG_CMDLINE_EDITING		1
#define CONFIG_AUTO_COMPLETE
#define CONFIG_SYS_PROMPT_HUSH_PS2	"> "

#if 0
/* Following block is for LCD support */
#ifdef CONFIG_LCD
/*#define CONFIG_NUC977_LCD*/
#define LCD_BPP                         LCD_COLOR16
#define CONFIG_LCD_LOGO
#define CONFIG_LCD_INFO
#define CONFIG_LCD_INFO_BELOW_LOGO
/*#define CONFIG_SYS_CONSOLE_IS_IN_ENV*/
/*#define CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE*/
#define CONFIG_CONSOLE_SCROLL_LINES	1 
#endif
#endif

#if 0
/* Following block is for MMC support */
#ifdef CONFIG_NUC970_MMC
#define CONFIG_CMD_MMC
#define CONFIG_CMD_FAT
/*#define CONFIG_MMC */
/*#define CONFIG_GENERIC_MMC */
#define CONFIG_DOS_PARTITION
/*#define CONFIG_MMC_TRACE */
/*#define CONFIG_NUC970_SD_PORT0 */
/*#define CONFIG_NUC970_SD_PORT1 */
/*#define CONFIG_NUC970_EMMC */      /* Don\'t enable eMMC(CONFIG_NUC970_EMMC) and NAND(CONFIG_NAND_NUC970) at the same time! */
#ifdef CONFIG_ENV_IS_IN_MMC
#define CONFIG_SYS_MMC_ENV_DEV  1
#define CONFIG_ENV_OFFSET       0x80000
#define CONFIG_ENV_SIZE         /*2048*/0x10000
#define CONFIG_ENV_SECT_SIZE    512
#define CONFIG_ENV_OVERWRITE
#endif
#endif
#endif

/* Following block is for EHCI support*/
#if 1
/*#define CONFIG_CMD_USB*/
/*#define CONFIG_CMD_FAT*/
/*#define CONFIG_USB_STORAGE*/
/*#define CONFIG_USB_EHCI*/
/*#define CONFIG_USB_EHCI_NUC970*/
#define CONFIG_EHCI_HCD_INIT_AFTER_RESET
#define CONFIG_DOS_PARTITION
#endif


/*#define CONFIG_OF_LIBFDT */
/*#define CONFIG_FIT */

/*
 * Size of malloc() pool
 */
#define CONFIG_SYS_MALLOC_LEN	(1024*1024) /*ROUND(3 * CONFIG_ENV_SIZE + 128*1024, 0x1000)  */

#define CONFIG_STACKSIZE	(32*1024)	/* regular stack */

#endif