天天看點

VxWorks BSP宏梳理實體記憶體布局romStart()棧RAMROM

==============================================================

實體記憶體布局

==============================================================

1.LOCAL_MEM_LOCAL_ADRS/LOCAL_MEM_SIZE

(1) LOCAL_MEM_LOCAL_ADRS – Start(beginning) of RAM. Define in config.h

(2) LOCAL_MEM_SIZE - Size of RAM. Define in config.h

--------------------------------------------------------------

《VxWorks  BSP for AMD's AU1500(MIPS) and Motorola's MPC8260(PowerPC)》的V100R001CPE\config.h中定義了這兩個宏:

#define    LOCAL_MEM_LOCAL_ADRS   0x80000000

#define    LOCAL_MEM_SIZE                 0x02000000 

--------------------------------------------------------------

2.sysPhysMemTop()

Routine returns address of top of physical memory. This routine will provide dynamic memory sizing if LOCAL_MEM_AUTOSIZE is defined in config.h.

The routine is in sysLib.c and its return value is: LOCAL_MEM_LOCAL_ADRS + LOCAL_MEM_SIZE.

--------------------------------------------------------------

《VxWorks  BSP for AMD's AU1500(MIPS) and Motorola's MPC8260(PowerPC)》的V100R001CPE\sysLib.c中定義了sysPhysMemTop():

char *sysPhysMemTop (void)

{

    static char * memTop = NULL;

    if (memTop == NULL)

        memTop = (char *)(LOCAL_MEM_LOCAL_ADRS +LOCAL_MEM_SIZE);

    return (memTop);

}

--------------------------------------------------------------

3.RESERVED and SYS_MEM_BOTTOM

(1) RESERVED  - Number of reserved bytes. Memory reserved from bottom of RAM, and will not be cleared on cold boot. Defined in configAll.h.

--------------------------------------------------------------

《VxWorks BSP for Intel's IXDP425(ARM)》的target\config\all\configAll.h中定義了RESERVED:

#if    (CPU_FAMILY==SPARC)

    #define RESERVED       0x2000    

#else

    #if   (CPU==MC68000)

        #define RESERVED   0x400   

    #else

        #if   (CPU_FAMILY == PPC)

            #define RESERVED   0x4400  

        #else

            #define RESERVED       0

        #endif

    #endif

#endif

--------------------------------------------------------------

MIPS中RESERVED=0。

(2) SYS_MEM_BOTTOM- For cold boot, memory will be cleared starting at this address. It expands to: LOCAL_MEM_LOCAL_ADRS + RESERVED.

--------------------------------------------------------------

《VxWorks  BSP for AMD's AU1500(MIPS) and Motorola's MPC8260(PowerPC)》的V100R001CPE\bootInit.c中定義了SYS_MEM_BOTTOM:

#define SYS_MEM_BOTTOM    (LOCAL_MEM_LOCAL_ADRS + RESERVED)

--------------------------------------------------------------

4.USER_RESERVED and SYS_MEM_TOP/sysMemTop()

(1) USER_RESERVED_MEM- Number of reserved bytes. Memory reserved from top of RAM and will not be cleared on cold boot or used by VxWorks. It will be defined as zero if not defined in config.h.

--------------------------------------------------------------

《VxWorks  BSP for AMD's AU1500(MIPS) and Motorola's MPC8260(PowerPC)》的V100R001CPE\config.h中定義了USER_RESERVED:

#define USER_RESERVED_MEM   0x00040000 

--------------------------------------------------------------

(2) SYS_MEM_TOP - For cold boot, memory will be cleared up to (but not including) this address. It expands to:

LOCAL_MEM_LOCAL_ADRS + LOCAL_MEM_SIZE - USR_RESERVED_MEM.

--------------------------------------------------------------

《VxWorks  BSP for AMD's AU1500(MIPS) and Motorola's MPC8260(PowerPC)》的V100R001CPE\bootInit.c中定義了SYS_MEM_TOP:

#define SYS_MEM_TOP    (LOCAL_MEM_LOCAL_ADRS + LOCAL_MEM_SIZE -USER_RESERVED_MEM)

--------------------------------------------------------------

(3) The routine sysMemTop defined in sysLib.c returns top of system memory. That is the address of the top of usable memory except user reserved, which is just the same as macro SYS_MEM_TOP.

--------------------------------------------------------------

《VxWorks  BSP for AMD's AU1500(MIPS) and Motorola's MPC8260(PowerPC)》的V100R001CPE\sysLib.c中定義了sysMemTop():

