Книга: Microsoft Windows Embedded CE 6.0 Exam Preparation Kit
Binary Image Builder Files
Binary Image Builder Files
The Windows Embedded CE build process relies on .bib files to generate the content of the run-time image and to define the final memory layout of the device. At the end of the build process, during the Make Run-time Image phase, the Make Binary Image tool (Makeimg.exe) calls the File Merge tool (Fmerge.exe) to combine all applicable .bib files, such as Config.bib and Platform.bib from the Platform<BSP Name>Files folder, Project.bib, Common.bib, and any subproject .bib files, into a file named Ce.bib in the release directory. The Make Binary Image tool then calls the ROM Image Builder tool (Romimage.exe) to process this file and determine which binaries and files to include in the run-time image.
A .bib file can include the following sections:
? MEMORY Defines the parameters for the memory layout. You can typically find this section in the Config.bib file for your BSP, such as C:Wince600PlatformDeviceEmulatorFilesConfig.bib.
? CONFIG Defines configuration options for Romimage.exe to customize the binary run-time image. You can typically find this section in the Config.bib file for your BSP. This section is optional.
? MODULES Specifies a list of files that Romimage.exe marks to be loaded into RAM or executed in place (XIP). Only uncompressed object modules can execute directly from read-only memory. You can list native executable files in this section, but not managed binaries, because the Common Language Runtime (CLR) must convert the Microsoft Intermediate Language (MSIL) content into native machine code at run time.
? FILES References executables and other files that the operation system should load into RAM for execution. You should specify managed code modules in this section.
.BIB File MEMORY Section The MEMORY section in the Config.bib file defines reserved memory regions, assigning each region a name, address, size, and type. A good example is the MEMORY section that you can find in the Config.bib file in the Device Emulator BSP. This Device Emulator BSP is available with Platform Builder for CE 6.0 R2 out-of-the-box. You can find Config.bib in the PLATFORM<BSP Name>FILES directory. Figure 2-4 shows this MEMORY section in Visual Studio 2005.
Figure 2-4 MEMORY section from a .bib file
The fields in the MEMORY section define the following parameters:
? Name This is the name of the MEMORY section. The name must be unique.
? Address This hexadecimal number represents the starting address of the memory section.
? Size This hexadecimal number defines the total length of the memory section in bytes.
? Type This field can have one of the following values:
? RESERVED Indicates that this area is reserved. Romimage.exe skips these sections during image creation. For example, the Ce.bib file shown in Figure 2-4 includes several RESERVED sections, such as an ARGS section to provide a shared memory area for the boot loader (EBOOT) to pass data to the system after startup (ARGS) and a DISPLAY section for a display buffer. The Ce.bib file of other OS designs might include different RESERVED sections for memory areas that the kernel is not supposed to use as system memory.
? RAMIMAGE Defines the memory area that the system can use to load the kernel image and any modules you specified in the MODULES and FILES sections of .bib files. A run-time image can only have one RAMIMAGE section and the address range must be contiguous.
? RAM Defines a memory area for the RAM file system and for running applications. This memory section must be contiguous. If you need a noncontiguous memory section, such as for extension dynamic RAM (DRAM) present on the device, you can allocate noncontiguous memory by implementing the OEMGetExtensionDRAM function in the OAL of the BSP. Windows Embedded CE supports up to two sections of physical noncontiguous memory.
.BIB File CONFIG Section The CONFIG section defines additional parameters for the run-time image, including the following options:
? AUTOSIZE Automatically combines RAMIMAGE and RAM sections and allocates any unused memory in the RAMIMAGE section to RAM, or if necessary takes memory from the RAM section and provides it to the RAMIMAGE.
? BOOTJUMP If specified, moves the boot jump page to a specific area within the RAMIMAGE section, rather than by using the default area.
? COMPRESSION Automatically compresses writable memory sections in the image. The default value for this option is ON.
? FIXUPVAR Initializes a kernel global variable during the Make Binary Image phase.
? FSRAMPERCENT Sets the percentage of RAM used for the RAM file system.
? KERNELFIXUPS Instructs Romimage.exe to relocate memory writable by the kernel. This option is generally enabled (ON).
? OUTPUT Changes the directory that Romimage.exe uses as the output directory for the Nk.bin file.
? PROFILE Specifies whether the image includes the profiler.
? RAM_AUTOSIZE Expands the size of RAM to the end of the last XIP section.
? RESETVECTOR Relocates the jump page to a specified location. This is required for MIPS processors to boot from 9FC00000.
? ROM_AUTOSIZE Resizes XIP regions, taking into account the ROMSIZE_AUTOGAP setting.
? ROMFLAGS Configures the following options for the kernel:
? Demand paging Fully copying a file into RAM before executing it or paging in parts of it.
? Full kernel mode Run every OS thread in kernel mode, which leaves the system vulnerable to attack but improves performance.
? Trust only ROM modules Marks only files in ROM as trusted.
? Flush the X86 TLB onX86 systems Improves performance but adds a security risk.
? Honor the /base linker setting Defines whether or not to use the /base linker setting in DLLs.
? ROMOFFSET Enables you to run the run-time image in a memory location that is different from the storage location. For example, you can store the run-time image in FLASH memory, and then copy and run it from RAM.
? ROMSIZE Specifies the size of the ROM in bytes.
? ROMSTART Specifies the ROM's starting address.
? ROMWIDTH Specifies the number of data bits and how Romimage.exe splits the run-time image. Romimage.exe can put the entire run-time image into one file, split the run-time image into two files of even and odd 16-bit words, or create four files of even and odd 8-bit bytes.
? SRE Determines whether Romimage.exe generates a .sre file. Motorola S-record (SRE) is a file format recognized by most ROM burners.
? X86BOOT Specifies whether or not to add a JUMP instruction at the x86 reset vector address.
? XIPSCHAIN Enables the creation of Chain.bin and Chain.lst files to set up an XIP chain, so that you can split an image into multiple files.
.BIB File MODULES and FILES Sections BSP and OS design developers must frequently edit the MODULES and FILES sections of a .bib file to add new components to a run-time image. The format for the MODULES and FILES section is practically identical, although the MODULES section supports more configuration options. The key difference is that the MODULES section lists files not compressed in memory to support XIP, while the FILES section lists files that are compressed. The operating system must decompress the data when accessing the files.
The following listing shows two small MODULES and FILES sections from a Platform.bib file. For a complete example, check out the Platform.bib file of the Device Emulator BSP.
MODULES
; Name Path Memory Type
; -------------- ---------------------------- -----------
; @CESYSGEN IF CE_MODULES_DISPLAY
IF BSP_NODISPLAY !
DeviceEmulator_lcd.dll $(_FLATRELEASEDIR)DeviceEmulator_lcd.dll NK SHK
IF BSP_NOBACKLIGHT !
backlight.dll $(_FLATRELEASEDIR)backlight.dll NK SHK
ENDIF BSP_NOBACKLIGHT !
ENDIF BSP_NODISPLAY !
; @CESYSGEN ENDIF CE_MODULES_DISPLAY
FILES
; Name Path Memory Type
; -------------- ---------------------------- -----------
; @CESYSGEN IF CE_MODULES_PPP
dmacnect.lnk $(_FLATRELEASEDIR)dmacnect.lnk NK SH
; @CESYSGEN ENDIF CE_MODULES_PPP
You can define the following options for file references in MODULES and FILES sections:
? Name The name of the module or file as it appears in the memory table. This name is usually the same as the file name in the run-time image.
? Path The complete path to the file that Romimage.exe incorporates into the run-time image.
? Memory References the name of a memory area in the MEMORY section of the Config.bib file into which Romimage.exe loads the module or file. It is usually set to NK to integrate the file in the NK area defined in the MEMORY section.
? Section Override Enables you to specify modules in a FILES section and files in a MODULES section. Essentially, Romimage.exe ignores the section in which the entry resides, and treats the entry as a member of the specified section. This parameter is optional.
? Type Specifies the file type and can be a combination of flags, as shown in Table 2-3.
Table 2-3 File type definitions for MODULES and FILES sections
MODULES and FILES Sections | MODULES Section Only |
---|---|
? S The file is a system file. | ? K Instructs Romimage.exe to assign a fixed virtual address to the DLL's public exports and runs the module in kernel mode rather than user mode. Drivers must run in kernel mode to have direct access to the underlying hardware. |
? H The file is hidden. | ? R Compress resource files. |
? U The file is uncompressed. (The default setting for files is compressed.) | ? C Compress all data in the file. If the file is already in RAM, it will be decompressed again into a new section of RAM, which results in higher RAM consumption. |
? N The module is not trusted. | ? P Do not check the CPU type on a per-module basis. |
? D The module cannot be debugged. | ? X Sign the module and include the signature in the ROM. |
? M Signals that the kernel must not page the module on demand. (See Chapter 3 for more information on the effects of demand paging.) | |
? L Instructs Romimage.exe not to split the ROM DLL. |
Conditional .bib File Processing It is important to note that .bib files support conditional statements based on environment variables and SYSGEN variables. You can set environment variables through catalog items, and then check these variables in IF statements in a .bib file to include or exclude certain modules or other files. For SYSGEN variables, use @CESYSGEN IF statements instead.
The MODULES and FILES listing in the previous section illustrates the use of @CESYSGEN IF and IF statements for processing conditions based on SYSGEN and environment variables. For example, the @CESYSGEN IF CE_MODULES_DISPLAY statement in the MODULES sections specifies that the BSP should automatically include the display driver if the OS design includes a display component. You can verify that Platform Builder adds the display component to the BSP automatically if you display the Catalog Items View in Visual Studio for an OS design that uses a display, as illustrated in Figure 2-5.
Figure 2-5 Core OS components that depend on the display item
- Windows Embedded CE Run-Time Image Content
- Database Files
- File System Files
- Binary Serialization
- fwbuilder
- Chapter 2 Building and Deploying a Run-Time Image
- Для чего нужны папки Windows, Documents and Settings, Program Files и Temp?
- Можно ли указать использование по умолчанию вместо C:Program Files другого каталога для установки программ?
- Можно ли удалять из папки Program Files папки деинсталлированных программ?
- 1.22. Показ изображений с помощью UIImageView
- Use and Edit Files in the
- Абстрактный базовый класс FileSystemInfo