二、Building a Run-Time Image for the Emulator

This tutorial takes approximately 50 minutes to complete.

In this tutorial, you complete the following procedures:

In this step, you use the New Platform Wizard to create a custom OS design.

Step 1.To create a custom OS design for the Emulator

  1. On the development workstation, launch Platform Builder.
  2. From the File menu, choose New Platform, and when the New Platform Wizard appears, choose Next.
  3. In the Name box, enter MyOSDesign as the name for your OS design.
  4. In the Path box, accept the default location, which is %_WINCEROOT%/PBWorkspaces/MyOSDesign, and then choose Next.
  5. From the list of available board support packages (BSPs) installed on your development workstation, select EMULATOR: X86 and choose Next.
  6. From the list of available OS design templates, select Enterprise Web Pad and choose Next.
  7. Accept the default selections for Applications & Media by choosing Next.
  8. Accept the default selections for Networking & Communications by choosing Next.
  9. Read the security warnings and then choose Next.
  10. Save your settings and close the New Platform Wizard by choosing Finish.

    Platform Builder creates two default configurations for your OS design:

    • A Debug configuration
    • A Release configuration

After these files are created, you can build a custom run-time image based on your OS design.

After you create an OS design, you can build a run-time image based on that OS design. In this step, you build a custom run-time image from the OS design you created in Tutorial Step 1.

For this tutorial, when you build the custom run-time image, choose a Debug configuration for your OS design. By building a run-time image based on the default Debug configuration, you can later debug your run-time image on the target device from Platform Builder.

Because the size of a run-time image based on a Debug configuration is greater than the size of a run-time image based on a Release configuration, you must also change the value of an environment variable to accommodate a larger run-time image for the purposes of this tutorial.

Step 2:To build the custom run-time image for the Emulator

  1. In the IDE, from the Build OS menu, choose Set Active Configuration.
  2. From the list of configurations, select EMULATOR: X86_Debug and choose OK.

    Platform Builder updates the list of Catalog items in your OS design.

  3. From the Platform menu, choose Settings.
  4. For Configuration, be sure EMULATOR: x86_Debug is selected.
  5. Choose the Build Options tab and verify that the following are selected:
    • Enable CE Target Control Support (SYSGEN_SHELL=1)

      Enabling CE Target Control Support for your OS design enables target control support for your OS design and enables kernel independent transport layer (KITL). For more information, see tabindex="tabindex" keywords="wce50conEnablingTargetControlService">Enabling the Target Control Service.

    • Enable Eboot Space in Memory (IMGEBOOT=1)

      Selecting this reserves space in the Config.bib file for your OS design, enabling the boot loader to save data that your OS can read at boot time.

    • Enable Full Kernel Mode (no IMGNOTALLKMODE=1)

      Enabling full kernel-mode for your OS design increases system performance in the run-time image. For more information, see tabindex="tabindex" keywords="wce50conFullKernelMode">Full-Kernel Mode

    • Enable KITL (no IMGNOKITL=1)

      Enabling full kernel-mode for your OS design increases system performance in the run-time image. For more information, see tabindex="tabindex" keywords="wce50conFullKernelMode">Full-Kernel Mode

    • Run-Time Image Can be Larger than 32 MB (IMGRAM64=1)

      Enabling the run-time image to be larger than 32 MB allows you to have larger run-time images. If your final run-time image requires more than 32 MB of space, the build process might not successfully complete.

    • Enable Kernel Debugger (no IMGNODEBUGGER=1)

      Enabling support for the kernel debugger allows you to debug the run-time image that you create based on your OS design.

  6. Save your changes and close the Platform Settings dialog box by choosing OK.
  7. From the Build OS menu, verify that the following are selected:
    • Copy Files to Release Directory after Build
    • Make Run-Time Image After Build

    By default, these are selected when you create a workspace in Platform Builder.

  8. Select EMULATOR: x86_RELEASE as the Build Configuration.
  9. Build a run-time image based on your OS design by choosing Build and Sysgen from the Build OS menu.

    For information about other build options you can choose, see tabindex="tabindex" keywords="wce50urfBuildMenuOptions">Build OS Menu Options.

    The time required by Platform Builder to build the run-time image depends on the number of Catalog items in the OS design.

    In this example, you are building a run-time image based on a large OS design that contains many items, so it can take up to 20 minutes to build the OS image.

  10. Observe the build process in Platform Builder by viewing the output on the Build tab of the Output window.

    When the build is complete, you see the following message: MyOSDesign - 0 error(s), XX warning(s).

You can now set up a connection to the Emulator and download the run-time image.