char *sysMemTop (void)

{

    static char * memTop = NULL;

    if (memTop == NULL)

    {

        memTop = sysPhysMemTop () -USER_RESERVED_MEM;

    }

    return (memTop);

}

--------------------------------------------------------------

==============================================================

romStart()棧

==============================================================

5._STACK_DIR/STACK_RESIDENT/STACK_SAVE/STACK_ADRS

(1)_STACK_DIR

_STACK_DIR用于指明棧的生長方向,也将直接影響任務控制塊windTcb中的pStackBase和pStackEnd取值。

--------------------------------------------------------------

在h\types\vxArch.h中定義了預設的_STACK_DIR:

#ifndef  _STACK_DIR

    #define  _STACK_DIR      _STACK_GROWS_DOWN

#endif

--------------------------------------------------------------

根據這個宏,說明前面可能有對_STACK_DIR的定義。在這句之前,有根據各個CPU包含相應的arch頭檔案:

--------------------------------------------------------------

#if (CPU_FAMILY==MIPS)

    #include <arch/mips/archMips.h>

#endif

#if (CPU_FAMILY==PPC)

    #include <arch/ppc/archPpc.h>

#endif

#if (CPU_FAMILY==ARM)

    #include <arch/arm/archArm.h>

#endif

--------------------------------------------------------------

也就是說,在每個CPU對應的arch頭檔案中都會定義棧生長方向;如果沒有定義的話,則vxArch.h中預設定義為向下生長。實際上在archMips.h、archPpc.h、archArm.h中均沒有找到_STACK_DIR的定義,是以MIPS/PPC/ARM中的棧預設都是向下生長。

(2)STACK_RESIDENT

--------------------------------------------------------------

《VxWorks BSP for Intel's IXDP425(ARM)》的target\config\all\configAll.h定義了STACK_RESIDENT:

#if     ((CPU_FAMILY == MIPS) || (CPU_FAMILY ==PPC))

#define STACK_RESIDENT  RAM_DST_ADRS

#else

#define STACK_RESIDENT  _sdata

#endif

--------------------------------------------------------------

在MIPS/PPC中STACK_RESIDENT=RAM_DST_ADRS,結合《VxWorks啟動之romStart》中不同的映像類型RAM_DST_ADRS指向不同。

對于非MIPS/PPC體系結構,例如ARM體系中_sdata為資料段的首位址,s即start,與_edata對應(e即end)。

(3)STACK_SAVE

Maximum stack size for romStart(). Architecture specific. Not cleared on cold reboot.

--------------------------------------------------------------

《VxWorks BSP for Intel's IXDP425(ARM)》的target\config\all\configAll.h中定義了STACK_SAVE:

#if     ((CPU_FAMILY==I960) || (CPU_FAMILY==ARM))

    #define STACK_SAVE     512    

#else

    #if   ((CPU_FAMILY==SPARC) || (CPU_FAMILY==PPC))

        #define STACK_SAVE  0x1000

    #else

        #define STACK_SAVE     0x40   

    #endif            

#endif

--------------------------------------------------------------

ARM中為STACK_SAVE=512位元組;MIPS中為STACK_SAVE=0x40,即64位元組。

VxWorks冷啟動(BOOT_COLD,startType=BOOT_CLEAR)時,在romStart.c中的romStart()->bootClear()中或bootInit.c中的romStart()中不對STACK_SAVE部厘清零。因為棧正在被romStart使用着。

(4)STACK_ADRS

Initial stack pointer. It is assumed that the romInit.s module has already set the initial stack pointer to STACK_ADRS.

The STACK_ADRS macro defaults to either RAM_DATA_ADRS, or RAM_DATA_ADRS-STACK_SAVE, depending on if the stack grows up or down for the given processor.

--------------------------------------------------------------

《VxWorks BSP for Intel's IXDP425(ARM)》的target\config\all\configAll.h中定義了STACK_ADRS:

#if   (_STACK_DIR == _STACK_GROWS_DOWN)

    #ifdef ROM_RESIDENT

        #define STACK_ADRS STACK_RESIDENT

    #else

        #define STACK_ADRS _romInit

    #endif

#else

    #ifdef ROM_RESIDENT

        #define STACK_ADRS (STACK_RESIDENT-STACK_SAVE)

    #else

        #define STACK_ADRS (_romInit-STACK_SAVE)

    #endif

#endif

--------------------------------------------------------------

