高级操作系统-WinCE6.0

合集下载

wince6.0_开发环境搭建

wince6.0_开发环境搭建

Window CE6.0开发平台搭建详解2011年08月29日Windows CE6.0的开发无非两大方面:操作系统开发和应用程序开发,操作系统开发包括系统的定制,驱动开发和其他需要完成的底层工作。

应用程序开发主要是与实际应用结合紧密的程序开发。

要搭建这样的开发环境,至少要包括两部分,一个是硬件平台,一个是软件平台,在Windows CE6.0的开发中,微软公司把这些开发软件集成到了vs2005中。

Windows CE6.0开发环境需要安装的软件比较多、比较大,至少要10GB的空间,而且有着严格的安装顺序要求,一旦其中某一个环节出错,都会导致软件运行出现故障,为确保安装顺利,请仔细阅读本文,按照步骤一步一步进行安装。

一、所需安装软件1、Visual Studio 20052、Visual Studio 2005 Service Pack 13、MSDN4、platform builder for Windows Embedded CE6.05、Windows Embedded CE 6.0 Platform Builder Service Pack 16、Windows mobile 6的sdk二、所用磁盘空间在安装之前,请检查电脑的磁盘空间,VS2005和Windows Embedded CE6.0均是比较大的软件,要占硬盘好10G多的空间,建议不要装在C盘,但是我装Windows Embedded CE6.0的时候,发现不能更改安装路径,没办法,只能把Windows Embedded CE6.0装在C盘。

三、安装顺序1.安装Visual Studio 2005最好选择自定义安装方式,把不用的一些组件都删掉,这样会节省不少的磁盘空间。

WINCE6.0的Platform Builder不像WINCE5.0是独立的,而是作为VS2005的插件,以后建立和定制OS、编译调试全部在VS2005里完成。

wince6.0操作手册

wince6.0操作手册

