Home > Articles > Operating Systems, Server

  • Print
  • + Share This

Extending the Platform Builder Catalog

The Platform Builder catalog isn't for components that ship with Windows CE. Components can be added to the catalog so that they become available as standard components for a given platform. When you're adding a component, the principal pieces of information you must supply are its name, a method to build the component, the group to which this component belongs (this could be a new group or an existing one in the catalog), and a unique ID. A multitude of other information, which we will discuss shortly, must also be supplied.

Let's start by introducing the unique ID. This ID must be unique across any component ever created for Windows CE. A globally unique identifier (GUID), also referred to as a universally unique identifier (UUID), is a 128-bit value that uniquely identifies a component. You can generate a unique number on demand by using the Microsoft utility guidgen.exe. You can then use this number to identify a component that must be added to the catalog. If a GUID is not supplied, Platform Builder generates one for the component when adding it to the catalog. However, providing a GUID for each component is recommended because it must be supplied when modifications are made to the component in the catalog.

Guidgen will generate a new GUID and allow you to copy it to Clipboard so that you can paste it into any other application. One of four formats can be selected. For a format suitable for our purposes, select Registry Format. Then click on the Copy button. Now the GUID can be pasted in via the editor being used to create the component that will be added to the catalog.

Components to be imported into a catalog must be specified by a special syntax and placed in a file with a .cec extension. Files with the .cec extension are called component files.

Component Files in Depth

Component files have a format for laying out information about a component. The best way to start is by example. Recall that we built an application called welcome.exe for our project Adam. This simple welcome application can be included as a standard component in the catalog. A CEC file must be used to describe this component before it can be imported into the catalog.

CECInfo Block

Every component file starts with the CECInfo block (Listing 3.6), a structure that contains information about the component file itself. Note that any text following the characters "//" up to the end of the line is considered to be a comment.

Listing 3.6  Sample component file header

CECInfo (
  Name(New.cec)
  CECVersion (3.00)
  // GUID() – left blank
  Vendor ("Windows CE Unlimited")
  Description ("A sample Cec file")
)

The fields of the CECInfo block are specified as follows:

  • Name is an optional field that identifies the name of the component file.

  • CECVersion is a mandatory field that can have a value of either 2.12 or 3.00. It identifies the version of Windows CE for which the component file was written.

  • GUID is an optional field containing a number that uniquely identifies the component file. If it is left blank, a GUID will automatically be generated for the component file when it is used to import the component.

  • Vendor is an optional field identifying the vendor that is distributing this component as part of the catalog.

  • Description is an optional field that describes the component file.

ComponentType Block

The component itself is described by a ComponentType block. Consider the sample shown in Listing 3.7, which describes welcome.exe as a component.

Listing 3.7  Sample component file

ComponentType (
 Name( Welcome )
 GUID( {232FBCF4-72DD-4208-A40F-686A42FFE8B3} )
 Description( "Welcome application" )
 Group( "\Standard Applications" )
 Implementations(
  Implementation(
    Name(Welcome)
    GUID( {2A8D35B5-F6BC-485c-867B-8352826D27CF} )
    Description( "Welcome application" )
    Vendor("Windows CE Book")
    Date(05/05/2000)
    BuildMethods(
      BuildMethod(
         Step( buildrel )
         GUID( {A3CED1C5-617E-4065-A784-8551FA00A249} )
         CPU( x86 )
         InputFiles( )
         OutputFiles( )
         Action( "#COPY( "$(_PROJECTROOT\Welcome\Obj\Welcome.exe", $(_FLATRELEASEDIR)" )))
         Setting( '#CHM( "Welcome.chm" )' )
         Setting( '#CHM( "Welcome.chi" )' )
         Setting('#INPUT("Include Welcome", INCLUDE_WELCOME, 1, 0, "")')
      )
    )
  )
 )
)

The fields of the ComponentType block are specified as follows:

  • Name specifies the name of the component. The name of the component in Listing 3.7 is Welcome.

  • GUID is an optional field containing a number that uniquely identifies the component. In this case we have assigned a GUID to the component so that we can specify it later to modify this component.

  • Description is an optional field that describes this component. It is displayed when the properties for a component are viewed in Platform Builder.

  • Group is an optional field that refers to the organization hierarchy displayed in the catalog. If you specify \Standard Applications in the sample, this component will be added to a new group in the catalog at the root level called Standard Applications. Welcome will be added as a component to this group. You can add a component to an existing component simply by specifying its name. Group names in a group hierarchy can be separated by a backslash (\). If no other option is specified, the component is added directly to the root of the catalog.

  • Vendor identifies the vendor of the component. The value of this field is displayed when the properties for the component are viewed (right-click on the component in the catalog and select Properties from the pop-up menu).

