- Platform Builder Basics
- Creating a New Platform with the Platform Wizard
- Building and Executing the Platform
- Creating Applications for Your Platform
- Running Windows CE on a CEPC
- Integrating New Components into the Image
- Customizing the Build Using Environment Variables
- Extending the Platform Builder Catalog
- Creating a New Board Support Package
- Summary
Creating a New Board Support Package
Extending the catalog allows components to be used across platforms that use the same board support package. System integrators may want to create a new BSP for a new processor or for a significantly new platform for an existing processor. The key to creating a new BSP is to create a new BSP file. The BSP file contains a list of instructions for how to build the platform and which OEM components are required for the platform. Users of the BSP can then build the platform in the manner that is prescribed in the BSP. In other words, a BSP file contains directions for the build process, whereas component files define the components to be built.
Before a BSP can be created, all of its components must be imported into the catalog. Let's say we are creating a BSP called Appliances. Appliances will support the x86 CPU and will provide components typically used by kitchen appliances, such as coffee makers, refrigerators, and so on. We'll keep the Appliances BSP simple for illustration purposes.
The first step is to import all of the Appliances components. We take the CEPC component file and modify it for Appliances. Then we import it into the catalog. Before we do that, we adjust Appliances so that it has no display, no keyboard support, and no USB or infrared support because these are not needed for the type of BSP we are creating. All GUIDs in the file being copied must be created again via guidgen.exe because Platform Builder expects all of these new components to be exported into the catalog. Listing 3.8 shows the component file for Appliances after cepc.cec was copied and modified.
Listing 3.8 Component file for Appliances
// appliances.cec - Appliances components CECInfo ( Name(Appliances) GUID({D1E60FE9-4370-4deb-B111-781D7CBAEA73}) CECVersion(3.00) Vendor("Microsoft") Description("Appliances components") ) // type "OAL" and 2 implementations // Appliances ComponentType ( Name( OAL ) GUID( {B3509B99-F1E4-11d2-85F6-004005365450} ) Description( "OEM Adaptation Layer" ) Implementations( Implementation( Name( Appliances ) GUID( {E0A5CD0C-9D7D-4c4c-B4E7-17A6CACB3E3B} ) Description( "Appliances OAL" ) BuildMethods( BuildMethod( Step( BSP ) GUID( {188258EE-AE2C-4013-8514-1D6EA325027C} ) CPU( "x86" ) Action( '#BUILD(DIRS, "$(_WINCEROOT)\platform\cepc\kernel")' ) Action( '#BUILD(DIRS, "$(_WINCEROOT)\platform\cepc\gwe")' ) ) ) ) ) ) // child type "ddk_bus" and implementation ComponentType ( Name( ddk_bus ) GUID( {4BB97298-47AC-43ef-BD2D-9E5B9FC3D1CA} ) Description( "ddk_bus" ) Implementations( Implementation( Name( ddk_bus ) Description( "ddk_bus" ) GUID( {C87FA2D3-8D13-49e4-91BD-A94C74DA6EE6} ) BuildMethods( BuildMethod( Step( BSP ) GUID( {84A08ED9-87A1-466a-A268-F9DEA522D2C1} ) CPU( "x86" ) OutputFiles( ddk_bus.LIB ) Action( '#BUILD(SOURCES, "$(_WINCEROOT)\platform\Appliances\Drivers\CEDDK\DDK_BUS")' ) ) ) ) ) ) // child type "ddk_map" and implementation ComponentType ( Name( ddk_map ) GUID( {8886E23C-797C-4b19-A871-843AA949B866} ) Description( "ddk_map" ) Implementations( Implementation( Name( ddk_map ) Description( "ddk_map" ) GUID( {02A46E4A-1CDB-4504-B99C-470C27157015} ) BuildMethods( BuildMethod( Step( BSP ) GUID( {F07C875B-1D69-4cf0-A54B-D7486886627B} ) CPU( "x86" ) OutputFiles( ddk_map.LIB ) Action( '#BUILD(SOURCES, "$(_WINCEROOT)\platform\Appliances\Drivers\CEDDK\DDK_MAP")' ) ) ) ) ) ) // type "ceddk" and implementation ComponentType ( Name( ceddk ) GUID( {8630294D-6B62-4422-9B72-2B2D29629AE5} ) Description( "ceddk" ) Group( "\Drivers\Appliances" ) Implementations( Implementation( Name( ceddk ) Description( "ceddk" ) GUID( {BBD69EB7-AA85-440b-ADCC-8C8D1D8C34C0} ) Children( ddk_bus ddk_map ) BuildMethods( BuildMethod( Step( BSP ) GUID( {D6907409-E7DB-4d98-8841-58AD8A25B75F} ) CPU( "x86" ) OutputFiles( pc_ddk.DLL ) Action( '#BUILD(SOURCES, "$(_WINCEROOT)\platform\Appliances\Drivers\CEDDK\DLL")' ) ) BuildMethod( Step( makeimg ) GUID( {C792A2F8-0419-49aa-8B1E-CEB62BA274F8} ) CPU( "x86" ) Action( '#ENV(IMGNOCEDDK, "")' ) ) ) ) ) ) // type "serial" and 2 implementations // "serial", and "NewSerialMDD" ComponentType ( Name( serial ) GUID ( {6401DC3D-E93A-4bfb-B58F-6818A0500E64} ) Description( "serial" ) Group( "\Drivers\Appliances" ) Implementations( Implementation( Name( serial ) Description( "serial" ) GUID ( {81AA1070-3B88-4680-AD9D-E132F6773584} ) BuildMethods( BuildMethod( Step( BSP ) GUID( {4DAB8E7F-365B-4f51-B905-EE82FA242D14} ) CPU( "x86" ) OutputFiles( serial.DLL ) Action( '#ENV(ODO_NOSERIAL, "")' ) Action( '#BUILD(SOURCES, "$(_WINCEROOT)\platform\Appliances\Drivers\SERIAL.PDD")' ) ) BuildMethod( Step( makeimg ) GUID( {8D6179A9-0BD4-4387-A664-5A8C5D946714} ) CPU( "x86" ) Action( '#ENV(ODO_NOSERIAL, "")' ) Action( '#ENV(NEW_SERIAL_MDD, "") ') ) ) ) Implementation( Name( NewSerialMDD ) Description( "New Serial MDD" ) GUID ( {52B0F538-8E24-4a07-BDE5-76A7259608BF} ) BuildMethods( BuildMethod( Step( BSP ) GUID( {2F65E925-A228-4875-841A-A1B456E2B23A} ) CPU( "x86" ) OutputFiles( com_card.dll com16550.dll ) Action( '#ENV(ODO_NOSERIAL, "")' ) Action( '#BUILD(SOURCES, "$(_WINCEROOT)\platform\Appliances\Drivers\COM_CARD")' ) Action( '#BUILD(SOURCES, "$(_WINCEROOT)\platform\Appliances\Drivers\COM16550")' ) ) BuildMethod( Step( makeimg ) GUID( {6CA564F3-178D-47ff-9D6B-D81378F1FC40} ) CPU( "x86" ) Action( '#ENV(ODO_NOSERIAL, "")' ) Action( '#ENV(NEW_SERIAL_MDD, 1)' ) ) ) ) ) ) // type "wavedev" and implementation ComponentType ( Name( wavedev ) GUID ( {E0B38875-FF8F-4685-99D4-9A591368609D} ) Description( "wavedev" ) Group( "\Drivers\Appliances" ) Implementations( Implementation( Name( wavedev ) Description( "wavedev" ) GUID ( {0F132F1D-4AB8-4c57-853D-68935FDED1DF} ) BuildMethods( BuildMethod( Step( BSP ) GUID( {A0E49B67-614C-47bf-80D0-48C7E25C664B} ) CPU( "x86" ) OutputFiles( wavedev.DLL ) Action( '#ENV(ODO_NOAUDIO, "")' ) Action( '#BUILD(SOURCES, "$(_WINCEROOT)\platform\Appliances\Drivers\WAVEDEV")' ) ) BuildMethod( Step( makeimg ) GUID( {6DE00180-A0BD-4e74-87E7-4BD50AF5E158} ) CPU( "x86" ) Action( '#ENV(ODO_NOAUDIO, "")' ) ) ) ) ) ) // type "EBOOT" and implementation ComponentType ( Name( EBOOT ) GUID( {F02E3B9F-CD10-44a5-BED5-1EAE187A2AE6} ) Description( "Appliances Eboot.bin" ) Group( "\Drivers\Appliances" ) Implementations( Implementation( Name( Eboot ) Description( "Appliances Eboot.bin" ) GUID( {086BA8F9-0788-4900-A48C-2D27F8AA8397} ) BuildMethods( BuildMethod( Step( BSP ) GUID( {C1450E38-C813-426f-BB98-6FDF40EC2216} ) CPU( "x86" ) Action( '#BUILD(SOURCES, "$(_WINCEROOT)\platform\Appliances\EBOOT")' ) ) ) ) ) )
When the component file shown in Listing 3.8 is imported into the catalog, the catalog shows the addition of an OAL component, Appliances, and the drivers that are part of the Appliances BSP (Figure 3.17).
Once the components for the BSP have been imported into the catalog, we need to create a new BSP. Platform Builder allows you to create a project with a placeholder for a BSP. To finish creating the BSP, you must expand the placeholdera painstaking process that must be carried out by hand.
To create a placeholder for a BSP, click on the File | New... menu option in Platform Builder. Choose to create a WCE platform from the Platforms tab and type in the name of a sample platform when the WCE Platform Wizard launches its first dialog box. For example, to create a BSP for a category called Appliances, type in "Brewster." Brewster is a sample coffee maker that uses Windows CE. We will take a more intimate tour of Brewster later on in this book. For now, it makes a guest appearance for illustration purposes.
In the second dialog box (step 2) of the wizard, select My BSP. This option indicates to Platform Builder that you are trying to create a new board support package. Type in the name of the BSP subdirectory. In our example we chose the name Appliances (Figure 3.18).
You must create this directory before you can execute step 2. Platform Builder will not create it for you. Accepting the defaults in the ensuing wizard dialogs will lead to the creation of Brewster. Figure 3.19 shows the Project window after Brewster is created and loaded in Platform Builder.
Note that Appliances shows up as an implementation in the project window. Right-clicking on it and selecting Properties will reveal that Platform Builder recognizes it as a BSP. However, there is nothing in the BSP yet. The directory created earlier is empty. The only trace that you have a new BSP is a file called appliances.bsp created in the Platform Builder IDE directory. For Windows CE 3.0, this directory is \WINCE300\WINDOWS CE PLATFORM BUILDER\3.00\CEPB\BIN\IDE. This file represents an empty BSP, and you must modify it by hand to complete the board support package. The appliances.bsp file is presented in Listing 3.9.
Listing 3.9 Appliances.bsp
// *** Appliances *** // NOTE: You will need to create an appliances.cec file // and import it into the catalog. When you have done that, // you can delete the two #ADD_USER_OAL lines below. // *** Global components (for all the configs) *** #ADD_USER_OAL_BUILD_METHOD ('#BUILD(dirs, "$(_WINCEROOT)\platform\ Appliances")') #ADD_USER_OAL_COMPONENT ("{2367C526-2821-4CEF-94A2-7286D5152E6F}", "Appliances") // *** CoreOS-specific components *** #IF ("COREOS","MINKERN") #ENDIF #IF ("COREOS","MAXALL") #ENDIF #IF ("COREOS","MINCOMM") #ENDIF #IF ("COREOS","MINGDI") #ENDIF #IF ("COREOS","MININPUT") #ENDIF #IF ("COREOS","MINSHELL") #ENDIF #IF ('COREOS","MINWMGR") #ENDIF #IF ("COREOS","IESAMPLE") #ENDIF
The BSP file contains placeholders for adding CoreOS-specific components. CoreOS refers to a configuration that represents a specific type of build of the operating system. Familiar configurations like MINKERN, MAXALL, and MINCOMM have already been added to this file. The directives required to build your custom platform should be inserted in this file as the final step to creating a board support package.
BSP File Directives
Before we add directives to the file, let's look at the types of directives that can be added to a BSP file. BSP file directives all start with the pound sign (#). Text that follows "//" is considered to be comment to the end of the line.
-
#ADD_COMPONENT_BY_GUID_TO_ROOT ("guid"). This directive is used to add a component implementation to the BSP. The component is identified by its GUID. Recall that right-clicking on a component and selecting Properties from the pop-up menu will reveal its GUID. To add the serial port driver to the BSP, you would add the following line within a CoreOS conditional:
#ADD_COMPONENT_BY_GUID_TO_ROOT ("{35E70441-EEA9-11D2-A092-0060085C1833}")
-
#ADD_FOLDER_TO_ROOT ("Folder"). You can organize the components by creating folders under the root. This directive is used to create a folder.
-
#ADD_COMPONENT_BY_GUID_TO_FOLDER ("guid", "Folder"). You can add a component to a specific folder using this directive.
-
#ADD_FOLDER_TO_FOLDER ("SubFolder", "Folder"). You can create deeper hierarchies by creating subfolders with this directive.
-
#ADD_TYPE_BY_GUID_TO_ROOT ("guid"). You can add a component type to the root via this directive.
-
#ADD_TYPE_BY_GUID_TO_FOLDER ("guid","Folder"). Using this directive, you can also add a component type under a folder, just as you would a component.
-
#ADD_ENV_VAR ("Variable","Value"). You can define an environment variable and set it to a specific value using this directive. Environment variables are like settings for the platform. They are used to communicate values between different utilities that build the operating system (Chapter 10 shows exactly how this works).
Note the two directives in appliances.bsp (see Listing 3.9). These lines are added by Platform Builder to an empty BSP file to support the creation of a new BSP. After you have populated the BSP file with components using the directives discussed, you must delete these lines. The lines provide a placeholder for the empty BSP and specify how to build the BSP.
Notice also from the same listing that the BSP files support conditional directives. Conditionals are used in the sample listing to specify which CoreOS is being built.
Finishing the New BSP: Appliances
After the required directives have been added to the BSP file (Listing 3.10), all of the physical implementation of all the components that are part of this new BSP must be copied under the newly created BSP directory. This means copying source code, libraries, and so on. The CEPC and Odo directories are examples of what a BSP directory should look like.
Listing 3.10 Modified appliances.bsp
// *** Appliances *** // NOTE: You will need to create an appliances.cec file // and import it into the catalog. When you have done that, // you can delete the two #ADD_USER_OAL lines below. // *** Global components (for all the configs) *** // #ADD_USER_OAL_BUILD_METHOD ('#BUILD(dirs, "$(_WINCEROOT)\platform\"Appliances")') // #ADD_USER_OAL_COMPONENT ("{2367C526-2821-4CEF-94A2-7286D5152E6F}", "Appliances") // Appliances #ADD_COMPONENT_BY_GUID_TO_ROOT ("{B3509B99-F1E4-11D2-85F6-004005365450}") // EBOOT.BIN #ADD_COMPONENT_BY_GUID_TO_ROOT ("{B4569ABC-F1E4-11D2-85F6-123405365450}") // *** CoreOS-specific components *** // *** MAXALL *** #IF ("COREOS","MAXALL") // pc_ddk -#ADD_COMPONENT_BY_GUID_TO_ROOT ("{B3509B75-F1E4-11D2-85F6-004005365450}") // ddi_flat "-#ADD_COMPONENT_BY_GUID_TO_ROOT ("{E2B049C8-F7DC-45d3-8204-0AA54FB4D4CC}") // wavedev -#ADD_COMPONENT_BY_GUID_TO_ROOT ("{35E7043C-EEA9-11D2-A092-0060085C1833}") // serial -#ADD_COMPONENT_BY_GUID_TO_ROOT ("{35E70441-EEA9-11D2-A092-0060085C1833}") #ENDIF // *** MINKERN *** #IF ("COREOS","MINKERN") // pc_ddk -#ADD_COMPONENT_BY_GUID_TO_ROOT ("{B3509B75-F1E4-11D2-85F6-004005365450}") #ENDIF // *** IESAMPLE *** #IF ("COREOS","IESAMPLE") // pc_ddk -#ADD_COMPONENT_BY_GUID_TO_ROOT ("{B3509B75-F1E4-11D2-85F6-004005365450}") // ddi_flat -#ADD_COMPONENT_BY_GUID_TO_ROOT ("{E2B049C8-F7DC-45d3-8204-0AA54FB4D4CC}") // serial -#ADD_COMPONENT_BY_GUID_TO_ROOT ("{35E70441-EEA9-11D2-A092-0060085C1833}") #ENDIF // *** MINSHELL *** #IF ("COREOS","MINSHELL") // pc_ddk -#ADD_COMPONENT_BY_GUID_TO_ROOT ("{B3509B75-F1E4-11D2-85F6-004005365450}") // ddi_flat -#ADD_COMPONENT_BY_GUID_TO_ROOT ("{E2B049C8-F7DC-45d3-8204-0AA54FB4D4CC}") // serial -#ADD_COMPONENT_BY_GUID_TO_ROOT ("{35E70441-EEA9-11D2-A092-0060085C1833}") // wavedev -#ADD_COMPONENT_BY_GUID_TO_ROOT ("{35E7043C-EEA9-11D2-A092-0060085C1833}") #ENDIF // *** MINWMGR *** #IF ("COREOS","MINWMGR") // pc_ddk "-#ADD_COMPONENT_BY_GUID_TO_ROOT ("{B3509B75-F1E4-11D2-85F6-004005365450}") // ddi_flat -#ADD_COMPONENT_BY_GUID_TO_ROOT ("{E2B049C8-F7DC-45d3-8204-0AA54FB4D4CC}") // wavedev -#ADD_COMPONENT_BY_GUID_TO_ROOT ("{35E7043C-EEA9-11D2-A092-0060085C1833}") // serial -#ADD_COMPONENT_BY_GUID_TO_ROOT ("{35E70441-EEA9-11D2-A092-0060085C1833}") #ENDIF // *** MINGDI *** #IF ("COREOS","MINGDI") // pc_ddk -#ADD_COMPONENT_BY_GUID_TO_ROOT ("{B3509B75-F1E4-11D2-85F6-004005365450}") // ddi_flat -#ADD_COMPONENT_BY_GUID_TO_ROOT ("{E2B049C8-F7DC-45d3-8204-0AA54FB4D4CC}") // wavedev -#ADD_COMPONENT_BY_GUID_TO_ROOT ("{35E7043C-EEA9-11D2-A092-0060085C1833}") #ENDIF // *** MINCOMM *** #IF ("COREOS","MINCOMM") // pc_ddk -#ADD_COMPONENT_BY_GUID_TO_ROOT ("{B3509B75-F1E4-11D2-85F6-004005365450}") // serial -#ADD_COMPONENT_BY_GUID_TO_ROOT ("{35E70441-EEA9-11D2-A092-0060085C1833}") #ENDIF // *** MININPUT *** #IF ("COREOS","MININPUT") // pc_ddk -#ADD_COMPONENT_BY_GUID_TO_ROOT ("{B3509B75-F1E4-11D2-85F6-004005365450}") #ENDIF // end of appliances.bsp file
We are now done creating a new BSP. The next time the WCE Platform Wizard is run, Appliances will appear as a choice in the Select BSP list box (Figure 3.20). Platform Builder filters the BSPs you can choose on the basis of the CPU you have chosen in the preceding dialog box. Since the Appliances BSP is valid only for x86, this CPU must be checked.