Xem mẫu

  1. Lab: Using Platform Builder Objectives After completing this lab, you will be able to: Create a platform Localize, build and download an operating system image Boot the operating system Prerequisites Before working on this lab, you must have: Familiarity with the following terms as they are defined in the Platform Builder online Glossary: • Platform • Project • Board Support Package (BSP) • Configuration • Feature • CEPC Estimated time to complete this lab: 35 minutes
  2. 2 Lab: Using Platform Builder Exercise 1 Lab Setup This lab assumes that… 1. You selected the Emulator microprocessor when you installed Platform Builder.You installed Platform Builder in the default directory provided by the Setup program.
  3. Lab: Using Platform Builder 3 Exercise 1 Using Platform Builder with the CEPC Emulator The purpose of this exercise is to guide you through the high-level steps of creating and configuring a platform, then building an operating system Image. You will be introduced to common tasks that you will use to develop, test, and export your platform and applications. You will run the operating system image on the new hardware Emulator, familiarizing yourself with the steps of downloading an image to the Emulator for Windows CE. In this exercise you will learn how to: Create a platform Verify active configuration Modify to localize a platform Build an operating system image Set up an Emulator connection Download and boot an operating system image on the Emulator Create and build an application Run an application on the Emulator Export a Software Development Kit (SDK) Debug using an image built for the Emulator. To create a platform 1. On the development workstation, launch the Platform Builder application. 2. On the File menu, click New Platform, and then click Next. 3. From the list of available BSPs, select EMULATOR:X86, and then click Next. 4. From the list of available configurations, select Web Pad. 5. In the Platform name box, type MyPlatform as the name for your platform, and then click Next. Note where does Platform Builder creates directory for your Platform files. 6. Verify that Web Pad is selected, and click Next. 7. Review the Application & Media defaults and click Next to accept the default values. 8. Review the Networking & Communications defaults and click Next to accept the default values. 9. Click Done to manually build the image with the Platform Builder integrated development environment (IDE). Platform Builder now generates the initial platform files. Progress can be seen in the status bar at the lower right corner of the IDE. To verify active configuration 1. On the Build menu, click Set Active Configuration.
  4. 4 Lab: Using Platform Builder 2. Verify that MyPlatform EMULATOR Win32 (WCE emulator) Debug is selected. Note that this window reflects the setting shown in the drop down on the toolbar. You may also change the active configuration from this drop down. 3. Click OK. To localize a platform 1. On the Platform menu, click Settings. 2. Verify that in the Settings For box, EMULATOR Win32 (WCE emulator) Debug is selected. 3. On the Locale tab, from the Locales box, make sure that German (Germany) is highlighted. 4. From the Default Language drop down, select German (Germany). 5. Click OK to close the Platform Settings dialog box. To make an operating system image for the Emulator with the kernel debugger enabled 1. On the Platform menu, click Settings. 2. In the Settings For box, confirm that the MYPLATFORM - EMULATOR Win32 (WCE emulator) Debug configuration is selected. 3. On the Build Options tab, verify that Enable Kernel Debugger check box is selected, and then click OK. 4. On the Build menu, click Build Platform. Note If you are using a release of Platform Builder containing the Technology Preview of .NET, you will need to click OK to accept the EULA for using this version. You may select the box for do not display again. Watch the status bar, lower right corner, for the status monitor application. These keep track of the state of processes on your target device. The length of time that Platform Builder takes to build the image depends on the number of features that are included in the platform. In this exercise, you are building a large configuration, so the build time will be several minutes. During this time, data appears in the Build window. When the Status Monitor bar shows the Build status as Not Building, you have successfully built the operating system Image. The next step is to download operating system image to the Emulator. To set up a connection to the Emulator 1. On the Target menu, click Configure Remote Connection. 2. On the Configure Remote Connection dialog box, click the Services tab. 3. From the Download box, select Emulator – Download Transport. 4. Click the Configure button, review and use the defaults, and then click OK. 5. From the Kernel Transport box, click Emulator – KITL Transport. 6. Click the Settings Tab.
  5. Lab: Using Platform Builder 5 7. Under Download / Initialize Device, verify that the Connect to Device check box is selected, and then click OK. The Remote Services are now configured for the Emulator for Windows CE, and you are now ready to establish the connection and download the operating system Image. To download and boot an operating system image for the Emulator 1. Verify that in the IDE, in the FeatureView window, the MyPlatform platform is selected. 2. On the Target menu, click Download/Initialize. Wait until the operating system image appears in the Virtual CEPC window. This can be a lengthy process, depending on the size of the operating system image being downloaded. While the image is being loaded, there will be intermittent activity in the Debug Tab of the Output window, and the Status Monitor window will indicate that the Target Control (CESH), Target Messages (CETerm), and the Debugger are in a Waiting state. As the download proceeds, these services will change to a Running state. After the operating system image has successfully booted, the Windows CE operating system is displayed in the Virtual CEPC window. Note You can move, resize, or minimize the Virtual CEPC window, but you should only close it when instructed to do so. To create and build an application 1. In the Platform Builder, on the Target menu, click Disconnect, and then click OK. 2. On the Emulator menu of the Emulator, click Shut Down, select Turn off Emulator, and then click OK. 3. In the Platform Builder, on the File menu, click New Project or File. 4. In the New Project or File dialog box, click the Projects tab, and then verify that the WCE Application is selected. 5. In the Project Name text box, type Hello, and then click OK. 6. Select A typical "Hello World!" application, and then click Finish. 7. On the Build menu, click Build Hello.exe to build the application. When the Status Monitor window shows the Build status as Not Building, your application has been built. You will also see the following in the Build tab of the output window: Hello.exe – 0 error(s), 0 warning(s) By completing this step, you have successfully created an application. You are now ready to run that application on the emulator. To run a program on the Emulator 1. On the Target menu, click Download/Initialize.
  6. 6 Lab: Using Platform Builder The Emulator appears, and your localized operating system image executes in this window after being successfully downloaded. 2. In the Platform Builder, on the Target menu, click Run Programs. 3. In the Available Programs box, select Hello.exe, and then click Run. Hello.exe is then downloaded from the development workstation and is run on the Emulator. By completing this step, you have executed a user created application on the Emulator. You are now ready to export an SDK. To create and export an SDK for eMbedded Visual C++ 4.0 1. On the Target menu, click Disconnect, and then click OK. 2. On the Emulator menu of the Emulator, click Shut Down, and then click OK. 3. On the Platform menu, click Configure SDK, and then click Next. 4. Enter information in the required fields, and then click Next. 5. Verify both .NET Compact Framework and eMbedded Visual C++ v4.0 support is checked, and then click Next. 6. Inside the dialog window, click the link Build my SDK now. 7. Click OK to the .NET warning dialog. The Wizard displays information while the SDK is being built. 8. When the build is complete, click Done to close the Platform Export SDK Wizard. Your SDK is in \Wince400\Public\MyPlatform\SDK\Myplatform.msi. Congratulations. After successfully completing all the steps in this exercise, you have created a Windows® CE SDK for the Emulator environment.
  7. Lab: Using Platform Builder 7 Exercise 2 Debug in the Emulator The purpose of this exercise is to debug the operating system on the Emulator using the Kernel debugger. To debug the operating system on the Emulator using the kernel debugger 1. On the Target menu, click Download/Initialize. The Emulator appears, and your localized operating system image executes in this window after being successfully downloaded. 2. On the Debug menu of the IDE, click Break. 3. On the File menu, click Open. 4. Browse to Wince400\Platform\Emulator\Drivers\Kbdmouse\Emulkbms, select PS2MOUSE, and then click Open. You have opened the Ps2mouse.cpp file, which contains source code for the mouse driver. 5. On the Edit menu, click Find. 6. In the Find what box, type _move, and then click Find Next. It takes to a piece of code in the Ps2mouse.cpp file that handles a mouse move event. 7. Press the F9 key to set a breakpoint in the source code at the mouse move event. The red dot in the margin shows that the breakpoint has been set. 8. On the Debug menu, click Go. 9. From the taskbar, click MyPlatform - Emulator for Windows CE to display the MyPlatform - Emulator for Windows CE window. 10. Move the cursor over the MyPlatform - Emulator for Windows CE window. The breakpoint activates and the IDE displays. You will notice a yellow instruction point or current instruction arrow on the breakpoint symbol. 11. On the Edit menu of the IDE, click Breakpoints. 12. Click Remove All, and then click OK to remove the breakpoint that you set. 13. On the Debug menu, click Go. You have successfully halted the operating system, set and activated a breakpoint in one of the drivers, and removed the breakpoint. Follow the remaining steps to stop debugging the operating system. 14. On the Debug menu, click Stop Debugging. Control returns to the IDE. 15. On the Target menu, click Disconnect, and then click OK. 16. Close the window for the Emulator.
nguon tai.lieu . vn