<1>駐留(ROM_RESIDENT)型

對于駐留型,STACK_ADRS被定義為STACK_RESIDENT,而MIPS體系下STACK_RESIDENT被定義為RAM_DST_ADRS,詳見下文的分析。

vxWorks_romResident中的CC_ROM_RES_FLAGS定義了RAM_DST_ADRS=RAM_DATA_ADRS=RAM_LOW_ADRS,bootrom_res中定義了RAM_DST_ADRS=RAM_HIGH_ADRS,都為資料段重定位位址。

可見,對于駐留型可引導映像,romStart()的棧STACK_ADRS是從資料段(RAM_DATA_ADRS)開始向下生長的。

For ROM-resident images the stack will begin at the start of data segment forMIPS which grow down.

<2>非駐留(non ROM_RESIDENT)型

對于非駐留型的bootrom(_uncmp)和vxWorks_rom(Compress),STACK_ADRS都被定為_romInit,這個是代碼段的起始位址。可見,對于非駐留型的可引導映像,romStart()的棧是從bootstrap代碼段開始向下生長的。參見圖1 RAM Layout。

For non-ROM-residentimages the stack will begin at the start of the text segment of the VxWorks image forMIPS which grow down.

<3>romStart()棧sp指派

--------------------------------------------------------------

《VxWorks  BSP for AMD's AU1500(MIPS) and Motorola'sMPC8260(PowerPC)》中的V100R001CPE\romMipsInit.s中将sp指針指向STACK_ADRS。

   la sp, STACK_ADRS-(4*_RTypeSize) 

--------------------------------------------------------------

在MIPS中,這個臨時小棧(temporary stack)僅有64位元組,是為跳轉C函數入口romStart()準備的。對于VxWorks_rom*類型,該棧也被usrInit()使用,直到VxWorks核心啟動(usrInit()->kernelInit())後,棧将重新配置設定。

romStack() stack is used until kernel is activated by kernelInit() which spawns a task (with its own stack) to complete system configuration and start user application (usually by spawning another task).

<4>Loadable VxWorks棧sp指派

對于bootrom+VxWorks組合類型,bootstrap中的romStart()執行後,Loadable VxWorks被bootloader加載(bootload)到RAM_LOW_ADRS啟動核心前,棧将在sysALib.s中重新配置設定為從VxWorks映像(代碼段)向下生長。

Stack for usrInit() set up by sysInit() in sysALib.s grows away from VxWorks image to lower addresses in memory.

--------------------------------------------------------------

《VxWorks  BSP for AMD's AU1500(MIPS) and Motorola'sMPC8260(PowerPC)》中的V100R001CPE\sysALib.s中将sp指針指向sysInit()。

la sp, sysInit-(4*_RTypeSize)

--------------------------------------------------------------

對于bootrom和bootrom_uncmp,STACK_ADRS被定為_romInit。

bootrom中的bootstrap program将重定位到RAM_LOW_ADRS,此時STACK_ADRS=_romInit=RAM_LOW_ADRS;這裡重新“la sp ”仍舊從RAM_LOW_ADRS向下生長,也即還是romStart()使用的那塊堆棧。

對于bootrom_uncmp(bootrom_res),romStart()将整個bootrom(資料段)重定位到RAM_HIGH_ADRS處;此時STACK_ADRS=_romInit=RAM_HIGH_ADRS。因為VxWorks映像大小可能超過(RAM_HIGH_ADRS-RAM_LOW_ADRS),是以對于bootrom_uncmp(bootrom_res)型的bootloader,需要為VxWorks從彙編(sysInit() in sysALib.s)到C函數調用(usrInit())重建立立堆棧,以免破壞VxWorks映像。

<5>VxWorks多任務環境下的記憶體布局

vxWorks核心啟動(usrInit()->kernelInit())後,記憶體将重新布局。因為SYS_MEM_BOTTOM到RAM_LOW_ADRS的空間可能不足以支撐VxWorks運作期的消耗。

VxWorks核心啟動之後的記憶體布局大概是這樣的:底部一般為加載的資料段和代碼段;頂部的空閑記憶體區(MemPool)為系統運作期可配置設定空間,這些空間将用于Interrupt Stack、一些預留白間(leave room)、支援malloc動态配置設定記憶體的系統堆(FreeMemory Pool)和任務棧(Multi Task Stack)。(most user address spaces are only filled at the bottom (with code and data) and at the top(with a downward growing stack) with a huge gap in between.)