Step 3:To set up a connection to the Emulator and download the run-time image

  1. From the Target menu, choose Connectivity Options.
  2. Under Service Configuration, choose Kernel Service Map.
  3. From the Download list box, choose Emulator.
  4. Choose the associated Settings button.
  5. Be sure the settings for Display are set to 640x480x16; otherwise, the Emulator window might not appear properly on your display.
  6. In the Memory (MB) box, be sure memory is set to 64 and then choose OK.
  7. From the Transport list box, select Emulator.
  8. From the Debugger list box, be sure KdStub is selected.
  9. Under Service Configuration, choose Core Service Settings.
  10. Under Download Image, verify that Always is selected.
  11. Under KITL Settings, verify that the following check boxes are selected:
    • Enable KITL on device boot
    • Clear memory on soft reset
    • Enable access to desktop files
  12. Save your changes and close the dialog box by choosing Close.

    You can also choose tosave your changes and keep the dialog box open by choosing Apply.

    You have configured the services that allow you to connect to the Emulator.

    Now you can establish a connection to the Emulator and download the run-time image.

  13. From the Target menu, choose Attach Device.

    A window appears, displaying the progress of the download to the Emulator. Then the MyOSDesign - Emulator for Windows CE window appears.

  14. Wait until the OS appears in the MyOSDesign - Emulator for Windows CE window.

    For this tutorial, the OS appears in about a minute. The length of time required to display the OS depends on the size of the run-time image being downloaded.

    While the run-time image is being downloaded, in Platform Builder, you can see intermittent activity in the Debug tab of the Output window.

    When the OS boots successfully, the Windows CE OS appears in the MyOSDesign - Emulator for Windows CE window.

You can now debug the OS.

After you download and boot the run-time image in the Emulator, you can debug the OS.

By default, when the OS boots, Platform Builder starts the kernel debugger and displays the Debug toolbar.

To debug the run-time image, you must halt the running OS, because breakpoints cannot be set while the OS is running. You then use the kernel debugger to debug your custom OS.

Step4:To debug the OS on the Emulator using the kernel debugger

  1. From the Platform Builder Debug menu, choose Break.

    This halts the running OS on the Emulator, which does not respond to user input while in this state.

  2. From the File menu, choose Open.
  3. Browse to %_WINCEROOT%/Platform/Emulator/Src/Drivers/Kbdmouse/Emulkbms, select ps2mouse.cpp, and then choose Open.

    You have opened the Ps2mouse.cpp file, which contains source code for the mouse driver.

  4. From the Edit menu, choose Find.
  5. In the Find what box, type _move and choose Find Next.

    You jump to a section of code in the Ps2mouse.cpp file that handles a mouse move event.

  6. Set a breakpoint in the source code at the mouse move event by pressing the F9 key.

    A red dot in the margin shows that the breakpoint has been set.

  7. From the Debug menu, choose Go.
  8. In the MyOSDesign - Emulator for Windows CE window, move the cursor over the window.

    The breakpoint activates.

  9. Switch to the Platform Builder window.

    A yellow instruction point or current instruction arrow on the breakpoint symbol appears in the source code.

  10. Remove the breakpoint you set by doing one of the following:
    • From the Debug toolbar, choose Breakpoints and then choose Clear All Breakpoints.
    • In the source code, right-click the line where you set the breakpoint; then from the context menu, choose Remove Breakpoint.
    • Use the ALT+9 keyboard shortcut to access the Breakpoint List window; then choose Clear All Breakpoints.
  11. From the Debug menu, choose Go.

    You have successfully halted the OS, set and activated a breakpoint in one of the drivers, and then removed the breakpoint.

    Follow the remaining steps to stop debugging the OS.

  12. From the Debug menu, choose Stop Debugging.

    A dialog box appears, asking whether you want to stop debugging now without disabling the target-side kernel debugger component KdStub.

  13. For the purposes of this tutorial, choose Yes.

    Control returns to the IDE.

  14. From the Target menu, choose Detach Device.
  15. Shut down the Emulator by accessing the window for the Emulator; then from the Emulator menu, choose Shut Down.

    The Emulator window closes.

After you finish debugging, you can localize your run-time image.

In this step, you localize the custom Enterprise Web Pad OS design into German for the locale of Germany. Windows CE offers the ability to localize a run-time image into several languages.

Step5:To localize the OS design for the Emulator

  1. From the Platform Builder Platform menu, choose Settings.
  2. In the Configuration drop-down list, select EMULATOR: x86_Release.
  3. Choose the Locale tab.
  4. From the Default Language list, select German (Germany); then verify that the Localize the build check box is selected.
  5. Close the Platform Settings dialog box by choosing OK.
  6. From the Build OS menu, verify that the following are selected:
    • Copy Files to Release Directory After Build
    • Make Run-Time Image After Build
  7. From the Build OS menu, choose Build and Sysgen.

    The build that you have configured and selected results in a build of the changed files in your OS design. It can take up to 20 minutes to rebuild the run-time image.

    When the build process is complete, you see the following message: MyOSDesign - 0 error(s), XX warning(s).

  8. From the Target menu, choose Attach Device.

    In approximately one minute, the localized run-time image finishes downloading to the Emulator.

  9. In the MyOSDesign - Emulator for Windows CE window, verify that the icons in the displayed OS are labeled in German.
  10. From the Platform Builder Target menu, choose Detach Device and then choose OK.
  11. In the window for the Emulator, from the Emulator menu, choose Shut Down.

