本文根据VxWorks系统启动的流程,分文件来梳理了启动过程中执行的函数,对了解VxWorks的启动流程有比较大的帮助。

一、romInit.s -> romInit()

/* romInit - entry point for VxWorks in ROM */

1. initialize CPU and memory

2. copy bootrom to ROM_TEXT_ADRS

3. initialize STACK

4. lock INTERRUPT

5. jump to romStart()

二、romStart.c->romStart()

/* this is the first C code after reset */

1. clear memory

2. copy vxWorks ROM image to RAM

3. uncompress if necessary

4. jump to the object code ENTRY after uncompress

  • usrEntry - entry point for vxWorks_romCompress, vxWorks_rom and bootrom
  • sysInit() for vxWorks in RAM(Uncompress)

三、sysALib.s->sysInit()

/* this routine is the system start-up entry point for VxWorks in RAM */

1. disable INTERRUPTS

2. set up STACK

3. jump to usrInit() in usrConfig.c

三、usrEntry.c->usrEntry()

/* usrEntry - entry point for vxWorks_romCompress, vxWorks_rom and bootrom images. */

1. just jump to usrInit() in usrConfig.c

四、usrConfig.c->usrInit()

/* usrInit - user-defined system initialization routine */

1. call sysHwInit0() for BSP-specific initialization

2. zero out BSS segment for entruing all valiables are initialzed to 0

3. initialize CACHE and disable CACHE

4. setting up the interrupt vector base table

5. installing exception vectors

6. call sysHwInit() to initialize system hardware

7. enable CACHE, including instruction cache and data cache

8. call usrKernelInit() to configure Wind Kernel

9. if necessary, start WDB before Wind Kernel

10. start up root task usrRoot()

/*NOTE: in this point, multitasking environment is not enabled*/

五、usrConfig.c->usrRoot()

/* this is the first task running under multitasking environment, it performs all final initialization and start other tasks */

  • call usrKernelCoreInit() to initialize Wind kernel facilities
  • initialize power managerment, only for PENTIUM
  • initialize system memory pool
  • configure memory managerment LIB
  • initialize sysCtrl support
  • initialize RTP(real time process)
  • initialize shared data
  • initialize shared LIB
  • initialize MMU
  • initialize environment valiables
  • initialize task stack protecting mode
  • initialize signals
  • setup system timers
  • initialize IO system
  • initialize select LIB
  • initialize process file system
  • install console driver and create serial devices
  • initialize PC_CONSOLE
  • initialize hash table facilities
  • initialize symbol table facilities
  • initialize exception handling
  • initialize list LIB
  • initialize logging
  • initialize POSIX clock
  • initialize POSIX timers
  • initialize POSIX shared memory
  • initialize POSIX memory mapped
  • initialize debugging
  • initialize pipe driver
  • initialize POSIX asyc IO support
  • initialize STDIO LIB
  • initialize POSIX queued signals
  • initialize POSIX semaphores
  • initialize POSIX threads
  • initialize POSIX scheduler
  • initialize signals events
  • initialize POSIX message queues
  • dosFs2 filesystem initialization
  • initialize ramFs filesystem
  • install ram disk driver
  • install memory disk driver
  • install pseudo-terminal driver
  • initialize SCSI
  • initialize FD if necessary
  • initialize ATA
  • initialize LPT if necessary
  • initialize TFFS
  • initialize formatted IO
  • initialize float point facilites
  • install DSP surport if necessary
  • initialize system calls
  • initialize performance monitoring tools
  • initialize module loader and unloader
  • initialize local storage support, such as USB bulk storage
  • initialize network if INCLUDED
  • initialize USB component if INCLUDED
  • initialize shared memory objects
  • create system and status symbol table
  • initialize C++ LIB support
  • initialize Wind Web server
  • if windview INCLUDED, initialize timestamp
  • initialize WDB debug agent
  • initialize interactive SHELL
  • initialize WINDML if INLCUDED
  • turn on power managerment
  • initialize filesystem boot component
  • initialize Network boot component
  • initialize the usb keyboard after shell Initialization
  • optimize MMU
  • start up usrer’s application
  • initialize RTP startup facility