MIPS下_STACK_DIR=_STACK_GROWS_DOWN,kernelInit()的pMemPoolStart=FREE_RAM_ADRS,pMemPoolEnd=sysMemTop(),即MemPool從代碼段結尾(end)到可用記憶體頂部。進入多任務環境後,任何函數調用(中斷上下文除外)都使用所屬任務的棧空間,即運作線上程上下文中。一旦函數局部變量過大或函數調用嵌套過深可能導緻棧溢出。

關于VxWorks多任務環境的建立流程,可參考《vxworks_bsp_developers_guide_6.0》2.2.4 <Detailed Boot Sequence>。關于kernelInit()建立根任務tRootTask之後的記憶體布局和堆棧布局等細節,可參考《VxWorks Source Code》中提供的相關源代碼。

<6>關于-4*_RTypeSize

(a)taskMipsLib.h中定義了:

--------------------------------------------------------------

#define _RTypeSize    4

--------------------------------------------------------------

(b)archMips.h中定義了:

--------------------------------------------------------------

#if   (CPU == MIPS32)

    #define _WRS_INT_REGISTER_SIZE    4

#elif (CPU == MIPS64)

    #define _WRS_INT_REGISTER_SIZE    8

#endif

--------------------------------------------------------------

在asmMips.h和archMips.h中定義了:

--------------------------------------------------------------

#define _RTypeSize_    WRS_INT_REGISTER_SIZE

--------------------------------------------------------------

綜合(1)(2)可隻_RTypeSize為CPU寄存器的尺寸,對于MIPS32為4位元組。

那為何每次“la sp ”指派時,都要減掉4個_RTypeSize呢?根據《MIPS體系結構透視》的11.2.3節指出:“前16個位元組的參數通過寄存器a0-a3來傳遞,調用者保留參數結構中的前16位元組,堆棧保留的結構必須預留。”11.2.9節指出:“傳統MIPS函數調用約定為前4個函數參數保留白間,現在新調用約定隻配置設定實際所需要的空間。”

這4個_RTypeSize即是按舊約定為a0~a3四個參數槽預留的空間(leave room for four parameters),可參考11.2.9節的FIGURE 11.8 - Stack frame for a non leaf function。

==============================================================

RAM

==============================================================

6.RAM_HIGH_ADRS/RAM_LOW_ADRS/FREE_RAM_ADRS

(1) RAM_HIGH_ADRS  - RAM load address for non-ROM-resident VxWorks boot images.

It is the load point for the boot program. It is also the start of the text segment for the boot program unless the boot image is ROM-resident, in which case it is the start of the data segment for the boot module.

 (2) RAM_LOW_ADRS- RAM load address for non-ROM-resident VxWorks application images.

It is the load point for VxWorks. It is also the start of the text segment of VxWorks.

此處安放的入口點對于下載下傳型VxWorks為sysInit();對于引導型vxWorks_romCompress則為usrEntry()。

(3) FREE_RAM_ADRS - marks the end of the VxWorks image. Usually the system memory pool or the target server memory pool begins here.

#define FREE_RAM_ADRS    (end)  

7.RAM_DST_ADRS/RAM_DATA_ADRS

(1) Both the RAM_DST_ADRS and RAM_DATA_ADRS macros are link addressed defined by the Make system, which default to the BSP Makefile's RAM_LOW_ADRS and RAM_HIGH_ADRS respectively.

For information on how to change link addresses, refer to the file target/h/make/rules.bsp.

(2) RAM_DST_ADRS - Final relocation address for compressed image. Default value is RAM_HIGH_ADRS, redefined when necessary at compile time in rules.bsp.

(3) RAM_DATA_ADRS - Location in RAM to which the data segment is really linked. The RAM_DATA_ADRS macro is passed to us from the Make system. It represents the address to which the data segment is linked and defaults to the BSP Makefile's RAM_LOW_ADRS macro. For details on how to change the addresses to which VxWorks is linked, refer to the documentation in h/make/defs.vxWorks.

(4) 對于vxWorks_rom*類型,rules.vxWorks中根據映像類型是vxWorks_romCompress、vxWorks_rom或vxWorks_romResident,将ROM_FLAGS_EXTRA定義為CC_ROM_CMP_FLAGS、CC_ROM_CPY_FLAGS或CC_ROM_RES_FLAGS(defs.vxWorks中定義),其中分别定義了ROM_COMPRESS、ROM_COPY或ROM_RESIDENT宏。項目wpj檔案在romInit.o和romStart.o的BUILDRULE中引入了ROM_FLAGS_EXTRA。

