原文出處:
http://www.embhelp.com/drew/mypage/example/config.htm#config
config.h
/*
This file contains the configuration parameters for the CPU evaluation board.
*/
#ifndef INCconfigh
#define INCconfigh
/* BSP version/revision identification, before configAll.h */
#define BSP_VER_1_2 1
#define BSP_VER_1_1 1
#define BSP_VERSION "1.2" /* A Tornado 2.0 BSP */
#define BSP_REV "/3" /* 0 for first revision */
#include "configAll.h" /* 這個檔案定義了VxWorks所有的預設設定 */
/*
* Define ONE of the following to specify the revision of the PPC405GP chip
* you are using. Undefine all others. sysModel() will return
* "Unknown processor" if the correct selection is not made.
*/
/*
* Default boot line
*/
/*
解釋: 這一行對配置網路,連通Target Server及下載偵錯工具非常重要
DEFAULT_BOOT_LINE 的原意是為沒有NVRAM的target設計的,這樣使用者就不需要在每次系統啟動是手工輸入這些參數了.
系統啟動網路時xxxEndLoad()會解釋這一行並按這一行的定義進行載入.
Emac(0,0) : 啟動裝置,可是是磁碟片,硬碟,PCMCIA卡等 其他的裝置名稱如:
fd為磁碟片,(0,0)表示第一個軟碟機,3.5寸盤.
dc則表示從DEC 21x4x 晶片啟動,即系統有NVRAM存在,這種方式現在已不採用.
elpci表示啟動裝置為3COM EtherLink XL PCI網卡.
fei:Intel 82559 EtherExpress網卡.
ene: NE2000網卡
ELT: 3COM乙太網路卡
EEX: Intel網卡
ata: ATA/IDE 硬碟 ............
405GP: 主機名稱
vXworks 從主機載入的VxWorks檔案
h=172.16.1.159 主機的IP地址
e=172.16.254.52 目標機的IP地址,若網路啟動Target Server時,這個IP必須和主機上Target Server配置的Target IP地址一致,且設定Back End選項為wdbrpc
u=xxx 使用者名稱,pw=xxx 密碼: 若通過網路載入調試時,主機的Ftp伺服器和目標機的使用者名稱和密碼必須相同
tn=vxTarget 目標機名稱
*/
#define DEFAULT_BOOT_LINE \
"Emac(0,0)405GP:vxWorks h=172.16.1.159 e=172.16.254.52 \
u=xxx pw=xxx tn=vxTarget"
/*
* 記憶體設定.
* 如果定義了LOCAL_MEM_AUTOSIZE則SDRAM的大小會在Boot時指定
*/
#undef LOCAL_MEM_AUTOSIZE /* 運行時記憶體大小 */
#define LOCAL_MEM_SIZE 0x02000000 /* 32MB 記憶體預設 */
#define LOCAL_MEM_LOCAL_ADRS 0x00000000 /* 記憶體基地址為 0 */
#define USER_RESERVED_MEM 0 /* see sysMemTop() */
/*
* Define SDRAM_ECC_ENABLE to enable ECC if an ECC SDRAM DIMM is detected
* during SDRAM auto-configuration. If not defined, ECC will not be enabled
* if an ECC SDRAM DIMM is detected, and the DIMM will be used as a normal DIMM.
*/
#undef SDRAM_ECC_ENABLE
/* 解釋: 這裡主要設定系統的記憶體配置定義,若分配不當,則系統不能正常載入和運行.
ROM_TEXT_ADRS, ROM_SIZE, RAM_HIGH_ADRS, 和RAM_LOW_ADRS 在config.h和Makefile檔案中都要定義,且必須要保持一致,這些地址的定義一定要參照VxWorks 載入執行過程,硬體手冊,MMU和VxWorks的大小進行.主要原則是保證VxWorks image 在ROM和RAM中都要有一定的Runspace且高效運行,可參見 VxWorks
BSP和啟動過程.
*/
#define ROM_BASE_ADRS 0xfff80000 /* ROM的基地址 */
#define ROM_TEXT_ADRS (ROM_BASE_ADRS + 0x100) /* 程式指標和堆棧指標 */
#define ROM_WARM_ADRS (ROM_TEXT_ADRS+0x0004) /* 暖開機入口地址 */
#define ROM_SIZE 0x0007f000 /* ROM大小 512KB */
#define RAM_LOW_ADRS 0x00010000 /* RAM 低地址運行 vxWorks */
#define RAM_HIGH_ADRS 0x00C00000 /* RAM 高地址儲存 bootrom */
#define USER_RESERVED_MEM 0 /* 使用者保留地址 */
/*
* Cache options 定義緩衝
*/
#define INCLUDE_CACHE_SUPPORT
#define USER_D_CACHE_ENABLE
#define USER_I_CACHE_ENABLE
#undef USER_D_CACHE_MODE
#define USER_D_CACHE_MODE (CACHE_COPYBACK)
/*
* 405 timers (PIT, FIT, WDT) 可由外部時鐘驅動或者CPU驅動
*/
#define TIMER_CLOCK_EXTERNAL
/*
* Optional timestamp support
*/
#undef INCLUDE_TIMESTAMP
/*
* Auxilliary Timer rates 定義輔助計時器頻率
*/
#ifdef TIMER_CLOCK_EXTERNAL
#define AUX_CLK_RATE_MIN (EXT_TIMER_CLK_FREQ / (1 << 21) )
#define AUX_CLK_RATE_MAX (EXT_TIMER_CLK_FREQ / (1 << 9) )
#define AUX_CLK_RATE_DEFAULT (EXT_TIMER_CLK_FREQ / (1 << 17) )
#else
/* ZZZZZZZZZZZ todo put rates in for system clock derived timer clock */
#endif
/*
* Watchdog Timer rates
*/
#define WDT_RATE_MIN 1 /* minimum watchdog timer rate */
#define WDT_RATE_MAX 5000 /* maximum watchdog timer rate */
/* 系統時鐘設定 */
#define INCLUDE_RTC
/* 去除不需要的網路驅動 */
#undef INCLUDE_EI
#undef INCLUDE_EX
#undef INCLUDE_ENP
#undef INCLUDE_LN
#undef INCLUDE_SM_NET
#undef INCLUDE_SM_SEQ_ADDR
/* #define for software floating point support */
#undef INCLUDE_SW_FP
/* 定義串口 Serial port configuration */
#define INCLUDE_SERIAL
/* PCI 設定,PCI configuration */
#define INCLUDE_PCI
#ifdef INCLUDE_PCI
/*
* Three programmable processor local memory address to PCI memory address
* mappings. If a region is enabled, PMMx_LOCAL_ADRS must be between
* PCI_MEMORY_START and PCI_MEMORY_END. If PMMx_PCI_HIGH_ADRS is non-zero in
* an enabled region, 64 bit dual cycle addresses will be generated on the
* PCI bus for this region.
*/
//定義PCI裝置的初始化地址 參見 PCI裝置(網卡)初始化程式碼分析
# define PMM0_LOCAL_ADRS PCI_MEMORY_START // 定義PCI空間起始地址
# define PMM0_PCI_LOW_ADRS 0x80000000 // 定義PCI空間低位地址
# define PMM0_PCI_HIGH_ADRS 0x00000000 // 定義PCI空間高位地址
# define PMM0_PCI_MASK_ATTRIB (PMM_MASK_512MB | PMM_ENABLE)
# define PMM1_LOCAL_ADRS PMM_UNUSED
# define PMM1_PCI_LOW_ADRS PMM_UNUSED
# define PMM1_PCI_HIGH_ADRS PMM_UNUSED
# define PMM1_PCI_MASK_ATTRIB PMM_UNUSED
# define PMM2_LOCAL_ADRS PMM_UNUSED
# define PMM2_PCI_LOW_ADRS PMM_UNUSED
# define PMM2_PCI_HIGH_ADRS PMM_UNUSED
# define PMM2_PCI_MASK_ATTRIB PMM_UNUSED
/*
* PCI memory address to processor local memory address mapping. If a region
* is enabled, PTMx_LOCAL_ADRS must be within the two Local memory / peripheral
* regions (0x00000000-0x7FFFFFFF, or 0F0000000-0xFFFFFFFF)
*/
# define PTM1_LOCAL_ADRS LOCAL_MEM_LOCAL_ADRS
# define PTM1_SIZE_ATTRIB PTM_SIZE_2GB | PTM_ENABLE
# define PTM2_LOCAL_ADRS PTM_UNUSED
# define PTM2_SIZE_ATTRIB PTM_UNUSED
#endif /* INCLUDE_PCI */
/*
* 如果支援網路,本地EMAC和PCI網卡,必須有一個被選取,兩者都是END形式驅動
*/
#define INCLUDE_NETWORK /* 支援網路 */
#define INCLUDE_EMAC_NETWORK /* 405GP 本地 EMAC 網路 */
#undef INCLUDE_PCI_NETWORK /* PCI 網路 */
/*
* The board does not have the Ethernet MAC address of the EMAC stored
* in any sort of NVRAM. Modify the 12 digit string below to match the decal
* that is on your board.
*/
#ifdef INCLUDE_EMAC_NETWORK
#define DEFAULT_EMAC_HW_ADDR "xxxxxxxxxxxx" /* 網路硬體地址,即MAC地址 */
#endif
/*
* WDB 通過網路Enhanced Network Driver載入偵錯工具,若網路載入調試,必須定義此項
*/
#define WDB_COMM_TYPE WDB_COMM_SERIAL /*首先預設使用串口通訊*/
#define WDB_TTY_CHANNEL 0 /*使用第一個串口
#ifdef INCLUDE_NETWORK
#define INCLUDE_END
#undef WDB_COMM_TYPE
#define WDB_COMM_TYPE WDB_COMM_END /* 定義網路通訊, END 驅動 */
#else
#undef WDB_COMM_TYPE
#define WDB_COMM_TYPE WDB_COMM_SERIAL /* 定義串口通訊,和PC機串口串連 */
#undef WDB_TTY_CHANNEL
#define WDB_TTY_CHANNEL 0 /* 串口1 */
#endif /* INCLUDE_NETWORK */
/*************** 此處定義一些雜項 */
#ifdef NUM_TTY
#undef NUM_TTY
#endif
#define NUM_TTY 2 /* 定義了兩個串口終端,*/
#ifdef WDB_TTY_BAUD
#undef WDB_TTY_BAUD
#endif
#define WDB_TTY_BAUD 57600 /* 傳輸速率設定 9600, 19200, 38400, 57600, 115200 */
#ifdef CONSOLE_BAUD_RATE
#undef CONSOLE_BAUD_RATE
#endif
#define CONSOLE_BAUD_RATE 57600
#undef INCLUDE_ENV_VARS /* unix compatable environment variables */
#undef INCLUDE_TIMEX /* timexLib for exec timing */
#undef INCLUDE_HW_FP
#undef INCLUDE_TFTP_CLIENT /* used by autoboot from ftp server*/
#define INCLUDE_SW_FP
#define INCLUDE_ELF
#define INCLUDE_NET_SHOW
#define INCLUDE_PING
#undef INCLUDE_DEMO /* only for vxWorks bsp test */
#define ETHERNET_ADR_SET /* only for bootrom used */
#define INCLUDE_USER_APPL /* Startup the user's application in dos makefile project */
#undef PCIDEBUG
#ifdef INCLUDE_USER_APPL
#define USER_APPL_INIT _appEntry()
#endif
#endif /* INCconfigh */
#if defined(PRJ_BUILD)
#include "prjParams.h"
#endif
# Makefile - make rules for board
#
#*/
CPU = PPC40x
TOOL = gnu
TGT_DIR=$(WIND_BASE)/target
include $(TGT_DIR)/h/make/defs.bsp
include $(TGT_DIR)/h/make/make.$(CPU)$(TOOL)
include $(TGT_DIR)/h/make/defs.$(WIND_HOST_TYPE)
## Only redefine make definitions below this point, or your definitions will
## be overwritten by the makefile stubs above.
TARGET_DIR = xxx
VENDOR = IBM
BOARD = xxx
RELEASE = vxWorks vxWorks.st bootrom_uncmp.hex
USR_ENTRY = usrInit
# ROM_TEXT_ADRS, ROM_SIZE, RAM_HIGH_ADRS, 和RAM_LOW_ADRS 在config.h,Makefile和Makefile.*檔案中 # 都要定義,且必須要保持一致,
ROM_TEXT_ADRS = fff80100 # ROM 起始地址
ROM_SIZE = 0007f000 # ROM 空間大小
RAM_LOW_ADRS = 00010000 # RAM 低地址 vxWorks */
RAM_HIGH_ADRS = 00C00000 # RAM 高地址儲存 bootrom */
HEX_FLAGS = -a 100
#ADDED_CFLAGS = -gdwarf -O0 # for debug
MACH_EXTRA = appentry.o # 注意:這裡載入使用者的程式模組,程式調用在usrRoot()
BOOTCONFIG = bootconfig.c # bsp bootconfig.c for bootrom
## Only redefine make definitions above this point, or the expansion of
## makefile target dependencies may be incorrect.
include $(TGT_DIR)/h/make/rules.bsp
include $(TGT_DIR)/h/make/rules.$(WIND_HOST_TYPE)