Section 0 – 1:Clone a BSPCreate, Build, and Run a New OS DesignLearning ObjectivesCreate an OS Design using Visual StudioIdentify the catalog features included in the designExtend the standard design by adding catalog itemsBuild configuration for the run-time image and build a run-time imageRun the OS image on the target deviceEstimated time to complete this lab:45 minutesExercise 1: Clone BSPIn this exercise, you will use the Clone BSP tool in Visual Studio 2005 to create a copy of the existing Device Emulator Board Support Package (BSP). We can modify this copy instead of modifying the original that was delivered as a part of the Windows Embedded CE 6.0 tools. Clone the DeviceEmulator BSP1. Launch Microsoft Visual Studio 2005.Note If this is the first time Visual Studio is launched after installation the Choose Default Environment Setting dialog will be displayed. For the purposed of this course select Platform Builder Development Settings and select Start Visual Studio.2. Select the Tools | Platform Builder for CE6.0 | Clone BSP from the menu in VisualStudio to bring up the Clone BSP dialog box.3. In the Clone BSP dialog, drop down the Source Board Support Package and selectDevice Emulator: ARMV4I BSP for clone.Note If you are working with a hardware reference platform, select the BSP corresponding to your specific hardware.4. Type TrainingBSP in the Name field in the New Board Support Package Info area.5. Type a description for your new BSP in the Description field.6. Type TrainingBSP in the Platform Directory field.7. Type GeneriCo in the Vendor field.8. Type 1.0 in the Version field.9. Click the Clone Button. The Clone BSP tool will create a new Board Support Packagebased on the DeviceEmulator Board Support Package.10. Acknowledge the Clone BSP success message by selecting OK.11. Open the C:\WINCE600\PLATFORM\TrainingBSP\FILES folder using WindowsExplorer.Note The labs in this course refer to the default installation path for OS Build Tree, which is “C:\WINCE600”. If your path is something other than the default you will need to make theadjustment anytime the path is noted.12. Rename the deviceemulator-preri.bat file to trainingbsp-preri.bat.Note The previous step was necessary due to a bug in the Clone BSP tool. It is only necessary if the source BSP contains certain build related batch files in the FILES directory. This is notcommon, but is the case with the DeviceEmulator BSP. Failure to make the change will causea build error in a later step.The DeviceEmulator Board Support Package has now been cloned into a new Board Support Package called TrainingBSP. The TrainingBSP Board Support Package will be used in the remaining labs.Exercise 2: Create, build and run the OS designIn this exercise you will create an OS design, and then customize that design by adding components from the catalog and build the result. You will run the OS design on the Device Emulator.This OS design will be used in other labs and will be a suitable platform for running a variety of Windows CE applications.You will learn how to:Create an OS DesignSet up the build configuration for your OS run-time imageBuild an OS run-time imageRun the OS Design on the Device EmulatorCreate an OS design1. Select File | New | Project… from the Visual Studio menu.2. Select the Platform Builder for CE 6.0 project type in the New Projectdialog.3. Select OS Design under Visual Studio installed templates.4. Type TrainingOSDesign in the Name field. The solution name willdefault to TrainingOSDesign as well.5. Click OK. Visual Studio will launch the Windows Embedded CE6.0 OS Design Wizard.6. Click Next.7. In the list of available BSPs, select TrainingBSP: ARMV4I and click Next.8. From the list of available design templates, select PDA Device and clickNext.9. From the list of available design variants, select Mobile Handheld andclick Next. The Applications & Media configuration window willappear.10. Deselect .NET Compact Framework 2.0 and ActiveSync and clickNext. The Networking & Communications configuration window willappear.11. Deselect TCP/IPv6 Support.12. Deselect Personal Area Network (PAN). This will deselect Bluetoothand IrDA.13. Click Next, and then Finish to complete the Windows Embedded CE6.0 Design Wizard.Note The wizard creates the initial configuration for your OS design. We will have the opportunity to make further changes to the OS design after completing the wizard.14. Click Acknowledge on the Catalog Item Notification dialog.On completion, Visual Studio will display your OS design project. The SolutionExplorer tab should be active and show your new TrainingOSDesign project inyour TrainingOSDesign Solution.Inspect the OS Catalog15. Click on the Catalog Items View tab to display the Catalog.16. Click on the Filter drop down box in the upper left hand corner of theCatalog Items View. Observe the different filtering options. The filtercontrols the items that are displayed in the catalog. Ensure that AllCatalog Items in Catalog is selected.17. Observe the selection boxes and icons in the catalog by expanding thenodes. Selection boxes with a green check mark indicate an item thatwas specifically selected as a part of the OS design. Selection boxeswith a green square indicate an item that was brought in to the OSdesign as a dependency. Selection boxes that are not marked indicateitems that are not included in the OS design but are available to beadded.18. Locate a catalog item with a green square in its checkbox.19. Right click on the catalog item and choose Reasons for Inclusion ofItem. The Remove Dependent Catalog Item dialog box displays thecatalog items you selected that caused this catalog item to automatically be included in the OS design.20. Close the Remove Dependent Catalog Item dialog box.21. Expand the Core OS | CEBASE | Applications – End User | Active Syncnode in the catalog.22. Right click on either of the ActiveSync system cpl items (or double click)and select Display in Solution View. The view will change to theSolution Explorer tab. The subproject containing the ActiveSynccomponent is displayed.This is a great way to navigate the source code that is available as partof Windows Embedded CE 6.0.Add support for Internet Explorer 6.0 Sample Browser catalog item23. Select the Catalog Items View tab to display the OS design catalog.Note If the filtering option was not set to All Catalog Items in Catalog, you would not see catalog items that were not already included in the OS design.24. Enter the text Internet Explorer 6.0 Sample into the search text box tothe right of the filter button. Press Enter or click the green arrow. Thepath Core OS | CEBASE | Internet Client Services | Browser Application| Internet Explorer 6.0 for Windows Embedded CE – StandardComponents should be expanded.Note Depending on where you are currently located in the catalog, you may have to restart the search from the top.25. Select, to check, the Internet Explorer 6.0 Sample Browser catalogitem.Add support for managed code development to your OS design26. Enter the text ipconfig into the Search box and press Enter. TheNetwork Utilities (IpConfig, Ping, Route) will be highlighted.Note Again, depending on node selected when starting a search in the catalog, you may have to restart the search from the top.27. Add the Network Utilities to your design by selecting the component.28. Enter the text wceload into the Search box and press Enter. The CABFile Installer/Uninstaller component will be highlighted. This is due tothe fact that the SYSGEN name for the component is “wceload”.29. Add the Cab File Installer/Uninstaller utility to your OS design.30. Enter the text sysgen_dotnetv2_support into the Search box andpress Enter. The OS Dependencies for .NET Compact Framework2.0 component will be highlighted.31. Add the OS Dependencies for .NET Compact Framework 2.0 to yourOS design.Note There are two separate components in this category. Be sure you select the one that does NOT have the – Headless modifier in its description.Build the OS run-time image32. Select Build | Configuration Manager… from the Visual Studio menuto bring up the Configuration Manager dialog box.33. Select TrainingBSP ARMV4I Debug from the Active solutionconfiguration drop down box and then close the dialog box.34. Select the Solution Explorer view by selecting the Solution Explorertab.35. In the Solution Explorer window, right click on theTrainingOSDesign project (not the Solution node) and chooseProperties. This will launch the Property Pages dialog for your OSdesign.36. Expand the Configuration Properties tree and click on the BuildOptions node.37. Ensure the following build options are set:Enable eboot space in memoryEnable kernel debuggerEnable KITLEnable profiling38. Select OK39. Select Build | Build TrainingOSDesign from the Visual Studio menu.Note This will take several minutes to complete depending on the capabilities of your development system. The following steps for configuring connectivity may be accomplished while building.Configure connectivity options40. Select Target | Connectivity Options… from the Visual Studio menu.The Target Device Connectivity Options dialog will appear showingthe Kernel Service Map configuration for the CE Device namedconnection.41. Select Device Emulator (DMA) from the Download drop down box.42. Select Device Emulator (DMA) from the Transport drop down box.43. Select KdStub from the Debugger drop down box.Change the emulator configurationThe emulator has a number of configurable options. We will modify it to use a larger screen resolution and to enable network communications.44. Next to the Download drop down menu click Settings.45. Select the Display tab in the Emulator Properties dialog box.46. Change the Screen width to 640 pixels and the Screen height to 480pixels.47. Select the Network tab in the Emulator Properties dialog box.48. Check the box beside Enable NE2000…49. Click on OK50. Select Apply to save the new device configuration.51. Select Close to close the dialog box.Note The build must complete before moving on to the next step.Test your OS run time image on the Device Emulator52. Select Target | Attach Device from the Visual Studio menu.Visual Studio will start the Device Emulator with your OS run time image design. The download will take a short time to complete. You will be able to interact with the emulator and test the features of your new OS design. Congratulations, you have successfully built and run your first Windows Embedded CE 6.0 OS design!If you are continuing with the next Hands-On Lab, keep your emulator image running.Section 0 – 2:Static and Dynamic LibrariesObjectivesCreate simple static libraryLink the static library with a dynamic libraryLink the dynamic library with an executableEstimated time to complete this lab:45 minutesExercise 1: Create a static library (LIB)In this exercise you will create a static library with routines that you will later link to when you build a dynamic library and an executable.Note This exercise involves a bit of typing; if you perfer you may copy the text from the Student files. Create a static library subproject1. Select Project | Add New Subproject… from the Visual Studio menu.This will bring up the Windows CE Subproject Wizard.2. Select the WCE Static Library template.3. Set the Subproject name to Power_Status and click Next.4. Check the Precompiled header box.5. Click Finish.6. Configure the Power_Status subproject to be excluded from theimage and always build and link as debug. (In Solution ExplorerView, right click the TrainingOSDesign and select the Properties)Create files7. Right click on the Power_Status subproject in the Solution Explorerand select Add | New Item…8. Select the Code category, the C++ File (.cpp) template, and then typePower_ON_OFF in the name field.9. Click on Add to add the new file.10. Right click on the Power_Status subproject in the Solution Explorerand select Add | New Item…11. Select the Code category, the Header File (.h) template, and thentype Power_Status in the name field.12. Click on Add to add the new file.13. Using the Solution Explorer, locate the Power_ON_OFF.cpp file in thePower_Status subproject and open it.14. Add the following code to the Power_ON_OFF.cpp file:#include"stdafx.h"LPCTSTR g_StrOn = L"Power is on";LPCTSTR g_StrOff = L"Power is off";LPCTSTR PowerOn(){return g_StrOn;}LPCTSTR PowerOff(){return g_StrOff;}15. Save and close Power_ON_OFF.cpp.16. Expand the Include files node in the Power_Status subproject andopen stdafx.h17. Add an include for <windows.h> as follows:// TODO: reference additional headers your program requires here#include<windows.h>18. Save and close stdafx.h.19. Using the Solution Explorer, locate the Power_Status.h file in thePower_Status subproject and open it.20. Add the following to Power_Status.h:extern LPCTSTR PowerOff(void);extern LPCTSTR PowerOn(void);21. Save and close Power_Status.h.Build the library22. Right click the Power_Status subproject in the Solution Explorer andselect Build.Exercise 2 Create a dynamic library (DLL)In this exercise you will create a dynamic library that will link with the static library you created previously.Note This exercise involves a bit of typing; if you perfer you may copy the text from the Student files.Create the dynamic library subproject1. Select Project | Add New Subproject… from the Visual Studio menu.2. Select the WCE Dynamic-Link Library template.3. Set the Subproject name to ScanBarcode and click Next.4. Select A simple Windows Embedded CE DLL subproject and clickFinish.5. Configure the ScanBarcode subproject to be excluded from theimage and always build and link as debug.Edit source files for DLL project6. In the Solution Explorer, right-click on the ScanBarcode subproject,and then select Add | New Item…7. Select the Code category, the Header File (.h) template, and then typeScanBarcode in the name field.8. Using the Solution Explorer, open the ScanBarcode.h file from theScanBarcode subproject.9. Add the following code to the ScanBarcode.h file:#include<windows.h>EXTERN_C LPCTSTR ScanBarcode(void);EXTERN_C LPCTSTR ScanPowerOff(void);EXTERN_C LPCTSTR ScanPowerOn(void);10. Using the Solution Explorer, open the ScanBarcode.def file from theParameter files node in the ScanBarcode subproject.11. Add the following to the DEF file:LIBRARY ScanBarcodeEXPORTSScanPowerOffScanPowerOnScanBarcode12. Save and close ScanBarcode.def.13. Using the Solution Explorer, open the ScanBarcode.cpp file from theScanBarcode subproject.14. Add an include statement for Power_Status.h as follows:// ScanBarcode.cpp : Defines the entry point for the DLL application.//#include"stdafx.h"#include"Power_Status.h"BOOL APIENTRY DllMain( HANDLE hModule,DWORD ul_reason_for_call,LPVOID lpReserved){return TRUE;}15. Add the following code snippet to ScanBarcode.cpp after the inclusionof Power_Status.h.LPCTSTR g_StrScan = L"123456789ABC";EXTERN_C LPCTSTR ScanBarcode(void){return g_StrScan;}EXTERN_C LPCTSTR ScanPowerOn(void){return PowerOn();}EXTERN_C LPCTSTR ScanPowerOff(void){return PowerOff();}16. Save and close ScanBarcode.cpp.Link to static library17. Right click on the ScanBarcode subproject node in the SolutionExplorer, and then select Open. The ScanBarcode SOURCES filwill open.18. Locate the section of the file containing TARGETLIBS.19. Add a reference to the Power_Status.lib static library by modifying thissection as follows:TARGETLIBS= \$(_PROJECTROOT)\cesysgen\sdk\lib\$(_CPUINDPATH)\coredll.lib \$(PBWORKSPACEROOT)\Power_Status\obj\$(_CPUINDPATH)\Power_Status.lib \Note The trailing backslash characters on each line are line continuation characters. Ensure that there is no white space after them. Also, ensure that there is a blank line following the last line.20. Add the path to directory containing the Power_Status.h header file byadding the following to the bottom of the SOURCES file:INCLUDES= \$(PBWORKSPACEROOT)\Power_Status \Note Ensure that there is at least one blank line prior to the line containing the INCLUDES directive.This ensures that there are no line continuation characters prior to this statement that are still in effect.21. Save and close the SOURCES file.22. Right click on the ScanBarcode subproject in the Solution Explorerand select Properties.23. Select the C/C++ tab and observe the Include Directories entry.Notice that the directory you just added with the INCLUDES directivein the SOURCES file is listed here.24. Select the Link tab and observe the Additional Libraries entry.Notice that the library you just added with the TARGETLIBS directivein the SOURCES file is listed at the end of this line.Note The SOURCES file itself controls the build rules for the subproject. The graphical user interface shown here provides an alternate way to view and modify this file.25. Select Cancel to close this dialog without making any changes.Build the library26. Right click the ScanBarcode subproject in the Solution Explorer andselect Build.Exercise 3 Create an executable (EXE)In this exercise you will create an executable that uses functionality from the dynamic library you just created.Adding existing application subproject1. Copy the BarcodeDllTest subproject from the Student files to your OSdesign atC:\WINCE600\OSDesigns\TrainingOSDesign\TrainingOSDesign.2. Right click on the Subprojects node in the Solution Explorer and selectAdd Existing Subproject.3. Select the BarcodeDllTest.pbpxml file from the BarcodeDllTestfolder.4. Configure the BarcodeDllTest subproject to be excluded from theimage and always build and link as debug.Add reference to dll5. Right click on the BarcodeDllTest subproject in the Solution Explorerand select Open.6. Add the following to the bottom of the file:INCLUDES= \$(PBWORKSPACEROOT)\ScanBarcode \Note Ensure that there is a blank line preceding the INCLUDES directive. Ensure there is no whitespace after the trailing backslashes.7. Locate the TARGETLIBS directive and add a reference toScanBarcode.lib as follows:TARGETLIBS= \$(_PROJECTROOT)\cesysgen\sdk\lib\$(_CPUINDPATH)\coredll.lib \$(PBWORKSPACEROOT)\ScanBarcode\obj\$(_CPUINDPATH)\ScanBarcode.lib \Note Ensure that there is a blank line after the line containing ScanBarcode.lib. Ensure there is no white space after the trailing backslashes.8. Save and close the sources file.9. Right click on the BarcodeDllTest subproject and select Build.Run the BarcodeDllTest application10. Launch BarcodeDllTest.exe using Target | Run Programs from theVisual Studio menu.11. The BarcodeDllTest.exe application will present the following userinterface. You can exercise it by clicking on the various buttons.This simple application makes calls into the linked Scanbarcode.dll dynamic library, which includes functionality from the Power_Status.lib static library. You may wish to set breakpoints on functions in these modules and view the call stacks to see how they are eventually called from the application.Section 1:Integrating a Device DriverEstimated time to complete this lab: 30 minutesExercise 1: Integrate barcode scanner driver into BSPThe purpose of this exercise is to integrate a driver into the BSP. In this exercise you will Add the driver subdirectory containing the driver source code to the BSPAdd the appropriate bib entry to cause the driver to be included in the OS image Add the appropriate registry entries to cause the drive to be loaded at bootUpdate the BSP catalog file to support the new driverBuild a debug OS run-time image that we will use in future labsAdd driver source code to BSP directory1. Detach from the Emulator if connected.2. Copy the BARCODE directory from Student files to theC:\WINCE600\PLATFORM\TrainingBSP\SRC\DRIVERS directory.3. Double click the C:\WINCE600\PLATFORM\TrainingBSP\src\driversnode in the Solution Explorer. This will open the Dirs file.4. Add the following line to the end of the Dirs file directly after the# @CESYSGEN ENDIF CE_MODULES_DEVICE line:barcode \5. Save and close the Dirs file.Add Driver to image6. Open the platform.bib file in the Parameter Files node of theTrainingBSP in the Solution Explorer.7. Add the following lines near the top of platform.bib as the first entryin the MODULES section.IF BSP_BARCODEbarcode.dll $(_FLATRELEASEDIR)\barcode.dll NK SHK ENDIFWhen you are done, the top of the file should look similar to the following:;; Copyright (c) Microsoft Corporation. All rights reserved.;;; Use of this source code is subject to the terms of the Microsoft end-user; license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.; If you did not accept the terms of the EULA, you are not authorized to use; this source code. For a copy of the EULA, please see the LICENSE.RTF on your; install media.;MODULES; Name Path Memory Type; -------------- ---------------------------------- -----------IF BSP_BARCODEbarcode.dll $(_FLATRELEASEDIR)\barcode.dll NK SHKENDIF; @CESYSGEN IF CE_MODULES_DISPLAYIF BSP_NODISPLAY !TrainingBSP_lcd.dll $(_FLATRELEASEDIR)\TrainingBSP_lcd.dll NK SHK; @CESYSGEN IF SHELLW_MODULES_GX; @XIPREGION IF MISC_TRAININGBSP_BIB8. Save and close the file.Add registry settings9. Open the file Platform.reg from the Parameter Files node of theTrainingBSP using the Solution Explorer.10. Right click on the [HKEY_LOCAL_MACHINE\Drivers\BuiltIn] keyand add a new key with the name Barcode.11. Add a String Value to the Barcode key with the name Dll and valueBarcode.dll.12. Add a String Value to the Barcode key with the name Prefix andvalue BAR.13. Save and close the file.Add driver to the catalog14. From the Visual Studio menu, select File | Open | File … and navigateto the C:\WINCE600\PLATFORM\TrainingBSP\CATALOG folder.15. Change the file mask to show Files of type: All Files (*.*)16. Open the TrainingBSP.pbcxml file.Note If no nodes are visible underneath Catalog in the Catalog Editor, click the Show All Catalog Files button.17. Expand the catalog tree to show the Device Drivers node.18. Right click on the Device Drivers node and select Add Catalog Item.The new item will be placed in the Third Party node.19. Set the Description field to Barcode Scanner.20. Set the Title field to Barcode Scanner.21. Set the Unique Id field to Item:GeneriCo:BarcodeScanner.22. Set the Additional Variables field to BSP_BARCODE.23. Set the Modules field to barcode.dll.24. Save and close the file.Add barcode scanner driver to image25. Switch to the Catalog Items View.26. Expand the TrainingBSP node under Third Party.Note Ensure that the Filter option is set to All Items in the Catalog. The Filter option is a drop down box in the upper right hand corner of the Catalog Items View.27. Select the Barcode Scanner item under Device Drivers. Refresh theCatalog View if necessary to see the Barcode Scanner.28. Select Build | Advanced Build Commands | Build Current BSPand Subprojects from the Visual Studio menu.Verify integration using Image Viewer29. Open the NK.bin file located in the flat release directory using VisualStudio. This will bring up the Run-Time Image Viewer.30. Click on the (All Files) node in the Image Explorer. This shows allfiles that are built into the OS run time image.31. Verify that barcode.dll is listed.32. Verify that the [HKLM\Drivers\BuiltIn\Barcode] key exists under theregistry node.33. Close the Image Viewer.Build debug OS image34. Select Build | Configuration Manager… using the Visual Studiomenu.35. Set the Active solution configuration to TrainingBSP ARMV4IDebug.36. Select Build | Build Solution using the Visual Studio menu. This willbuild a debug configuration that we will use in future labs.Section 2:Debugging the Scanner Device Driver ObjectivesUnderstand driver interaction with applicationUse kernel debugger to investigate call stackEstimated time to complete this lab: 30 minutesExercise 1 Application and Driver IntegrationIn this exercise you will add an application that communicates with the barcode scanner device driver. You will exercise the functionality of the driver and function call tree that results when the application calls into the driver.Add BarcodeTest1 application subproject to your OSDesign1. Copy the BarcodeTest1 folder from your Student files toC:\WINCE600\OSDesigns\TrainingOSDesign\TrainingOSDesign.2. Right click on the Subprojects node in the Solution Explorer and selectAdd Existing Subproject...3. Add the BarcodeTest1 subproject to your OS design.4. Configure the BarcodeTest1 subproject to be excluded from theimage and always build and link as debug.5. Right click on the BarcodeTest1 subproject in the Solution Explorerand select Build.Run test application on OS image6. Attach the emulator by selecting Target | Attach Device from the VisualStudio menu.Note This lab uses an updated version of the OS run time image. You will need to first detach from the existing emulator instance if it is still running.7. Open the BarcodeTest1.cpp file in the BarcodeTest1 subproject usingthe Solution Explorer.8. Set a breakpoint on the call to DeviceIoControl().9. Run the BarcodeTest1 application using Target | Run Programs…from the Visual Studio menu. The debugger will halt execution at thebreakpoint.10. Select Debug | Windows | Call Stack from the Visual Studio menu toshow the call stack. This window shows the sequence of calls thatresulted in the statement containing the breakpoint. You can doubleclick any of the calling functions to view the source code file containingeach function.Note The source code for the functions listed in this window is only available if you have installed the Shared Source. Only the disassembly view is available if the source code is not installed.11. Step through the application by pressing F10 through completion.Add additional functionality to test application and retest12. Locate the comment //Turn on power and add the following functioncall:Code:// Turn on powerDeviceIoControl(hBARPort, BARCODE_IOCTL_POWER_ON, NULL, 0, NULL,0, &dwNumBytesRead, NULL);13. Locate the comment //Check to make sure power is on and add thefollowing function call:Code:// Check to make sure power is onDeviceIoControl(hBARPort, BARCODE_IOCTL_QUERY_POWER_STATE,NULL,0, &dwResult, sizeof(DWORD), &dwNumBytesRead, NULL);_tprintf(_T("Power Status = %d.\n"),dwResult);14. Right click on the BarcodeTest1 subproject and select Build.15. Run the BarcodeTest1 application using Target | Run Programs…from the Visual Studio menu. The debugger will halt execution at thebreakpoint.16. Press F517. Observe debug messages in the Output window similar to thefollowing:Test BAR1: driver open/close.Barcode.DLL: +BAR_OpenBarcode.DLL: -BAR_OpenCreateFile returned a valid handle.Barcode.DLL: +BAR_IOControlBarcode.DLL: IOCTL - Set Power ManagementBarcode.DLL: -BAR_IOControl。