Implementation Block

Each ComponentType block must have an embedded Implementations block (see Listing 3.7). The Implementations block can consist of one or more Implementation blocks that describe how the component has been implemented.

The fields of the Implementation block are specified as follows:

  • Name is a mandatory field that identifies the Implementation block in other Implementation blocks.

  • GUID contains the unique identifier for the Implementation block. This field is optional, but if specified, it must be unique for each block. An implementation may be referred to by name or by GUID. If this field is left blank, Platform Builder automatically generates and applies a GUID to this block.

  • Description is an optional field that describes the implementation.

  • Vendor is an optional field that identifies the vendor of the implementation and is optional.

  • Children is an optional field that lists any children of an implementation. This field can be used to specify any dependent implementations. A child implementation must be described earlier in the component file. Implementations may be identified by name or GUID in this field.

  • Date is an optional field that specifies the date of implementation in MM/DD/YY format.

This date can be set to the date the component was built or to the date it was included in the catalog.

BuildMethods Block

The BuildMethods block, along with the Name field, is required in the Implementation block. The BuildMethods block is followed by one or more BuildMethod blocks, each of which specifies a method for building the component (see Listing 3.7). The fields of the BuildMethod block are specified as follows:

  • Step and Action are mandatory fields that form the heart of the BuildMethod block. Together these fields specify how this particular implementation of the component will be built. The following list gives the different keywords that can be specified in these fields. For a more thorough treatment of how each of these keywords operates, refer to Chapter 10. The command specified in the Action field depends on the keyword specified in the Step field (see Table 3.6).

    Table 3.6  Build Actions

    Step Keyword

    Phase of Build

    Action Command

    CESYSGEN

    System generation phase. The Microsoft modules and third- party vendor components that make up the Windows CE system are combined to create a core operating system. Components supplied by the system integrator are added to this build to create the final image.

    #COPY

    BSP

    Core build phase. During this phase of the build process, each component that is part of the Windows CE image is built individually.

    #ENV

    #BUILD

    #CUSTOM

    BUILDREL

    Build-release phase. In this phase, all the output files are collected in a predetermined location in a mass copy operation.

    #COPY

    #CUSTOM

    MAKEIMG

    Make-image phase. The final operating system image is built from the collected files.

    #ENV


    The Action field can contain the commands specified in the list that follows. In each case the entire command must be enclosed in quotation marks for it to be executed—that is, Action ("<command>").

    • #COPY("SrcPath", "TargetDir") copies a file with a fully qualified path name into the target directory. Use this command to copy files during the system generation or build-release phases. For example, this command can be used to copy a component to the final target directory from which the operating system image is constructed.

    • #ENV("Variable", "Value") sets an environment variable to a specific value. For a more detailed explanation of how environment variables can affect a build, refer to the section titled Customizing the Build Using Environment Variables earlier in this chapter and to Chapter 10.

    • #BUILD(Dirs< | Sources, "Directory") tells the build process to build either a Dirs file or a Sources file to be found in the directory specified in Directory. Dirs and Sources files specify commands for building one or more components. A more thorough treatment of these files can be found in Chapter 11.

    • #BUILD(MAK, "Directory", "Makefile") is an alternative flavor of the BUILD command that can be used to build a component with a custom makefile. A custom makefile would be used in lieu of a sources file for better control of the build process. This command can also be helpful in porting components to Windows CE, where you can use a fully tested makefile instead of converting it into a sources file. For a quick primer on how makefiles work, refer to Appendix B.

    • #CUSTOM("WorkingDirectory", "CustomCommand") can be used to execute a command specified by CustomCommand. This command is executed from the directory specified by WorkingDirectory. It can be used to execute scripts like batch files that perform tasks that either cannot be performed by a makefile or would be extremely tedious to port to a makefile. Again, legacy components that are built by scripts can be accommodated by this command.

  • GUID contains the unique identifier for the Implementation block. This field is optional, but if specified, it must be unique for each block. An implementation may be referred to by name or by GUID. If the field is left blank or not specified, Platform Builder automatically generates and applies a GUID to this block.

  • CPU is a mandatory field that indicates if the implementation is CPU specific. Current CPU values that can be specified in this field are SH3, SH4, SA1100, ARM720, ARM720T, R3912, R4102, R4111.16, R4111.32, R4300, PPC403, PPC821, and x86 for Windows CE 3.0. This list, supported by Microsoft, may grow in the future as more processors are supported by Windows CE. Processors may also be dropped from this list. The value of the CPU field must be enclosed in quotation marks. The value default indicates that the implementation is for the default list of processors for the operating system. The default list is the list supported by Microsoft.

  • Setting is an optional field that supports three different operations:

    1. #INPUT( "Sysgen setting", EnvironmentVariable, 1 | 0, InitialValue, BspValue). Each BuildMethod block is allowed to specify a setting during the system generation phase, referred to as Cesysgen or Sysgen. In the Platform Builder IDE, you can select or deselect Sysgen by selecting Build and then Settings, and finally clicking on the Sysgen tab in the Platform Settings dialog box.

      Each setting sets an environment variable. The #INPUT operation allows such a setting to be made visible in the Sysgen tab of the Platform Settings dialog box. The string Sysgen setting is displayed in the tab. The environment variable specified by EnvironmentVariable is either set or unset depending on its value: either 1 or 0. If the value is 1, then the environment variable will be set to TRUE when the setting is selected. A value of 0 specifies that the variable be set to FALSE when the setting is selected. Finally, InitialValue specifies the initial value of the environment variable and hence the default selection of the setting in the tab. BspValue is a string that is set to the name or GUID of the board support package that allows this setting.

    2. #OUTPUT(Output) allows the selection of a particular module in the image. Output is usually an environment variable that is read by the cesysgen.bat file during the system generation phase (we'll give more details in Chapter 10).

    3. #CHM("HelpOrHelpIndexFile") associates an HTML help file (.chm extension) or a help index file (.chi extension) with the component. When an SDK is exported, the component's help files specified by this operation are automatically included in the SDK by Platform Builder.

  • InputFiles is an optional field that is used to specify a list of files, separated by spaces, required to perform the build for this component.

  • OutputFiles is an optional field that is used to specify a list of files, separated by spaces, output by the build.

