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

Exporting a Catalog Item from the Catalog

Some catalog items do not support direct cloning. To clone these components, you must create either a new catalog file, if you are creating a new entry under the 3rdParty folder, or a new entry in a BSP's existing catalog file. In any case, you should verify that the original values for all SYSGEN and additional environment variables are preserved. Do not forget to change the ID, because each item in the catalog must have a unique ID, as mentioned earlier in this lesson.

Catalog Component Dependencies

The catalog in Platform Builder for Windows Embedded CE 6.0 R2 supports component dependencies. To specify that a component is dependent on another component, you must set the SYSGEN or Additional Variables field for the component of the catalog item, and then include this value in the form of an additional environment variable in the dependent component. For example, if you have catalog components in your BSP for both a display driver and a backlight driver for the display, you can set the Additional Variables field for the display driver to BSP_DISPLAY and the Additional Variables field for the backlight driver to BSP_BACKLIGHT. If you now want the display driver to be dependent on the backlight driver, you can edit the catalog entry for BSP_DISPLAY in the Catalog Editor and add BSP_BACKLIGHT to the additional environment variables. Then, whenever you include the display driver in an OS design, Platform Builder automatically includes the backlight driver as well. The Catalog Items View will show the check box of the backlight driver with a green square to indicate that this component is included as a dependency of the display driver.

Lesson Summary

Platform Builder for Windows Embedded CE 6.0 R2 comes with a file-based catalog system that you can use to contain your own catalog items by including them in separate catalog files in the Platform or 3rdParty directory within the %_WINCEROOT% directory tree. The file format of catalog files is XML and the file-name extension is .pbcxml. Platform Builder automatically enumerates the .pbcxml files when you start Visual Studio or refresh the Catalog Items View in Solution Explorer. To add a new catalog item to the Windows Embedded CE catalog, you can start with a new catalog file or create a copy of an existing catalog item and then edit the file content by using the Catalog Editor. There is no need to edit .pbcxml files by using a text editor, such as Notepad, because all settings are available directly within Platform Builder. Among other things, you can specify SYSGEN and additional environment variables for conditional C/C++ build directives, registry modifications, and dependency definitions.

Lesson 5: Generating a Software Development Kit

Developers who want to create applications for a target device require a Software Development Kit (SDK). An SDK will automatically correspond to your OS design so that the developers can only use those features that are actually available. The SDK includes features that are present in the OS design so that application developers do not accidentally create code that fails to run at run time due to an unsupported API.

After this lesson, you will be able to:

■ Identify the purpose of an SDK.

■ Generate an SDK.

■ Localize SDK files on your hard drive.

■ Use an SDK.

Estimated lesson time: 20 minutes.

Software Development Kit Overview

In order to compile and create valid applications for your OS design, developers need to include the necessary header files and link to the correct libraries in their development projects. You must ensure that the SDK for your OS design contains all required header files and libraries, including headers and libraries for any custom components you want to provide to application developers. Platform Builder for Windows Embedded CE 6.0 R2 enables you to create SDKs for your OS designs by exporting all the required header files and libraries.

SDK Generation

It is generally the task of the OS design creator to generate and distribute customized SDKs. Platform Builder provides an SDK export feature for this purpose. The SDK export feature creates the customized SDK for your OS design, along with a .msi file that includes the SDK Setup Wizard.

Configuring and Generating an SDK

To create and configure an SDK by using the SDK export feature of Platform Builder, follow these steps:

1. Configure your OS design and build it at least once in the Release configuration.

2. Display Solution Explorer, right-click SDKs, and select Add New to display the SDK Property Pages dialog box.

3. In the SDK Property Pages dialog box, configure the Install properties of the SDK and define the MSI Folder Path, MSI File Name, and Locale, as illustrated in Figure 1-7. You can also specify a number of custom settings.

4. To include additional files, select the Additional Folders node in the SDK Property Pages dialog box.

5. Click OK.

Figure 1-7 SDK Property Pages dialog box

Adding New Files to an SDK

You can add files to an SDK manually by either using the Additional Folders option in the SDK property pages or by copying them into the SDK directory for your OS design, typically in %_WINCEROOT%\OSDesigns\<Solution Name>\<OS Design Name>\WinCE600\<Platform Name>\SDK. It is also possible to automate that process by using .bat and sources files, so that the build engine copies the latest version of the files into the SDK each time you perform a build.

Make sure you copy the files into the following SDK subdirectories:

■ Inc Contains the header files included in the SDK.

■ Lib\<Processor Type>\<Build Type> Contains the libraries included in the SDK.

Installing an SDK

After completing the SDK build process, you can find the .msi file in the SDK subdirectory of your OS design folder. This is typically %_WINCEROOT%\OSDesigns\<Solution Name>\<OS Design Name>\SDKs\SDK1\MSI\<SDK Name>.msi. You can freely redistribute this MSI according to your licensing agreements for Platform Builder and any third-party components included.

You can install this MSI package on any computer with Visual Studio 2005 and use it to develop Windows Embedded CE applications for your target device. On a computer with the SDK installed, you can find the files under %PROGRAMFILES%\Windows Embedded CE Tools\WCE600.

Lesson Summary

Windows Embedded CE 6.0 R2 is a componentized operating system, which implies that application developers require a customized SDK that corresponds to your OS design in order to develop applications that will work on your target device. The custom SDK should not only include the required Windows Embedded CE components, but also the headers and libraries for any custom components that you included in the OS design, to avoid problems due to missing files or libraries at build and run time. Platform Builder provides an SDK export feature to generate SDKs and to create an MSI package for convenient SDK deployment on application development computers by means of an SDK Setup Wizard.