Wince6.0安装指南

Wince6.0安装指南

实验四搭建WinCE 6.0 开发环境一.课时安排:4学时二.实验目的通过本实验掌握Windows CE 6.0 开发环境Platform Builder 的安装。

三.实验设备(1)硬件:PC机一台(2)软件Visual Studio 2005Windows CE 6.0安装软件四.实验内容安装VS2005安装MSDN(可选)安装Windows CE 6.0(Platform Builder for Windows CE 6.0)安装Windows CE 6.0 R2安装Windows CE 6.0 R3五.实验原理在Windows CE 6.0 之前,Windows CE 的开发环境都是当做一个独立的软件进行安装,安装成功之后用户可以看到一个名为Platform Builder for CE4.2/5.0 的工具,用户就直接使用这个IDE 来定制OS。

这种情况到Windows CE6.0 后做了较大改变,在安装Windows CE 6.0 之前必须安装VS2005,在顺利安装完VS2005 以及Windows CE 6.0 后,可看到对应的开发工具PlatformBuilder for Windows CE 6.0 当做一个插件集成到VS2005 的开发环境中。

本设备用到的Windows CE 6.0 R3 其实是Windows CE 6.0 的最新版本,这之前的版本号是Windows CE 6.0 R2。

通过以上知识点的了解就可以明白接下来安装开发环境各步骤先后顺序的关系。

