新闻  |   论坛  |   博客  |   在线研讨会
VxWorks系统BSP配置文件及生成下载
yanqin | 2009-04-16 20:35:12    阅读:5125   发布文章

VxWorks系统BSP配置文件及生成下载
%A
%A
%A 摘自http://drew.nease.net/
%A
%A
%A
%A VxWorks BSP主要配置文件 config.h , Makefile 注解和 BSP生成下载实例。
%A
%A 相关内容可参考 VxWorks BSP和启动过程
%A
%A config.h文件配置
%A
%A /*
%A This file contains the configuration parameters for the CPU evaluation board.
%A */
%A
%A #ifndef INCconfigh
%A #define INCconfigh
%A
%A /* BSP version/revision identification, before configAll.h */
%A #define BSP_VER_1_2 1
%A #define BSP_VER_1_1 1
%A #define BSP_VERSION "1.2" /* A Tornado 2.0 BSP */
%A #define BSP_REV "/3" /* 0 for first revision */
%A
%A #include "configAll.h"        /* 这个文件定义了VxWorks所有的缺省设置 */
%A
%A
%A /*
%A * Define ONE of the following to specify the revision of the PPC405GP chip
%A * you are using. Undefine all others. sysModel() will return
%A * "Unknown processor" if the correct selection is not made.
%A */
%A
%A /*
%A * Default boot line
%A */
%A
%A /*
%A
%A 解释: 这一行对配置网络,连通Target Server及下载调试程序非常重要
%A
%A DEFAULT_BOOT_LINE 的原意是为没有NVRAM的target设计的,这样用户就不需要在每次系统启动是手工输入这些参数了.
%A
%A 系统启动网络时xxxEndLoad()会解释这一行并按这一行的定义进行加载.
%A
%A Emac(0,0) : 启动设备,可是是软盘,硬盘,PCMCIA卡等 其他的设备名称如:
%A
%A fd为软盘,(0,0)表示第一个软驱,3.5寸盘.
%A dc则表示从DEC 21x4x 芯片启动,即系统有NVRAM存在,这种方式现在已不采用.
%A elpci表示启动设备为3COM EtherLink XL PCI网卡.
%A fei:Intel 82559 EtherExpress网卡.
%A ene: NE2000网卡
%A ELT: 3COM以太网卡
%A EEX: Intel网卡
%A ata: ATA/IDE 硬盘 ............
%A
%A 405GP: 主机名
%A vXworks 从主机加载的VxWorks文件
%A h=172.16.1.159   主机的IP地址    
%A
%A e=172.16.254.52 目标机的IP地址,若网络启动Target Server时,这个IP必须和主机上Target Server配置的Target IP地址一致,且设置Back End选项为wdbrpc
%A u=xxx  用户名,pw=xxx  密码: 若通过网络加载调试时,主机的Ftp服务器和目标机的用户名和密码必须相同
%A tn=vxTarget 目标机名称
%A
%A */
%A
%A #define DEFAULT_BOOT_LINE \
%A         "Emac(0,0)405GP:vxWorks h=172.16.1.159 e=172.16.254.52 \
%A                 u=xxx pw=xxx tn=vxTarget"
%A
%A /*
%A * 内存设置.
%A * 如果定义了LOCAL_MEM_AUTOSIZE则SDRAM的大小会在Boot时指定
%A */
%A
%A #undef LOCAL_MEM_AUTOSIZE                    /* 运行时内存大小 */
%A #define LOCAL_MEM_SIZE 0x02000000            /* 32MB 内存缺省 */
%A #define LOCAL_MEM_LOCAL_ADRS 0x00000000     /* 内存基地址为 0 */
%A #define USER_RESERVED_MEM 0                  /* see sysMemTop() */
%A
%A /*
%A * Define SDRAM_ECC_ENABLE to enable ECC if an ECC SDRAM DIMM is detected
%A * during SDRAM auto-configuration. If not defined, ECC will not be enabled
%A * if an ECC SDRAM DIMM is detected, and the DIMM will be used as a normal DIMM.
%A */
%A
%A #undef SDRAM_ECC_ENABLE
%A
%A
%A
%A /* 解释: 这里主要设置系统的内存分配定义,若分配不当,则系统不能正常加载和运行.
%A
%A ROM_TEXT_ADRS, ROM_SIZE, RAM_HIGH_ADRS, 和RAM_LOW_ADRS 在config.h和Makefile文件中都要定义,且必须要保持一致,这些地址的定义一定要参照VxWorks 加载执行过程,硬件手册,MMU和VxWorks的大小进行.主要原则是保证VxWorks image 在ROM和RAM中都要有一定的运行空间且高效运行,可参见 VxWorks BSP和启动过程.
%A
%A */
%A #define ROM_BASE_ADRS 0xfff80000                  /* ROM的基地址 */
%A #define ROM_TEXT_ADRS (ROM_BASE_ADRS + 0x100)    /* 程序指针和堆栈指针 */
%A #define ROM_WARM_ADRS (ROM_TEXT_ADRS+0x0004)     /* 热启动入口地址 */
%A #define ROM_SIZE 0x0007f000                       /* ROM大小 512KB */
%A #define RAM_LOW_ADRS 0x00010000                   /* RAM 低地址运行 vxWorks */
%A #define RAM_HIGH_ADRS 0x00C00000                  /* RAM 高地址存储 bootrom */
%A #define USER_RESERVED_MEM 0                       /* 用户保留地址 */
%A
%A
%A /*
%A * Cache options    定义缓存
%A */
%A
%A #define INCLUDE_CACHE_SUPPORT
%A
%A #define USER_D_CACHE_ENABLE
%A #define USER_I_CACHE_ENABLE
%A #undef USER_D_CACHE_MODE
%A #define USER_D_CACHE_MODE (CACHE_COPYBACK)
%A
%A
%A /*
%A * 405 timers (PIT, FIT, WDT) 可由外部时钟驱动或者CPU驱动
%A */
%A
%A #define TIMER_CLOCK_EXTERNAL
%A
%A /*
%A * Optional timestamp support
%A */
%A
%A #undef INCLUDE_TIMESTAMP
%A
%A /*
%A * Auxilliary Timer rates    定义辅助计时器频率
%A */
%A
%A #ifdef TIMER_CLOCK_EXTERNAL
%A #define AUX_CLK_RATE_MIN (EXT_TIMER_CLK_FREQ / (1 << 21) )
%A #define AUX_CLK_RATE_MAX (EXT_TIMER_CLK_FREQ / (1 << 9) )
%A #define AUX_CLK_RATE_DEFAULT (EXT_TIMER_CLK_FREQ / (1 << 17) )
%A #else
%A
%A /* ZZZZZZZZZZZ todo put rates in for system clock derived timer clock */
%A
%A #endif
%A
%A /*
%A * Watchdog Timer rates    
%A */
%A
%A #define WDT_RATE_MIN 1 /* minimum watchdog timer rate */
%A #define WDT_RATE_MAX 5000 /* maximum watchdog timer rate */
%A
%A /* 实时时钟设置 */
%A
%A #define INCLUDE_RTC
%A
%A /* 去除不需要的网络驱动 */
%A
%A #undef INCLUDE_EI
%A #undef INCLUDE_EX
%A #undef INCLUDE_ENP
%A #undef INCLUDE_LN
%A #undef INCLUDE_SM_NET
%A #undef INCLUDE_SM_SEQ_ADDR
%A
%A
%A /* #define for software floating point support */
%A
%A #undef INCLUDE_SW_FP
%A
%A /* 定义串口 Serial port configuration */
%A
%A #define INCLUDE_SERIAL
%A
%A
%A /* PCI 设置,PCI configuration */
%A
%A #define INCLUDE_PCI
%A
%A #ifdef INCLUDE_PCI
%A /*
%A * Three programmable processor local memory address to PCI memory address
%A * mappings. If a region is enabled, PMMx_LOCAL_ADRS must be between
%A * PCI_MEMORY_START and PCI_MEMORY_END. If PMMx_PCI_HIGH_ADRS is non-zero in
%A * an enabled region, 64 bit dual cycle addresses will be generated on the
%A * PCI bus for this region.
%A */
%A
%A //定义PCI设备的初始化地址 参见 PCI设备(网卡)初始化代码分析
%A
%A
%A # define PMM0_LOCAL_ADRS PCI_MEMORY_START      // 定义PCI空间起始地址
%A # define PMM0_PCI_LOW_ADRS 0x80000000           // 定义PCI空间低位地址
%A # define PMM0_PCI_HIGH_ADRS 0x00000000         // 定义PCI空间高位地址
%A # define PMM0_PCI_MASK_ATTRIB (PMM_MASK_512MB | PMM_ENABLE)
%A
%A # define PMM1_LOCAL_ADRS PMM_UNUSED
%A # define PMM1_PCI_LOW_ADRS PMM_UNUSED
%A # define PMM1_PCI_HIGH_ADRS PMM_UNUSED
%A # define PMM1_PCI_MASK_ATTRIB PMM_UNUSED
%A
%A # define PMM2_LOCAL_ADRS PMM_UNUSED
%A # define PMM2_PCI_LOW_ADRS PMM_UNUSED
%A # define PMM2_PCI_HIGH_ADRS PMM_UNUSED
%A # define PMM2_PCI_MASK_ATTRIB PMM_UNUSED
%A
%A /*
%A * PCI memory address to processor local memory address mapping. If a region
%A * is enabled, PTMx_LOCAL_ADRS must be within the two Local memory / peripheral
%A * regions (0x00000000-0x7FFFFFFF, or 0F0000000-0xFFFFFFFF)
%A */
%A # define PTM1_LOCAL_ADRS LOCAL_MEM_LOCAL_ADRS
%A # define PTM1_SIZE_ATTRIB PTM_SIZE_2GB | PTM_ENABLE
%A
%A # define PTM2_LOCAL_ADRS PTM_UNUSED
%A # define PTM2_SIZE_ATTRIB PTM_UNUSED
%A
%A #endif /* INCLUDE_PCI */
%A
%A /*
%A * 如果支持网络,本地EMAC和PCI网卡,必须有一个被选取,两者都是END形式驱动
%A */
%A #define INCLUDE_NETWORK             /* 支持网络 */
%A #define INCLUDE_EMAC_NETWORK       /* 405GP 本地 EMAC 网络 */
%A #undef INCLUDE_PCI_NETWORK         /* PCI 网络 */
%A
%A /*
%A * The board does not have the Ethernet MAC address of the EMAC stored
%A * in any sort of NVRAM. Modify the 12 digit string below to match the decal
%A * that is on your board.
%A */
%A
%A #ifdef INCLUDE_EMAC_NETWORK
%A     #define DEFAULT_EMAC_HW_ADDR "xxxxxxxxxxxx"         /* 网络硬件地址,即MAC地址 */
%A #endif
%A
%A /*
%A * WDB 通过网络Enhanced Network Driver加载调试程序,若网络加载调试,必须定义此项
%A */
%A
%A
%A #define WDB_COMM_TYPE WDB_COMM_SERIAL /*首先默认使用串口通信*/
%A #define WDB_TTY_CHANNEL 0 /*使用第一个串口
%A
%A
%A #ifdef INCLUDE_NETWORK
%A     #define INCLUDE_END
%A     #undef WDB_COMM_TYPE
%A     #define WDB_COMM_TYPE WDB_COMM_END      /* 定义网络通信, END 驱动 */
%A #else
%A     #undef WDB_COMM_TYPE
%A     #define WDB_COMM_TYPE     WDB_COMM_SERIAL /* 定义串口通信,和PC机串口连接 */
%A     #undef WDB_TTY_CHANNEL
%A     #define WDB_TTY_CHANNEL 0                        /* 串口1 */
%A #endif /* INCLUDE_NETWORK */
%A
%A /*************** 此处定义一些杂项 */
%A
%A #ifdef NUM_TTY
%A #undef NUM_TTY
%A #endif
%A #define NUM_TTY 2             /* 定义了两个串口终端,*/
%A
%A
%A #ifdef WDB_TTY_BAUD
%A #undef WDB_TTY_BAUD
%A #endif
%A #define WDB_TTY_BAUD 57600 /* 波特率设置 9600, 19200, 38400, 57600, 115200 */
%A
%A #ifdef CONSOLE_BAUD_RATE
%A #undef CONSOLE_BAUD_RATE
%A #endif
%A #define CONSOLE_BAUD_RATE 57600
%A
%A
%A #undef INCLUDE_ENV_VARS /* unix compatable environment variables */
%A #undef INCLUDE_TIMEX /* timexLib for exec timing */
%A #undef INCLUDE_HW_FP
%A #undef INCLUDE_TFTP_CLIENT /* used by autoboot from ftp server*/
%A
%A #define INCLUDE_SW_FP
%A #define INCLUDE_ELF
%A #define INCLUDE_NET_SHOW
%A #define INCLUDE_PING
%A #undef INCLUDE_DEMO /* only for vxWorks bsp test */
%A #define ETHERNET_ADR_SET /* only for bootrom used */
%A #define INCLUDE_USER_APPL /* Startup the user‘‘s application in dos makefile project */
%A #undef PCIDEBUG
%A
%A #ifdef INCLUDE_USER_APPL
%A #define USER_APPL_INIT _appEntry()
%A #endif
%A
%A #endif /* INCconfigh */
%A #if defined(PRJ_BUILD)
%A #include "prjParams.h"
%A #endif
%A
%A
%A
%A
%A Makefile文件配置
%A
%A
%A
%A # Makefile - make rules for board
%A #
%A #*/
%A
%A CPU = PPC40x
%A TOOL = gnu
%A
%A TGT_DIR=$(WIND_BASE)/target
%A include $(TGT_DIR)/h/make/defs.bsp
%A include $(TGT_DIR)/h/make/make.$(CPU)$(TOOL)
%A include $(TGT_DIR)/h/make/defs.$(WIND_HOST_TYPE)
%A
%A ## Only redefine make definitions below this point, or your definitions will
%A ## be overwritten by the makefile stubs above.
%A
%A
%A TARGET_DIR = xxx
%A VENDOR = IBM
%A BOARD = xxx
%A
%A RELEASE = vxWorks vxWorks.st bootrom_uncmp.hex
%A
%A USR_ENTRY = usrInit
%A
%A
%A # ROM_TEXT_ADRS, ROM_SIZE, RAM_HIGH_ADRS, 和RAM_LOW_ADRS 在config.h,Makefile和Makefile.*文件中 # 都要定义,且必须要保持一致,
%A
%A
%A ROM_TEXT_ADRS = fff80100                 # ROM 起始地址
%A ROM_SIZE = 0007f000                      # ROM 空间大小
%A
%A RAM_LOW_ADRS = 00010000                  # RAM 低地址 vxWorks */
%A RAM_HIGH_ADRS = 00C00000                 # RAM 高地址存储 bootrom */
%A
%A HEX_FLAGS = -a 100
%A
%A #ADDED_CFLAGS = -gdwarf -O0 # for debug
%A
%A MACH_EXTRA = appentry.o                # 注意:这里加载用户的程序模块,程序调用在usrRoot()
%A
%A BOOTCONFIG = bootconfig.c               # bsp bootconfig.c for bootrom
%A
%A
%A ## Only redefine make definitions above this point, or the expansion of
%A ## makefile target dependencies may be incorrect.
%A
%A include $(TGT_DIR)/h/make/rules.bsp
%A include $(TGT_DIR)/h/make/rules.$(WIND_HOST_TYPE)
%A
%A
%A   Tornado for x86下BSP的生成,下载和Target Server的配置实例,Pentium主机,3Com网卡,软盘引导,ftp下载VxWorks映像。
%A
%A      1.在C:\Tornado\target\config\pcPentium目录下修改BSP文件config.h。
%A
%A
%A #elif (CPU_VARIANT == PENTIUM)
%A #define DEFAULT_BOOT_LINE
%A "elt(0,0)HOST:c:\\Tornado\\target\\config\\pcPentium\\vxWorks
%A h=90.0.0.3 e=90.0.0.50 u=target pw=target tn=target"
%A
%A #define INCLUDE_ELT //3Com网卡
%A #define INCLUDE_END //END驱动
%A
%A
%A 2.打开Tornado选择新建一个bootable vxworks image,选择建 A BSP,选择
%A   pcPentium,建完后编译就可以在相应的目录下生成vxworks的映像文件。
%A
%A 3.制作bootrom;选择Build Boot Rom,选择pcPentium,再选择bootrom_uncmp,
%A   生成 bootrom_uncmp。拷贝 bootrom_uncmp到host\x86-win32\bin下,插入空白
%A   盘到软区,在dos界面进入目录host\x86-win32\bin下,用命令"mkboot a:
%A   bootrom_uncmp "生成引导盘
%A
%A 4. 在Start > Programs > Tornado2 > FTP Server,点开Security下的
%A   user/rights菜单,新建用户User Name:target,Password:target,Home
%A   Directory为VxWorks映像所在目录如 C:\Tornado\target\config\pcPentium\。
%A   注意这些配置要和config.h中的一致。
%A
%A 5.将bootrom的启动盘插入目标机的软驱,启动目标机,系统从软驱启动,随后登
%A   陆FTP,从主机下载vxworks文件,目标机提示7秒内按任意键选择Boot方式(手工
%A   ,自动),手工方式可对FTP用户,口令,IP等参数进行修改。
%A   通常是等待7秒后系统autoboot。
%A   
%A
%A 屏幕显示:
%A
%A Attached TCP/IP interface to elt0.
%A Attaching network interface lo0... done. //TCP/IP网络连接成功
%A
%A Loading... 602128 //通过ftp下载VxWorks映像
%A Starting at 0x01080000 //下载成功,从RAM_LOW_ADRS 0x01080000
%A 开始执行VxWorks系统
%A
%A Attached TCP/IP interface to elt unit 0
%A Attaching interface lo0...done //TCP/IP网络连接成功
%A (注意这里网络初始化成功和上边的不同,上边是Bootrom映像网络初始化来下载VxWorks,这里VxWorks系统初始化网络。)
%A
%A VxWorks
%A
%A Copyright 1984-1998 Wind River Systems, Inc.
%A
%A CPU: xxxx --- Intel x82
%A VxWorks: 5.4
%A BSP version: 1.2/4
%A Creation date: Jan xx 2001
%A WDB: Ready.
%A
%A
%A
%A 至此目标机系统启动完成。
%A
%A
%A 6.配置Target Server下载应用程序.
%A
%A 打开Tornado,在Tools菜单下选择Target Sever再选择configure进行配置(Tools
%A > Target Server > Configure > New)给出Target Server名字描述如net00.在
%A (Target Server Properties > Back End)选择WdbRpc. Target Name/IP Address
%A 框内输入Target的IP: 90.0.0.50.
%A Core File and Symbols选项(Target Server Properties > Core File and
%A Symbols): C:\Tornado\target\config\pcPentium\vxWorks等等。
%A 配置的内容根据系统的具体情况定。点击Launch启动Target Sever,随后在主界
%A 面下选择已启动的Target Sever就可以下载 *.o或*.out程序。
%A
%A%A
%A

*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。

参与讨论
登录后参与讨论
推荐文章
最近访客