2010年8月4日 星期三

Bib in WinCE

CE用*.bib來决定(reloade?) memory layout。
一般的project中會包含兩個 image : bootloader , OS,所以Project中會有 boot.bib和config.bib。
bib文件是用来指导WinCE的编译系统产生可执行二进制文件的,其中使用的地址都是虚拟地址。

必须在Config.bib中设置ROMSIZE参数。
如ROMSIZE=02000000,设置NK.NB0的大小为32M,若Image的大小超过32M,则还会产生NK.NB1,NK.NB2…


RAMIMAGE - 所有Kernel, conpoment都會被放置在這個區域。(大概就是code,const region?)
RAMIMAGE – This is the virtual address region that the kernel and any other components you select for your image will be placed in. This can be RAM or linearly addressable flash. Your config.bib file should have exactly one RAMIMAGE section. It needs to be virtually contiguous, and it needs to be large enough to hold whatever components you’ve selected.

RAM - Kernel 會利用這部份的區域作為application或kernel自己需要的RAM 空間(data,stack ?)
RAM – This is the virtual address region of RAM that the kernel can allocate to applications and RAM-based file systems. It needs to be virtually contiguous. (If you need a non-contiguous section, you can allocate another, non-virtually-contiguous section at run-time by implementing the OEMGetExtensionDRAM function, but that’s outside our scope)

RESERVED - Kernel 不會使用這部份區域。programmer可以用hard-coded對此 區域位址存取。
RESERVED – These are virtual address regions that are set aside – the kernel won’t allocate memory in these addresses and components won’t be placed in these addresses.

AUTOSIZE - 這是一個option,當設定ON時,builder會把RAMIMAGE和RAM合
併成一個region
AUTOSIZE - In the CONFIG section, we have the AUTOSIZE=ON (or OFF) variable. If this variable is on, it will treat the RAMIMAGE and RAM regions as a single region, allocating just enough space to hold all of the components to the RAMIMAGE section and making the rest of the space available as RAM. This is a pretty convenient and easy way to make sure you’re getting maximal use out of your RAM. One thing autosize won’t do is interfere with reserved or unallocated regions.






OEMAddressTable

Before we look at the .bib files themselves, it’s important to understand the OEMAddressTable. This table defines the mappings between physical and virtual addresses. For MIPS and SH processors, this table is hard coded into the processor. For x86 and ARM, the mapping is defined in a variable called OEMAddressTable. Since .bib files operate largely on virtual addresses, we need to remember to reference the OEMAddressTable to address any confusion about what is happening at a particular physical address.