六.实验步骤1.开发应用程序需安装软件及更新(软件列表见“WinCE 6.0下载列表”)Visual Studio 2005Visual Studio 2005 SP12.开发Windows Embedded CE 6.0操作系统需依次安装软件及更新开发WinCE 6.0系统,除按上面次序安装VS2005外,还需要按次序安装以下软件及补丁,由于安装路径对程序开发有一定的影响,为保持统一,减少不必要的麻烦,本文假定所有安装都是按照默认路径。

wince 6.0

wince 6.0
在家中: Windows Embedded CE 6.0充分利用了多媒体技术,以开发网络媒体设备、数字视频录像机和IP机顶盒等。
微软还将Visual Studio 2005专业版作为Windows Embedded CE 6.0的一部分一并推出。这对微软来说又是一次史无前例的突破。Visual Studio 2005专业版将包括一个被称为Platform Builder的功能强大的插件,它是一个专门为嵌入式平台提供的“集成开发环境”。这个集成开发环境使得整个开发链融为一体,并提供了一个从设备到应用都易于使用的工具,极大地加速了设备开发的上市。 Windows Embedded CE 6.0重新设计的内核具有32,000个处理器的并发处理能力,每个处理有2GB虚拟内存寻址空间,同时还能保持系统的实时响应。这使得开发人员可以将大量强大的应用程序融入到更智能化、更复杂的设备中。无论在路上、在工作还是在家里,都可以使用这种设备。
在路上: Windows Embedded CE 6.0加入了新的单元核心数据和语音组件,这使得设备能够通过蜂窝通讯网络建立数据连接和语音通话,从而实现机器对机器的通讯应用场景,并构建相应的设备,如停车表、自动售货机和GPS设备等。
在工作上: Windows E源自bedded CE 6.0包含的组件更便于开发者创建通过Windows Vista内置功能无线连接到远程桌面共享体验的投影仪。
在Windows Embedded诞生十周年之际,微软将首次在“共享源计划(Microsoft Shared Source programme)”中100%毫无保留地开放Windows Embedded CE 6.0内核,(GUI图形用户界面不开放)比Windows Embedded CE的先前版本的开放比例整体高出56%。“共享源计划”为设备制造商提供了全面的源代码访问,以进行修改和重新发布(根据许可协议条款),而且不需要与微软或其他方共享他们最终的设计成果。尽管Windows操作系统是一个通用型计算机平台,为实现统一的体验而设计,设备制造商可以使用Windows Embedded CE 6.0这个工具包为不同的非桌面设备构建定制化的操作系统映像。通过获得Windows Embedded CE源代码的某些部分,比如:文件系统、设备驱动程序和其他核心组件,嵌入式开发者可以选择他们所需的源代码,然后编译并构建自己的代码和独特的操作系统,迅速将他们的设备推向市场。

