Bib is fully called binary image builder. bib files are used in the final makeimage stage of the wince compilation process. The function of bib files is to instruct the system to build a binary image. All the bibfiles will be merged into the ce.bibfile. Then, the packaging tool romimage.exe will decide which files will be included in the wince image according to the description in the bib file. The bib file also determines the memory allocation of the wince device, for example, which memory the wince image occupies, memory occupied by the video memory (framebuffer.
The bib file contains four items: memory, config, modules, and files. Their functions are as follows:
(1) memory:
Defines memory settings, which are generally in the 0 \ platform \ smdkxx \ files \ config. bib file. The wince build system uses the memory item to know which memory is Ram, Which memory is Rom, and their size. The memory item format is as follows:
Memory
Name start address memory size type
Where
Name: the name of the memory segment. This name is not specified, but it is best to use this name to know the purpose of the memory segment. This name must be unique, as shown in the following document.
Start address: the starting address of the memory, expressed in hexadecimal notation. The starting address of the memory used by the image NK in the following text is 0x8c200000.
Memory size: indicates the memory size in hexadecimal notation. 0x01800000 (24 m) in bib, the size of the sub-memory needs to be determined based on the NK size of your system. If it is a Chinese system, this size should be increased.
Type: the type of the memory segment. The following types are available:
① Fixupvar: used to initialize global variables in the kernel during the makeimage phase compiled by wince.
② Nandimage: When an image using binfs is created, the wince Kernel on the NAND device is redirected to the Zone in Ram. When the system accesses this zone (this block of RAM, binfs will access the corresponding locations on the NAND device and return data to the system. In fact, xip is implemented on the NAND device. For example, if the Development Board has NAND Flash, you can mark the memory segment as nandimage. If bootloader supports binfs, The binfile stored in NAND Flash supports local xip execution (by default, only nor flash supports local execution). This segment of memory must also be aligned.
③ RAM: specifies that the memory segment is Ram, which defines the ram zone used by the wince system. The wince system can use this memory to execute programs and store RAM file systems. The memory must be continuous. Here, we must note that from the hardware point of view, the memory cannot span two pieces of SDRAM, that is, the whole area space must be on one piece of hardware SDRAM.
④ Ramimage: Specify the memory used to load the wince image (that is, NK. Bin). In fact, after the wince is started, the image will be copied to the memory area to run. An image can only have one consecutive ramimage area.
⑤ Reserved: This memory area will be reserved. It is generally used for framebuffer, DMA buffer, or a shared memory for eboot to pass parameters to the wince system. wince will not use this memory area.
⑥ Extension: defines the area in a wince image as the data area of romhdr extension.
See the following config. bib file.
The following is the wince500 \ platform \ smdk2440 \ files \ config. bib file of our products.
Memory
NK 8c200000 01800000 ramimage
Ram 8da00000 04d00000 Ram
; Common RAM Areas
Aud_dma 8c002000 00002000 Reserved
Drv_glb 8c010000 00010000 Reserved
Sd_dma 8c028000 00008000 Reserved
Edbg 8c030000 00020000 Reserved
Camera 8c087487 000a0000 Reserved
Display 8c183000 0007d000 Reserved
/*************************************** **************************/
The content in this section indicates that the 24 MB space starting from the address 0x8c200000 is used to store the runtime impact (NK. BIN); The 77m memory starting from 0x8da00000 is the ram zone and can be used by applications; the memory from 0x8c002000 to 0x8c200000 is retained, mainly in the sound and display DMA areas.
/*************************************** **************************/
(2) config: this is an additional option, which is generally defined in the config. bib file to tell the build system how to generate a runtime image. The format is as follows:
Config
Item = parameter
Items are commonly used:
① Autosize: The default value is on. If wince image is in Ram, this option allows automatic allocation of Ram not used by wince image to the wince operating system, that is, it is used as the ram of the wince system.
② Profile: whether to include the structure and symbol used for performance profiling in wince image. The default value is off.
③ Bootjump: Specifies the jump address of the system at startup. By default, the system will jump to the address of the startup function.
④ Compression: specify whether the build system compresses the writeable part of the wince image. If this part is compressed, it will be decompressed to ram during the wince operation; if it is not compressed, it will be copied directly to ram.
⑤ Kernelfixups: Specifies whether the build system migrates the writable areas of the kernel. The default value is on. The writable area of the kernel is relocated to the starting address of RAM.
⑥ Ramflags: specifies some bit masks of kernel features and can be combined.
0x01: Disabled on-demand page, so that a module is fully loaded into RAM before running.
0x02: Indicates disabling full kernel (full kernel mode ).
0x10: indicates that only files in the module of bib files are trusted.
0x20: indicates that the kernel should not clear the TLB of X86.
0x40: load the DLL according to the address in the/base link option of the DLL, so that the DLL can be loaded to a pre-defined address.
7. romstart: the starting address of the wince image in the memory, 0x8c200000 in the following text.
⑧ Romwidth: Specifies the width of the data bus, which can be 8 to 16 or 32.
8: The building system divides the wince image into four files, which are stored in order by 8 bytes.
16: indicates that the building system divides the entire wince image into two files.
32: indicates that the building system uses the entire wince image as a file.
Required romsize: Specifies the size of the wince image.
Memory fsrampercent: defines the percentage of memory used by the file system. The default value is 0x80808080.
Byte 0: in the first 2 MB, each 1 MB contains a multiple of 4 kb.
Byte 1: In the first 2 MB, each 1 MB contains a multiple of 4 kb.
Byte 2: in the first 2 MB, each 1 MB contains a multiple of 4 kb.
Byte 3: In the remaining memory, each 1 MB contains a multiple of 4 kb.
Part of the config. bib file:
Config
Compression = on
Kernelfixups = on
/*************************************** ***********/
This code segment specifies the writeable part of the building system to compress the wince image and relocate the writeable part of the wince image.
/*************************************** ************/*
If imgprofiler
Profile = on
Endif
If imgprofiler!
Profile = off
Endif
/*************************************** **************/
If the environment variable imgprofiler is set, start the profile.
/*************************************** ****************/
If imgtrustromonly
If imgnotallkmode
Romflags = 12
/*************************************/
Indicates disabling full kernel (full kernel mode) and trusting only files in the module of bib files.
/***************************************/
Endif
If imgnotallkmode!
Romflags = 10 // indicates that only files in the modules block in the bib file are trusted.
Endif
Endif
If imgtrustromonly!
If imgnotallkmode
Romflags = 2 // indicates disabling full kernel (full kernel mode ).
Endif
If imgnotallkmode!
Romflags = 0
Endif
Endif
Romstart = 8c200000
Romwidth = 32
Romsize = 01500000
Fsrampercent = 0x08080808
(3) modules and files
These two items list all modules and files included in the wince image, and how these modules and files are loaded into the memory. The specific format is as follows:
Modules
Name path memory type
Name: the name of the file, such as the name of a DLL or EXE file.
Path: the complete path and name of the file to be packaged. It is generally the release directory of the wince project.
Memory: Specify the memory in which the file is stored in the memory item mentioned above.
Type: specifies the type of a file. The following types are commonly used:
① S: indicates the system file.
② H: Indicates hiding a file.
③ U: indicates that the file is not compressed.
④ D: the file cannot be debugged.
⑤ N: this file is untrusted.
⑥ M: This file cannot be paginated on demand.
The following content is part of the platform. bib file.
Modules
; Name path memory type
If bsp_nodisplay!
S3c2440disp. dll $ (_ flatreleasedir) \ s3c2440disp. dll NK sh
Endif bsp_nodisplay!
/*************************************** **************/
If set bsp_nodisplay = 1 is set in the smdk2440 DOS batch file in the XXX: \ wince500 \ platform \ smdk2440 directory, the build system will not package s3c2440disp. DLL to wince image (NK. BIN.
/*************************************** ********************/
Backlite. dll $ (_ flatreleasedir) \ backlite. dll NK sh
Camera. dll $ (_ flatreleasedir) \ camera. dll NK sh
Avout. dll $ (_ flatreleasedir) \ Avout. dll NK sh
/*************************************** *******************/
Based on the above content, the backlite under the _ flatreleasedir directory will be built. DLL, camera. DLL and Avout. DLL package to wince image, put it in NK memory, and specify them as system files and hidden files.
/*************************************** *******************/
Files
; Name path memory type
Events.wav $ (_ flatreleasedir) \ events.wav nk h
Loadguid.exe $ (_ flatreleasedir) \ loadguid.exe NK u
Powerapp.exe $ (_ flatreleasedir) \ powerapp.exe NK u
Usbcnect. lnk $ (_ flatreleasedir) \ usbcnect. lnk NK u
Usbcnect.exe $ (_ flatreleasedir) \ usbcnect.exe NK u
Bib files support "Conditional compilation". We can selectively package certain modules into wince image by setting environment variables. In BSP, we use if to determine the environment variables of some driver modules. For the wince system modules, it is generally the sysgen variable. We should use @ cesysgen if to determine the environment variables.
The most common features in BSP development include stepldr. bib, eboot. bib, config. bib, platform. bib, and project. bib. Among them:
Project. bib: the configuration of this file is mainly for the current OS design.
Platform. bib: This file contains hardware-related files, mainly drivers.
Config. bib: This file describes the memory configuration of the wince system.
Eboot. bib: This file describes the memory configuration of the eboot of the wince system.
Stepldr. bib: This file describes the nboot memory configuration of the wince system.