You have created, built, and downloaded a localized run-time image.

You can now create and build an application based on your run-time image.

In this step, you create and build a simple application using Platform Builder.

Step6:To create and build an application for the Emulator

  1. From the Platform Builder File menu, choose New Project or File.
  2. Choose the Projects tab and select WCE Application.
  3. In the Project name box, type Hello, verify that Workspace project is selected, and choose OK.
  4. In the Feature name box, for the purposes of this tutorial, name your application Hello and choose Next.

    This name is used in the Readme.txt file that Platform Builder creates, and is optional.

  5. Choose A typical "Hello World!" application and then choose Finish.
  6. In the Workspace window, select the FileView tab; then from the Projects node, select your application.
  7. From the Build Project menu, select the following:
    • Clean Before Building
    • Make Run-Time Image After Build
  8. Build the application by choosing Build Current Project from the Build Project menu.

    When the build is complete, in the Build window, you see the following message: Hello.exe - 0 error(s), 0 warning(s).

    To see this message, you might need to jump to the end of the output by pressing the CTRL and END keys simultaneously.

    You have created an application.

You can now run the application in the Emulator.

 

In this step, you run the newly created Hello.exe application in the Emulator.

By default, Hello.exe is not included in the run-time image. It is downloaded to the target device from the development workstation at run time. This allows you to further develop the application without rebuilding the run-time image after each change you make to the application.

Step7:To run the application in the Emulator on the custom run-time image

  1. From the Platform Builder Target menu, choose Attach Device.

    In approximately two minutes, your localized OS appears in the MyOSDesign - Emulator for Windows CE window.

  2. From the Target menu, choose Run Programs.
  3. In the Available Programs list, select Hello.exe and choose Run.

    The Hello.exe application downloads from the development workstation to the Emulator. The application then runs in the Emulator.

  4. In the MyOSDesign - Emulator for Windows CE window, verify that the Hello.exe application has run successfully..

    You have run a custom application on the Emulator.

  5. Shut down the Emulator so you can create and export a software development kit (SDK):
    1. From the Platform Builder Target menu, choose Detach Device.
    2. In the window for the Emulator, from the Emulator menu, choose Shut Down.

You can now create and export an SDK.

After you customize your OS design and boot and debug the run-time image, you can use Platform Builder to create, configure, and build an SDK for the run-time image.

Developers can use this SDK to create applications based on the run-time image you created.

In this step, you create an SDK for Microsoft® eMbedded Visual C++®.

Step8:To create and build an SDK for eMbedded Visual C++

  1. From the Platform Builder Platform menu, choose SDK and then choose New SDK.
  2. Technorati 标签:
  3. When the SDK Wizard appears, choose Next.
  4. In the Product name that is displayed when .msi file runs box, type MyOSDesignSDK.
  5. In the Manufacturer name box, type MyCompany, and then choose Next.
  6. Verify that the eMbedded Visual C++ 4.0 support check box is selected, and then choose Next.
  7. On the final page, choose Close this wizard and continue configuring your SDK.

    The wizard closes and the SDK Settings dialog box opens.

  8. In the SDK Settings dialog box, choose the EULA/Readme tab and select the Include custom end-user license agreement check box.
  9. In the End-user license agreement path box, enter or select the location and name of a file as a Rich Text Format (.rtf) file that you want to use as a sample custom End User License Agreement (EULA).

    The custom EULA you include is displayed in a separate dialog box when the SDK is installed.

  10. Choose the Emulation tab, and then, in the Configuration field, verify that you have selected a build configuration for your SDK.

    For this tutorial, select a Debug configuration.

    Selecting a Debug configuration might help prevent errors from occurring when you build your SDK.

  11. Apply your changes to the SDK and close the window by choosing OK.
  12. From the Platform menu, choose SDK and then choose Build SDK.

    The SDK Wizard dialog box displays information while the SDK is being built.

  13. When the build is complete, to close the dialog box, choose Done.

    Your SDK is in the MyOSDesign_SDK.msi file in the %_WINCEROOT%/PBWorkspaces/MyOSDesign/SDK directory.

You have completed this tutorial and successfully created and debugged a custom run-time image and a simple application that runs in the Emulator. You have also successfully created an SDK for your run-time image.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值