旗舰版Win7搭建WinCE6.0环境以及第一个Hello Windows CE程序

旗舰版Win7搭建WinCE6.0环境以及第一个Hello Windows CE程序

旗舰版Win7建立WinCE6.0环境Windows CE 6.0所使用的Platform Builder 和以往的Windows CE 5.0/4.2等均不同,它并不是独立的开发平台软件,而是作为VS2005的一个插件来安装使用的,因此必须先安装VS2005,以后所有的内核配置编译等开发都基于VS2005进行。

在安装WinCE6.0之前要先安装VS2005以及Vs2005的相关补丁,而所装操作系统(XP、Win7)和VS2005版本不同(中文版、英文版),所需的补丁也有所不同。

下面就罗列出不同操作系统和不同版本VS2005所需的补丁。

安装软件列表如下,以下排列顺序也是安装顺序。

安装这些软件大概占用14G硬盘空间,以下软件皆可在网上下载到。

软件列表1.Visual Studio 20052.Visual Studio 2005 Service Pack 1若安装的是英文版VS2005,则需要安装的补丁的文件名为:VS80sp1-KB926601-X86-ENU.exe;若安装的是中文版VS2005,则需要安装的补丁的文件名为:VS80sp1-KB926604-X86-CHS.exe3.Visual Studio 2005 Service Pack 1 Update for Windows Vista若使用的是WindowsXP,则不用安装此项。