--------------------------------------------------------------

ifeq($(basename $(DEFAULT_RULE)),vxWorks_romCompress)

    ROM_FLAGS_EXTRA = $(CC_ROM_CMP_FLAGS)

endif

ifeq($(basename $(DEFAULT_RULE)),vxWorks_romResident)

    ROM_FLAGS_EXTRA = $(CC_ROM_RES_FLAGS)

endif

ifeq($(basename $(DEFAULT_RULE)),vxWorks_rom)

    ROM_FLAGS_EXTRA = $(CC_ROM_CPY_FLAGS)

endif

CC_ROM_RES_FLAGS=-DROM_RESIDENT -DRAM_DATA_ADRS=0x$(RAM_LOW_ADRS)\

                  -DRAM_DST_ADRS=0x$(RAM_LOW_ADRS)

CC_ROM_CPY_FLAGS=-DROM_COPY -DRAM_DATA_ADRS=0x$(RAM_HIGH_ADRS) \

                  -DRAM_DST_ADRS=0x$(RAM_LOW_ADRS)

CC_ROM_CMP_FLAGS=-DROM_COMPRESS -DRAM_DATA_ADRS=0x$(RAM_HIGH_ADRS)\

                  -DRAM_DST_ADRS=0x$(RAM_LOW_ADRS)

--------------------------------------------------------------

(5) 對于bootrom.bin類型,RAM_DST_ADRS被定義為RAM_HIGH_ADRS,用于存放bootrom.bin解壓代碼,入口點為compressedEntry()。

《VxWorks  BSP for AMD's AU1500(MIPS) and Motorola's MPC8260(PowerPC)》中的V100R001CPE\bootInit.c中定義了RAM_DST_ADRS的預設值:

--------------------------------------------------------------

#ifndef RAM_DST_ADRS                  

#define RAM_DST_ADRS        RAM_HIGH_ADRS

#endif

--------------------------------------------------------------

VxWorks BSP宏梳理實體記憶體布局romStart()棧RAMROM

圖1 RAM Layout

RAM_DST_ADRS will be:

--------------------------------------------------------------

RAM_HIGH_ADRS for VxWorks bootimages(bootrom.bin壓縮部分的解壓目的位址)。

RAM_LOW_ADRS for applicationVxWorks images(vxWorks_romCompress.bin壓縮部分的解壓目的位址)。

--------------------------------------------------------------

==============================================================

ROM

==============================================================

8.ROM_SIZE/ROM_BASE_ADRS/ROM_TEXT_ADRS/ROM_DATA_ADRS

ROM_SIZE  - Size of ROM.

ROM_BASE_ADRS  - Start(Base address) of ROM.

ROM_TEXT_ADRS  - Boot ROM entry address.

    Start of text segment within ROM, typically a CPU-dependant offset from ROM_BASE_ADRS.

ROM_DATA_ADRS- Locationin ROM containing a copy of the data segment. This must eventually be copied  to the RAM address to which it is linked.

romStart() copies the data segment from ROM_DATA_ADRS to RAM_DATA_ADRS - the address to which it is really linked.

如果要build bootrom,則ROM_BASE_ADRS被定義為9fc00000(ROM/Flash的實際實體位址,ROM_PHY_ADDR=0xBFC00000);否則被定義為高端位址(比如RAM的最末尾20KB,足夠容納bootstrap代碼)。

對于bootloader,bootstrap代碼(romInit(),romStart())駐留在ROM中運作,romInit.s中通過RELOC定位romStart在ROM/Flash中的位址;romStart()中通過ROM_OFFSET定位其他輔助函數copyLongs在ROM/Flash中的位址。

--------------------------------------------------------------

《VxWorks  BSP for AMD's AU1500(MIPS) and Motorola's MPC8260(PowerPC)》中的V100R001CPE\config.h中定義了:

#define ROM_TEXT_ADRS    0xBFC00000 

#define ROM_BASE_ADRS    ROM_TEXT_ADRS

#define ROM_SIZE      0x01000000 

--------------------------------------------------------------

對于第二種情形,注意ROM_BASE_ADRS/ROM_TEXT_ADRS/ROM_DATA_ADRS為基于RAM的linked address,在相應拷貝重定位時,需要加上(ROM_PHY_ADDR - ROM_TEXT_ADRS)這樣一個偏移量。例如在定位vxWorks_romCompress(ROM_COMPRESS)中的subimage在ROM中的起始位置:ROM_DATA(binArrayStart)+(ROM_PHY_ADDR-ROM_TEXT_ADRS)。

