定製基於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> 
把這兩行替換爲如下的片斷: //下面的">"號 或 "<"號可能因網頁編碼原因,在PB5.0時會識別不了,本人就因這個問題花了很多時間
<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運行程序,不出意外的話模擬器應該就出來了。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章