若使用的是Windows7,则需要安装此补丁。

若安装的是英文版VS2005,则需要安装的补丁的文件名为:VS80sp1-KB932232-X86-ENU.exe;若安装的是中文版VS2005,则需要安装的补丁的文件名为:VS80sp1-KB932230-X86-CHS.exe4.Visual Studio 2005 Service Pack 1 ATL Security Update若使用的是XP系统,则不必安装该补丁。

文件名:VS80sp1-KB971090-X86-INTL.exe ATL是ActiveX Template Library 的缩写,它是一套C++模板库5.Windows Embedded CE6.06.Windows Embedded CE 6.0 Platform Builder Service Pack 17.Windows Embedded CE 6.0 R28.Windows Embedded CE 6.0 R39.安装模拟器Microsoft Device Emulator 2.0 -- Standalone Release10.CHSEmu.msi这个文件是我从网上下载到的别人创建的SDK,如果你自己创建自定义SDK不成功,或者不想自己创建一个SDK的话,直接安装这个SDK就可以了。

WINCE6.0体系结构学习

WINCE6.0体系结构学习

WINCE6.0体系结构学习WINCE6.0的体系结构图如下图所示:图1 WINCE的体系结构根据上图可以把WINCE6.0体系结构分为硬件层、OEM层、操作系统层和应用层,这四层紧密合作,相互配合来完成从应用程序的调用到对硬件的操作和交互。

1.硬件层硬件平台的核心是嵌入式处理器,而嵌入式处理器的种类很多,处理能力和主频的速度各有差异,如果要跑WINCE操作系统,需要处理器包含MMU单元。

WINCE6.0支持的ARM、MIPS、x86、SHx这四种CPU体系,在这点上嵌入式linux支持更多CPU体系结构的处理器。

2.OEM层OEM(Original Equipment Manufacturer,原始设备制造商)层位于WINCE的操作系统层和硬件层,主要的作用是对硬件进行抽象并且提供统一的接口让操作系统来和硬件交互。

OEM 层主要包括OAL(OEM Abstraction Layer,OEM抽象层)、bootloader、配置文件和驱动程序。

3.操作系统层由图1可知操作系统层包括Coredll、文件系统、GWES、设备管理器、驱动(分为用户模式和驱动模式的驱动)、services服务和内核(Kernel)这些部分组成。

3.1 Coredllcoredll.lib,Coredll模块为其他WINCE模块提供核心(core)功能,此模块是WINCE操作系统的一个不可或缺的模块,但它不一定需要所有的组成部分。

Coredll模块包含配置OS的结构体、宏定义、函数等重要的内容,这些信息定义在Celog.h、Pkfuncs.h、Pwinreg.h、Pwinuser.h和Windbase.h头文件中,为了引入(import)这些功能,必须链接coredll.lib文件。

Coredll模块包含很多部分,比如battery、cormain等部分,这些部分都是以lib的形式提供,具体看help文档Developing an OS Design->Windows Embedded CE Moudules and Components->Common Windows Embedded CE Modules下的介绍。

Windows CE 6.0 安装顺序 - 操作系统

Windows CE 6.0 安装顺序 - 操作系统

Windows CE 6.0 安装顺序- 操作系统1、先装Visual Studio 2005, 我拿到的是Professional Edition。

最好别用DEFAULT安装,把组件CUSTOM一下,不然会花很多冤枉的磁盘空间。