9.binArrayStart/binArrayEnd

binArrayStart- Start of compressed binary image.

binArrayEnd- End of compressed binary image.

binToAsm将壓縮bin檔案作為一資料段,存放在彙編檔案中(vxWorks.Z.s for vxWorks_romCompress,bootrom.Z.s for bootrom.bin),資料段起始于binArrayStart位置,在binArrayEnd處結尾。彙編檔案中除了.data段外,無其他有效段。

--------------------------------------------------------------

   .data

   .p2align 2

binArrayStart:

_binArrayStart:

   .p2align 2,0

binArrayEnd:

_binArrayEnd:

--------------------------------------------------------------

ccmips –c vxWorks.Z.s –o vxWorks.Z.o

ccmips –c bootrom.Z.s –o bootrom.Z.o

“readelf –a”指令可以檢視到vxWorks.Z.o或bootrom.Z.o中的.text和.bss段的Size均為0。

最後,ldmips将romInit.o、romStart.o(bootInit.o)、version.o和vxWorks.Z.o(bootrom.Z.o)連結生成vxWorks_romCompress(bootrom)。

在合并相似段時,如果romStart.o(bootInit.o)中有資料段,則[binArrayStart, binArrayEnd]緊随其後。Bootstrap中的壓縮/解壓縮等輔助函數代碼的資料段緊随binArrayEnd之後存放。

VxWorks BSP宏梳理實體記憶體布局romStart()棧RAMROM
圖2 ROM Layout

10.ROM_OFFSET/ROM_DATA

Because romInit() is statically linked  into a VxWorks image, the address assigned to romInit() by the linker will be a ROM address for a ROM resident image and a RAM address for a non-ROM-resident ROM image.

ROM_OFFSET- Macro to re-compute absolute addresses which are not PIC compatible.

--------------------------------------------------------------

《VxWorks  BSP for AMD's AU1500(MIPS) and Motorola's MPC8260(PowerPC)》中的V100R001CPE\bootInit.c中定義了ROM_OFFSET:

#define ROM_OFFSET(adr)   (((UINT)adr -(UINT)romInit) + ROM_TEXT_ADRS)

#define ROM_DATA(adrs)    ((UINT)adrs + ((UINT)ROM_DATA_ADRS - RAM_DATA_ADRS))

--------------------------------------------------------------

對于bootloader(bootrom.bin),bootInit.c/romStart()仍然在ROM中執行,copyLongs()符号本身對應的是RAM中的連結位址,故需計算copyLongs()函數在ROM/Flash中的位址。ROM_OFFSET通過計算copyLongs與romInit的符号連結位址偏移,再加上romInit在ROM/Flash中的實體位址ROM_TEXT_ADRS,進而計算出copyLongs在ROM/Flash中的實體位址,實作正确調用。

ROM_OFFSET盡管可以實作指令代碼的PIC調用,但對于指令中需要通路的資料段,一般在連結時已經都編址為基于RAM的linked address,則一定要拷貝到RAM中的VMA才能正确通路,否則程式可能跑飛。例如romStart中即将要用到的壓縮/解壓縮函數(inflate()/deflate())相關的資料段(初始化了的全局靜态變量和局部靜态變量)。所幸romStart一般都會調用copyLongs将ROM中的未壓縮代碼和資料段拷貝到RAM中,後續在RAM中更快地執行Stage2。

說明:

本文中涉及的target底下的代碼和defs.vxWorks/rules.vxWorks等make腳本檔案,源自《VxWorksBSPfor ixp425》以及《VxWorks BSP for AMD's AU1500(MIPS) and Motorola's MPC8260(PowerPC)》。

如無特殊說明,本文示例代碼中涉及體系架構的分流均針對MIPS,即CPU_FAMILY==MIPS,具體來說是指MIPS32。

參考:

《VxWorks架構》

《ROM_OFFSET的納悶》

《romStart代碼的小記》

《romInit.s檔案分析》

《試論bootrom的拷貝位址》

《vxWorks bsp分析之bootInit.c》

《BSP映像分析和啟動流程》

《romInit和romStart兩個函數編譯和連結後的位址》

《TornadoBSPTraining Workshop》

    04_preKernelInit

    05_preKernelBoot

《VxWorks啟動流程》

《VxWorks建立任務中堆棧生長方向問題》