Adding a Component to the Catalog

One global catalog is used by Platform Builder to store components and can be reused across projects. To add a component to the catalog, you must create the component. Component files have a .cec extension. To import the component, select Manage Platform Builder Components... in the File menu. The resulting dialog box lists all the components that have already been imported (Figure 3.15). Click on Import New... and browse for the component file that has been created for the new component.

Figure 3.15 Adding Welcome to the catalog

As an example, save Listing 3.6 to a file called new.cec and import it into the catalog. Welcome will show up as a member of the catalog under the folder Standard Applications. After Welcome has been added to the catalog (Figure 3.16), it is available for inclusion in all new platforms.

Figure 3.16 The catalog after Welcome has been added

The dialog box to manage platform builder components is a front end to the pbcec.exe utility that comes with Platform Builder. Pbcec imports components into the catalog. To import a component, we call Pbcec with the component file name as its argument. For example, to import the Welcome component into the CEPC catalog via the command line, we would have invoked Pbcec in the following way:

Pbcec New.cec

Calling Pbcec with the /list argument lists the components in the catalog. A sample run yielded the following output:

Microsoft (R) Platform Builder 3.00 Catalog Utility
Copyright (C) Microsoft Corp 2000. All rights reserved.
CEC File         Description
========         ===========
cepc.cec         CEPC components
configs.cec      CoreOS components
extras.cec       OAL components
mfcatl.cec       MFC and ATL components
odo.cec          Odo components
platmgr.cec      Platform Manager components
vbrt.cec         VBCE Components
ddtk30.cec       Driver Development Test Kit Components
new.cec          A sample Cec file
There are currently 9 cec files in the catalog.

When called with the /r option, Pbcec removes from the catalog the component that is specified in the file passed in as the Pbcec argument. The /clean option does exactly what it says: It clears out all components from the catalog.

  • + Share This
  • 🔖 Save To Your Account

Related Resources

There are currently no related titles. Please check back later.