WINCE600的Platform Builder不像WINCE500是独立的,而是作为VS2005的插件,以后建立和定制OS、编译调试全部在VS2005里完成2、安装Visual Studio 2005 Service Pack 1, 发布的地址/zh-cn/vstudio/bb265237.aspx 这是必须的装的,Release Note里面提到SP1提供了Windows Embedded 6.0 platform and tools support。

不同的VS2005版本(Standard / Professional / Tem Edition) 会对应到不同的下载上,不过简单点就用这个下载/downloads/details.aspx?familyid =BB4A75AB-E2D4-4C96-B39D-37BAF6B5B1DC&displayl ang=en 430多兆,通吃所有版本。

3、可选,安装Visual Studio 2005 Service Pack 1 Update for Windows Vista。

发布和下载网址/downloads/details.aspx?FamilyI D=90e2942d-3ad1-4873-a2ee-4acc0aace5b6&displaylang =en在SP1的基础上增加对VISTA的支持。

注意一定要先装SP1,再装这个,在System Requirements里强调了Required Software: licensed copy of a Visual Studio 2005 and Visual Studio 2005 Service Pack 1. 我当时以为这个包含了上面SP1,浪费了不少时间4、安装MSDN,从VS2005的安装页里选择。

深入windows+CE6.0

深入windows+CE6.0

User Space 2 Gigabytes Each process has its own mapping
Process space 1 GB per process
Executable code and data VM Allocation File Back Mapfiles
0x00000000
Cached access to physical memory
0x80000000
新的操作系统布局
将关键的驱动、文件系统以及图形窗口管理加入 系统内核
Coredll.dll的内核版本
APIS保持一致
优点
极大的减少了系统调用这些组件的开销 减少了所有从用户空间到内核空间之间调用的开销 提高了基础操作系统服务间的代码共用性
内核空间
0xFFFFFFFF CPU Specific VM Kernel VM (if supported by CPU) 256 MB Kernel VM 256 MB
System Trap Area Kernel Virtual Memory Shared by all kernel Servers and drivers Ram file system & ram registry All XIP DLLs in kernel Uncached access to physical memory
CoreDLL继续保持兼容
WIN32s APIS最小集 变更隐藏在库文件中
共享DLL代码继续保持一致
SDK应用程序表现保持一致
运行时保持不变或很少的变化
应用程序采用一些非常规的应用
将需要被修改 如:在进程间传递句柄及指针
主要改变是驱动程序如何访问客户内存
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

高级操作系统论文--嵌入式系统WindowsCE 6.0介绍目录1.WINDOWS CE是什么 (1)2.产生背景 (1)3.发展历史 (2)4.架构 (4)4.1.硬件层 (5)4.2.OEM硬件适配层 (5)4.3.W INDOWS CE操作系统服务层 (5)4.4.应用层 (8)5.开发 (8)6.特点 (9)7.缺点 (10)1.Windows CE是什么微软在操作系统领域共有3大分支,其中之一是已经成为历史的DOS/Win9X。

而另一分支则是正在桌面环境上发光发热的NT架构,如XP,Vista等等。

而CE这一分支算是微软针对个人计算机以外的产品所开发的操作系统家族统称,Windows CE设计成针对小型设备(它是典型的拥有有限内存的无磁盘系统)的通用操作。

专门设计给掌上电脑以及嵌入式设备所使用的电脑环境。

这样的操作系统可使完整的可移动技术与现有的Windows桌面技术整合工作。

系统使用在PDA或智能型手机上的就称为Windows Mobile,要使用这个名称必需要通过微软认证。

而应用在其它用途,如机顶盒、VoIP电话、收银机等则维持Windows CE 的名称,不需通过认证,但是在授权费用方面则是有所不同。

Windows CE 6.0 使用了基于数量的特许许可证模式,设备制造商可以在设备开始供货时再购买运行许可证。

微软将提供知识产权保护(根据许可协议条款)和为期10 年的产品支持生命周期,确保产品的完整性并保证厂商得到必要的支持和保护以获得成功。

所以使用Windows嵌入式系统基本上不同名称只是在于启用元件的不同而已,核心都基本一样。

不象其它的微软Windows 操作系统,Windows CE并不是一个标准的相同的对所有平台适用的软件。

为了足够灵活达到适应广泛产品需求,Windows CE采用标准模式,这就意味着,它能够由一系列软件模式做出选择,从而使产品定制。

另外,一些可利用模式也可作为其组成部分,这意味着这些模式能够通过从一套可利用的组份做出选择,从而成为标准模式,通过选择,能够达到系统要求的最小模式,OEM 能够减少存储脚本和操作系统的运行。

Windows CE中的C代表袖珍(Compact)、消费(Consumer)、通信能力(Connectivity)和伴侣(Companion);E代表电子产品(Electronics)。

与Windows 95/98、Windows NT不同的是,Windows CE是所有源代码全部由微软自行开发的嵌入式新型操作系统,并已开源了大部分代码。

其操作界面虽来源于Windows 95/98,但Windows CE是基于WIN32 API重新开发、新型的信息设备的平台。

Windows CE具有模块化、结构化和基于Win32应用程序接口和与处理器无关等特点。

