Выбрать главу

The following listing illustrates how to use a Project.dat file to create two new root directories named Program Files and My Documents, create a My Projects subdirectory under Program Files, and map the Myfile.doc file from the Windows directory into the My Documents directory.

Root:-Directory("Program Files")

Root:-Directory("My Documents")

Directory("\Program Files"):-Directory("My Projects")

Directory("\My Documents"):-File("MyFile.doc", "\Windows\Myfile.doc")

Lesson Summary

A thorough understanding of the build system can help to decrease development time and therefore project costs. You must know the steps performed during each phase of the build process if you want to test source code changes quickly and without unnecessary compilation cycles. You must also know the purpose and location of the run-time image configuration files, such as .reg, .bib, .db, and .dat files, to create and maintain OS designs efficiently.

The Windows Embedded CE build system combines the various .reg, .bib, .db, and .dat files during the Make Run-time Image phase into consolidated files that the build system then uses to configure the final run-time image. It is a good idea to check these files if you want to verify that a specific setting or file made it into the final image without having to load the run-time image on the target device. You can find the various run-time image configuration files in the release directory of the OS design. If you discover that expected entries are missing, check the conditional statements and the environment variables and SYSGEN variables defined in your catalog items.

The build system creates the following run-time image configuration files during the Make Run-time Image phase:

■ Reginit.ini Combines the Platform.reg, Project.reg, Common.reg, IE.reg, Wceapps.reg, and Wceshell.reg files.

■ Ce.bib Combines the Config.bib, Platform.bib, Project.bib, and Subproject bib files.

■ Initdb.ini Combines the Common.db, Platform.db, and Project.db files.

■ Initobj.dat Combines the Common.dat, Platform.dat, and Project.dat files.

Lesson 2: Editing Build Configuration Files

In addition to run-time image configuration files, Windows Embedded CE also uses build configuration files to compile and link source code into functional binary components. Specifically, the build system relies on three types of source code configuration files: Dirs, Sources, and Makefile. These files provide the Build tool (Build.exe) and the compiler and linker (Nmake.exe) with information about the source-code directories to traverse, the source code files to compile, and what type of binary components to build. As a CE developer, you frequently must edit these files, such as when cloning public catalog items, by following the procedures discussed in Chapter 1.

After this lesson, you will be able to:

■ Identify the source code configuration files used during the build process.

■ Edit build configuration files to generate applications, DLLs, and static libraries.

■ Estimated lesson time: 25 minutes.

Dirs Files

Dirs files identify directories that contain source-code files to be included in the build process. When Build.exe finds a Dirs file in the folder in which it is run, it traverses the subdirectories referenced in the Dirs file to build the source code in these subdirectories. Among other things, this mechanism enables you to update parts of a run-time image selectively. If you make changes to the source code in Subprojectl, you can rebuild this subproject selectively by running Build.exe in the Subprojectl directory. You can also exclude directories in the source code tree from the build process by removing the corresponding directory references from the Dirs file, or by using conditional statements.

Dirs files are text files with a straightforward content structure. You can use the DIRS, DIRS_CE, or OPTIONAL_DIRS keyword, and then specify the list of subdirectories on a single line, or on multiple lines if you terminate each line with a backslash to continue on the next line. Directories referenced by using the DIRS keyword are always included in the build process. If you use the DIRS_CE keyword instead, Build.exe only builds the source code if the source code is written specifically for a Windows Embedded CE run-time image. The OPTIONAL_DIRS keyword designates optional directories. Keep in mind, however, that Dirs files can contain only one DIRS directive. Build.exe processes the directories in the order they are listed, so be sure to list prerequisites first. It is also possible to use the wildcard "*" to include all directories.

The following listing, taken from default Windows Embedded CE components, illustrates how to include source code directories in the build process by using Dirs files.

# C:\WINCE600\PLATFORM\DEVICEEMULATOR\SRC\Dirs

# ---------------------------------------------------

DIRS=common \

 drivers \

 apps    \

 kitl    \

 oal     \

 bootloader

# C:\WINCE600\PLATFORM\H4SAMPLE\SRC\DRIVERS\Dirs

# ---------------------------------------------------

DIRS= \

# @CESYSGEN IF CE_MODULES_DEVICE

 buses \

 dma \

 triton \

# @CESYSGEN IF CE_MODULES_KEYBD

 keypad \

# @CESYSGEN ENDIF CE_MODULES_KEYBD

# @CESYSGEN IF CE_MODULES_WAVEAPI

 wavedev \

# @CESYSGEN ENDIF CE_MODULES_WAVEAPI

# @CESYSGEN IF CE_MODULES_POINTER

 touch \

 tpagent \

# @CESYSGEN ENDIF CE_MODULES_POINTER

# @CESYSGEN IF CE_MODULES_FSDMGR

 nandflsh \

# @CESYSGEN ENDIF CE_MODULES_FSDMGR

# @CESYSGEN IF CE_MODULES_SDBUS

 sdhc \

# @CESYSGEN ENDIF CE_MODULES_SDBUS

# @CESYSGEN IF CE_MODULES_DISPLAY

 backlight \

# @CESYSGEN ENDIF CE_MODULES_DISPLAY

# @CESYSGEN IF CE_MODULES_USBFN

 usbd \

# @CESYSGEN ENDIF CE_MODULES_USBFN

# @CESYSGEN ENDIF CE_MODULES_DEVICE

# @CESYSGEN IF CE_MODULES_DISPLAY

 display \

# @CESYSGEN ENDIF CE_MODULES_DISPLAY

NOTE
Editing Dirs files in Solution Explorer

The Solution Explorer in Visual Studio with Platform Builder for Windows Embedded CE 6.0 R2 uses Dirs files to generate a dynamic view of the Windows Embedded CE directory structure in an OS design project. However, you should not add or remove directories in Solution Explorer, because editing Dirs files in Solution Explorer can lead to a changed build order, which can result in build errors that require a second build to resolve.

Sources Files