天天看點

定制基于Visual studio 2005平台Windows CE(ARM V4I)中文模拟器

(本文譯自Microsoft DeviceEmulatorBSP中Using the CE DeviceEmulator.rtf檔案,并對該檔案說明做了相應補充,旨在定制基于ARM4I平台Visual Studio 2005環境中文模拟器,建立用于Platform Builder 5.0+Visual Studio 2005嵌入式Windows CE 5.0開發環境)

一、生成OS 

1. 安裝Windows CE 5.0(記得CPU類型裡把ARMV4I選上)裝完之後裝DeviceEmulatorBSP.msi(本站下載下傳),這是ARMV4I模拟器的BSP。 

2. 運作Platform Builder,建立一個Platform,給你的新Platform取一個名字,我這裡取為MyCEEmu。BSP選擇Microsoft DeviceEmulator:ARMV4I,Design Template選擇Mobile Handheld,Application & Media随你選,Networking & Communications隻選擇Local Area Network(LAN)->Wired Local Area Network,其餘都去掉。最後完成向導。 

3. 添加網卡。在Catalog View的Device Drivers->Networking->Local Area Networking (LAN) devices目錄下,把NE2000-compatible(PCMCIA car)添加進來。 

4. 如果要開發托管程式,添加Catalog View的Core OS->Windows CE Devices->Applications – End User->CAB File Installer/Uninstaller。 

5. 添加ActiveSync(可選),在Catalog View的Core OS->Windows CE Devices->Applications – End User目錄下。 

6. 添加閃存支援。有三個部件:SMFlash,Partition Driver和FAT。 

  先轉到Catalog View: 

  SMFlash在BSP->Microsoft Device Emulator->Storage Drivers->MSFlash Drivers->SmartMedia NAND Flash Driver (SMFLASH), 

  Partition Driver在Core OS->Windows CE Devices->File Systems and Data Store-> Storage Manager->Partition Driver 

  FAT在Core OS->Windows CE Devices->File Systems and Data Store->Storage Manager->FAT File System。 

7. 打開菜單Platform->Setting,這裡有三個地方要設定: //本部分DeviceEmulator.rtf中未說明

1) Build Options頁籤下,去掉Enable CE Target Control Support和Enable KITL; 

2) Environment頁籤,添加環境變量CE_MODULES_SERIAL=1,這是用來将DMA添加進來; 

3) Locale頁籤,用來添加你想要的語言支援,可改可不改。我這裡先Clear All然後選了中文(中國)和英語(美國)。Default Language選為中文。 

8. 視情況添加其他所需的元件,我添加了MSXML的支援。 

9. BuildOS->Sysgen。 

二、生成SDK 

1. 運作SDK Wizard(Platform->SDK->New SDK),填寫必要的資訊之後,把支援的開發工具都勾上,完成。下面是配置SDK(選擇Platform->SDK->Configure SDK),要是覺得沒有什麼好配置的也可以跳過。 

2. 打開ExportSdk.sdkcfg檔案(先做好備份,這個檔案一般在項目根目錄下,就是在New Platform Wizard的第2步中所指定的目錄,預設是%_WINCEROOT%/PBWorkspaces下)。這是一個XML格式的文本檔案,找到這兩行: 

    <PropertyBag NAME=”DeviceEmulation”> 

    </PropertyBag> 

把這兩行替換為如下的片斷: 

<PropertyBag NAME=”DeviceEmulation”> 

        <Property NAME=”Default Image”>1 </Property> 

        <PropertyBag NAME=”1″> 

            <Property NAME=”ImageName”>MyCEEmu </Property> 

            <Property NAME=”VMID”> </Property> 

            <Property NAME=”Default Skin”/> 

            <Property NAME=”Height”>240 </Property> 

            <Property NAME=”Width”>320 </Property> 

            <Property NAME=”BitDepth”>16 </Property> 

            <Property NAME=”Memory”>128 </Property> 

            <Property NAME=”Bin Dest”>Emulation/nk.bin </Property> 

            <Property NAME=”Fixed Screen”>1 </Property> 

            <Property NAME=”CpuName”>ARMV4I </Property> 

            <Property NAME=”DPIX”>96 </Property> 

            <Property NAME=”DPIY”>96 </Property> 

            <Property NAME=”SupportRotation”>0 </Property> 

            <Property NAME=”Enabled”>1 </Property> 

            <Property NAME=”Bin Path”> </Property> 

            <Property NAME=”Ethernet”>1 </Property> 

            <Property NAME=”Ports”>1 </Property> 

            <Property NAME=”AdditionalParameters”> </Property> 

            <PropertyBag NAME=”Skins”/> </PropertyBag> 

</PropertyBag> 

<PropertyBag NAME=”Added Files”> 

        <PropertyBag NAME=”{3B388597-0924-4102-ADFA-2519D2C3E11B}”> 

            <Property NAME=”Source”>C:/WINCE500/MyCEEmu/ReleaseImage </Property> 

            <Property NAME=”Destination”>Emulation </Property> 

            <Property NAME=”Subfolders”>0 </Property> 

        </PropertyBag> 

</PropertyBag> 

3. 設定變量。上面替換的代碼中有幾個變量需要設定,分别是: 

1) ImageName:這是程式員在Visual Studio IDE裡所看到的名字; 

2) VMID:一個GUID,可以用GuidGen.exe來生成一個; 

3) Height/Width:模拟器螢幕的寬高; 

4) BitDepth:顔色深度; 

5) Memory:配置設定給模拟器的RAM大小; 

6) DPIX/DPIY:螢幕DPI; 

7) Source:這是一個目錄,包含編譯生成的NK.bin。建議最好在%_WINCEROOT%下建立一個目錄,專門用于存放NK.bin。 

這裡我設為C:/WINCE500/MyCEEmu/ReleaseImage。 

修改完成後儲存。 

3. 生成SDK。Platform->SDK->Build SDK。一切順利的話應該可以在目前工程目錄的SDK目錄下找到打包成msi檔案的SDK安裝包。 

三、配置Visual Studio 2005 

1. 先安裝生成好的SDK。運作Visual Studio 2005,選擇菜單“工具->選項”,打開選項設定對話框,從左邊的樹型清單中選擇“裝置工具->裝置”,右邊的下拉清單框拉到底可以看到“MyCEEmu”,這就是我們剛剛生成的那個Platform。下面的裝置清單裡有兩項,輕按兩下MyCEEmu,設定傳輸為DMA傳輸,再點選“仿真器選項”,在“顯示”頁籤裡設定好模拟器螢幕尺寸,顔色深度等,全部儲存。 

2. 建立一個智能裝置項目,向導第2步選擇平台的時候用我們的MyCEEmu替換Pocket PC 2003,完成。然後按F5運作程式,不出意外的話模拟器應該就出來了。

繼續閱讀