Windows CE不仅继承了传统的Windows图形界面,并且在Windows CE平台上可以使用Windows桌面系统的编程工具(如Visual Basic、Visual C++、C#等)、使用同样的函数、使用同样的界面风格,使绝大多数的应用软件只需简单的修改和移植就可以在Windows CE平台上继续使用。

Windows CE并非是专为单一装臵设计的,所以微软为旗下采用Windows CE系统的产品大致分为三个:Pocket PC(掌上电脑)如Windows Mobile的智能手机、Handheld PC(手持设备)如使用在工业领域的终端、Auto PC 如车载应急报警或导航设备。

2.产生背景对于大部分制造业企业,测量仪器的自动数据采集一直是个令人烦恼的事情,即使仪器已经具有RS232/485等接口,但仍然在使用一边测量,一边手工记录到纸张,最后再输入到PC中的处理方式,不但工作繁重,同时也无法保证数据的准确性,常常管理人员得到的数据已经是滞后了一两天的数据;而对于现场的不良产品信息及相关产量数据,如何实现高效率、简洁、实时的数据采集更是一大难题。

Windows CE是将各种输入设备如键盘,条码扫描装臵,摄像头等与数据终端一体化,带有电池,可离线操作的终端电脑设备。

具备实时采集、自动存储、即时显示、即时反馈、自动处理、自动传输等功能。

为现场数据的真实性、有效性、实时性、可用性提供了保证。

其具有一体性、机动性、体积小、重量轻、高性能,并适于手持等特点。

早期主要应用于工业领域数据采集。

3.发展历史3.0发布于2000年六月。

代号Cedar。

从此开始分化出Mobile版本,著名的Pocket PC 2000也由此而来。

●针对核心进行重写使CE的实时性推进至微秒层级。

●Pocket PC 2000,Pocket PC 2002及Smartphone 2002的基础。

●优先级数从8增加至256。

●系统对象数从65 536增加至4亿1900多万。

●使用特殊的APIs对系统进行访问,对注册表的写操作也被限制在部分区域。

4.x发布于2002年1月。

代号Talisker/Jameson/McKendric。

2003年微软将Pocket PC 2003和Smart Phone 2003统一改称为Windows Mobile 2003,依然包括Windows Mobile 2003 for Pocket PC、Windows Mobile2003 for Pocket PC Phone Edition和Windows Mobile 2003 forSm artphone。

●更改部分驱动结构并增加新功能。

●Pocket PC 2003的基础。

●提供蓝牙支持。

●支持TLS(SSL 3.1),IPsec L2TP VPN、Kerberos。

5.0发布于2004年8月。

代号"Macallan"。

2005年微软将新的操作系统称为Windows Mobile 5.0。

依然包括Windows Mobile 5.0 for Pocket PC(不支持电话功能)、Windows Mobile 5.0 for Pocket PC Phone(支持触摸屏)和Windows Mobile 5.0 for Sm artphone(不支持触摸屏)。

●自动向生产商发送错误报告。

●移动式Direct3D,一个基于COM的Windows X P DirectX多媒体API版本。

●2D图形DirectDraw和摄像头与影片的DirectShow数字化支持。

●支持Remote Desktop Protocol(RDP)。

6.x发布于2006年9月。

代号"Yamazaki"。

2007年微软推出Windows Mobile 6,它有三个不同的版本:“Windows Mobile 6 Standard”(用在智能手机,没有触摸屏),“Windows Mobile 6 Professional”(用在智能手机,有触摸屏),以及“Windows Mobile 6 Classic”(用在掌上电脑,没有通话功能)。

●进程地址空间从32 MB增加至1 GB●进程数目从32增加至32768●可以使用用户模式和内核模式的设备驱动。

●Device.exe, filesys.exe, GWES.exe被转移至内核模式中,改为Device.dll,filesys.dll,GWES.dll●SetKMode and setProcPermissions函数不再提供●增强系统调用的性能。

7.x7.0 发布于2010年10月。

7.5 发布于2011年9月。

随着版本号的升级,其正式名为Windows Embedded Compact 7。

微软的Windows Phone 7所采用的内核正是使用了类似的WinCE 7内核。

●对无缝连接技术的改进:Windows Embedded Compact 7提供的各项技术可以支持与富媒体、在线服务、Windows PC、智能手机和其他手持设备的无缝连接;●改进连接和使用富媒体服务:Windows Embedded Compact 7使用了新的媒体库来简化多媒体功能管理,并对MPEG-4和HD高清进行了支持,灵活的插件架构技术支持第三方内容扩展;●实现了和Windows 7的无缝对接:利用Windows Device Stage简化了多媒体的管理,可以很轻松地在两者间同步数据和媒体文件;●完善Office和个人信息服务:可支持Office Viewers AirSync和Microsoft Exchange;●丰富用户体验:可以利用Windows Embedded Compact 7提供的创新解决方案,为用户提供非同凡响的设备交互能力;●灵活的UI框架扩展:Windows Embedded为设备提供了一个更加丰富和直观的用户界面框架——Silverlight,设计师可以利用Microsoft Expression Blend构建出只限于想象力的界面效果;●丰富在线冲浪体验:Windows Embedded Compact 7更新的IE浏览器引擎支持Tab标签页、Zooming缩放等功能,支持Adobe Flash 10.1组件;●改进操控输入更具人性化:内臵了强大的触控交互方式,允许用户自定义手势,并为移动设备原生提供了多点操控支持。

4.架构早期的嵌入式软件基本上是在汇编级开发的,系统的运行不需要操作系统支撑。

每增加一种系统功能都需要重新进行开发,这种情况给嵌入式系统的应用和发展带来很大的阻碍。

随着嵌入式系统的广泛应用,操作系统的引入也就日益显得重要了。

比较著名的嵌入式操作系统有嵌入式Linux,μC/OS-II,VxWorks,Palm OS和Windows CE等。

Windows CE是Microsoft推出的32位、多任务、多线程、实时的嵌入式操作系统,它与其他嵌入式操作系统相比有以下优势:拥有出色的图形界面,提供了方便的集成开发环境和开发工具,对OS的定制、裁减、交叉编译等都相对简单;便于继承已有的基于Windows的开发经验,可以使用类似于Windows上的应用软件开发工具(如.NET,EVC等);Window CE已得到大量硬件厂商的支持,支持的微处理器架构包括MIPS系列、ARM系列、SH系列、X86系列。

基于Windows CE的嵌入式系统采用四层体系结构,具有层次性强、可移植性好、组件可剪裁、强调编程接口和支持上层应用等特点。

系统从下而上可分为四层:硬件层,OEM 硬件适配层,操作系统服务层,应用层。

具体的系统架构可以用下图来表示:4.1.硬件层Windows CE 系统所需的最低硬件配臵包括支持Windows CE的32 位处理器、用于线程调度的实时时钟、用于存储和运行操作系统的存储单元。

相关文档
最新文档