2013年10月25日 星期五

WinCE如何使用Platform Builder Debug

參考以下步驟,
  1. Building Debug版的OS Image
    • 從"Platform"選單選擇"Settings" 
    • 在"Settings" dialog選擇"debug configuration" 
    • 在"Build Options" table勾選"Enable Kernel Debugger" 
  2. 連結PC與Target device 
    • 於PC設定static IP 
    • 於Target device eboot選單中,設定static IP,讓PC與Target device於同一網域內
      或 
    • PC連接至DHCP server 
    • Targe device設為DHCP模式,皆由DHCP獲得IP 
  3. 設定Download and Debugging方式 
    • 從"Target"選單選擇"Configure Remote Connection" 
    • 於"Download Service"選擇"Ethernet" 
    • 於"Kernel Transport"選擇"Ethernet" 
    • 打開Target device進入download模式 
    • 按下"Configure"按鈕,等到收到"Device ID"後,選擇此ID 
  4. Platform Builder顯示download進度 
  5. Platform Builder於debug window顯示booting message 
  6. 使用"Debug" tool進行debug

WinCE4.2 Loadcepc Floppy can't detect C:

建立win98開機片,並從loadcepc磁片複製"AUTOEXEC.BAT"、"CONFIG.SYS"及"HIMEM.SYS"到win98開機片,成為新的loadcepc磁片。

輸入Windows Embedded CE PID

依照下列步驟,
  1. 開啟Platform Builder 
  2. 於"File"選單下選擇"License Binary Image" 
  3. 輸入25字的PID 
  4. 按下"Stamp Binary"按鈕,完成PID的輸入

WinCE ignore Build Warning Message

使用compiler option - /W,/w來設定 Warning Level。

Warning Level
Description
/w
Turns off all warning messages. Use this option when you compile programs that deliberately include questionable statements. The /w option applies to the remainder of the command line, or applies until the next occurrence of a /w option on the command line. /W and /W0 are the same as /w.
/W1
Default. Displays severe warning messages.
/W2
Displays an intermediate level of warning messages. Level 2 includes warnings such as the following: 
  • Use of functions with no declared return type 
  • Failure to put return statements in functions with non-void return types 
  • Data conversions that would cause loss of data or precision
/W3
Displays a less severe level of warning messages, including warnings about function calls that precede their function prototypes in the source code.
/W4
Displays the least severe level of warning messages, including warnings about the use of non-ANSI features and extended keywords.
/WX
Treats all warnings as errors. If there are any warning messages, the compiler generates an error message, and continues compilation.

CL environment variable – 
SET CL=[[ [[option]] ... [[file]] ...]] [[/link [[ link-libinfo]] ]]
CLxxx [[option...]] file... [[option | file]]... [[lib...]]
[[/link link-opt...]][[@response-file]]
Argument
Description
Option
One or more compiler options.
  • All options apply to all specified source files.
File
Specifies the name of one or more source files, object files, or libraries. You must specify at least one file name. The compiler compiles the source files and passes the names of the object files and libraries to the linker.
Lib
Specifies one or more library names. The compiler passes the names of these libraries to the linker for processing.
Link-opt
Specifies one or more of the linker options. The compiler command passes these options to the linker for processing.
Response-file
Specifies a response file that can contain multiple options and file names that you would otherwise type on the command line or specify by using the CL environment variable.

在WinCE6.0上使用MFC

WinCE6.0轉支援ATL8移除了MFC component。
我們可利用下列方式讓WinCE6.0支援MFC。
  1. 將所有MFC的DLL檔案包到OS Image
    • DLL來源位置:$(_SystemRoot)\Program Files\Microsoft Visual Studio 8\VC\ce\DLL\Platform
    • 將其包進.bib file於MODULES section
  2. 加入OS Dependencies for .NET Compact Framework 2.0及.NET Compact Framework 2.0 components
P.S. 我們可以利用此project建出來的SDK來開發其application

WinCE compiler after modifying reginit.ini

依下列步驟,
  1. 選擇"Open Release Directory",打開DOS視窗。 
  2. 執行"regcomp reginit.ini [release directory]"。 
  3. 執行"romimage ce.bib"。

WinCE compiler after modifying ce.bib

依下列步驟,
  1. 選擇"Open Release Directory",打開DOS視窗。 
  2. 執行"romimage ce.bib"。

WinCE6.0 R3增加Office Viewer

  1. http://www.microsoft.com/downloads/details.aspx?FamilyID=d2fd14eb-7d5c-428b-951c-343f910047c1&displaylang=en
    Download : WesttekFileViewers6.exe
  2. Install WesttekFileViewers6.exe
  3. Find “File Viewers” under “Third Party” directory in Catalog Items View
  4. Check office viewers or set “SYSGEN_EXCELVIEWER”, “SYSGEN_POWERPOINTVIEWER” and “SYSGEN_WORDVIEWER”, then the viewers will be included into OS
  5. Find the Excel viewer, PowerPoint viewer and so on in WinCE OS

什麼是Portable Media Center

Portable Media Centers is like Media to go
  Portable Media Centers put all of your favorite video, music, and pictures at your fingertips wherever you are. Take digital entertainment from your PC with you on the go, including recorded TV shows, downloaded videos, home movies, music, and photos. With Windows Mobile™ software featuring an easy-to-use, familiar Windows Media Center Edition interface, Portable Media Centers let you enjoy immediate access to all of your favorite entertainment - anytime, anywhere.

什麼是ECMA

ECMA是指國際標準規範組織
參考WiKi

WinCE support IDE Hard Disk

"atadisk.dll"提供了標準的IDE Hard Disk支援。

WinCE5.0 Support 4GB SD Card On MainstoneII

  1. 安裝WinCEPB50-070430-2007M04-Armv4I.msi patch,
    內含SDHC(KB933809)更新。 讓WinCE可支援SD High Capacity Card(4GB~32GB)
  2. 增加IMGSDBUS2=1環境變數,enable SD BUS 2支援。
  3. 修改Mainstone SDHC driver,如下:
    增加ResponseR7 support至sdcontrol.c檔,底下為部份程式碼。
    switch (pRequest->CommandResponse.ResponseType) {
        case NoResponse:
           cmdatRegister = MMC_CMDAT_RESPONSE_NONE;
        break;

        case ResponseR1b:
           // response1 with busy signaling
           cmdatRegister = MMC_CMDAT_RESPONSE_R1;
        break;

        case ResponseR1:
           ......
           ......

        case ResponseR7:
           // on an MMC controller R5 and R6 are really just an R1 response
           cmdatRegister = MMC_CMDAT_RESPONSE_R1;
        break;

        case ResponseR2:
           cmdatRegister = MMC_CMDAT_RESPONSE_R2;
        break;
        ......
        ......
       return SD_API_STATUS_INVALID_PARAMETER;

WinCE4.2 Enable SIS platform for two Ethernet

1.      set BSP_NIC_RTL8139=1set BSP_NIC_RTL81392=1set BSP_ICS=1
2.      增加ICS component包含ICS(Internet Connection Share)NAT(Networking Address Translation)。 

WinCE增加x86 COM Port

增加並修改registry設定。

EX:
增加第四個COM port,
  1. 於"[BSP name].bat"增加"set BSP_SERIAL4=1"。
  2. 於"platform.reg"增加,
    IF BSP_SERIAL4
    [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial4]
    "SysIntr"=dword:1B ; 同BIOS interrupt加0x10,為16位元
    "IoBase"=dword:02E8 ; 同BIOS
    "IoLen"=dword:8
    "DeviceArrayIndex"=dword:3
    "Prefix"="COM"
    "Dll"="Com16550.Dll"
    "Order"=dword:0

    [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial4\Unimodem]
    "Tsp"="Unimodem.dll"
    "DeviceType"=dword:0
    "FriendlyName"=LOC_FRIENDLYNAME_SERIAL4
    "DevConfig"=hex: 10,00, 00,00, 05,00,00,00, 10,01,00,00, 00,4B,00,00, 00,00, 08, 00, 00, 00,00,00,00
    ENDIF BSP_SERIAL4

在Blog加入Facebook Link

可以參考
Facebook開發人員網站
Facebook Social Plugins

2013年10月18日 星期五

WinCE修改IE Default Code Page

更改 IE default codepage, 從 English 轉成 Chinese.

[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\International]
"Default_CodePage"=hex:b6,03,00,00
"AcceptLanguage"="zh-tw,zh-cn;q=0.7"

WinCE修改File System Code Page

使用下列registry設定,
[HKEY_LOCAL_MACHINE\System\StorageManager\FATFS]
"CodePage" = dword:419

Locale IDs可參考微軟網站.
http://msdn.microsoft.com/en-us/goglobal/bb964664.aspx

WinCE使用Hive-based Registry

  1. 增加 hive-based registry component
  2. 設定hive-based registry
    [HKEY_LOCAL_MACHINE\init\BootVars]
    "SYSTEMHIVE"="Registry\\system.hv" ; hive-based 檔案名稱
    "PROFILEDIR"="Registry" ; hive-based 檔案目錄
    "Start DevMgr"=dword:1
Example :
Implement hive-based registry with Hard Disk on NS platform.

; HIVE BOOT SECTION
[HKEY_LOCAL_MACHINE\init\BootVars]
"SYSTEMHIVE"="Documents and Settings\\system.hv"
"PROFILEDIR"="Documents and Settings"
"Start DevMgr"=dword:1
; END HIVE BOOT SECTION

; HIVE BOOT SECTION
[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\HDProfile]
"MountFlags"=dword:2

[$(PCI_BUS_ROOT)\Template\GeodeIDE]
"Flags"=dword:1000 ; Set the bit to load during the first boot phase

[$(PCI_BUS_ROOT)\Template\GeodeIDE\Device0]
"Flags"=dword:1000

[LOCAL_MACHINE\Drivers\BuiltIn\PCI\Template\GeodeIDE\Device0]
"Prefix"="DSK"
"Dll"="atapi.dll"
"Settings"=dword:A ; Setting A to disable DMA
"DeviceId"=dword:0
"Ioctl"=dword:4
"IClass"=multi_sz:"{A4E7EDDA-E575-4252-9D6B-4195D48BB865}"
; END HIVE BOOT SECTION

WinCE6.0 SQL Server Compact 3.5 Usage


  1. 增加下列檔案至 bib file
    Modules
    sqlceme35.dll $(_FLATRELEASEDIR)\sqlceme35.dll NK
    sqlceca35.dll $(_FLATRELEASEDIR)\sqlceca35.dll NK
    sqlcecompact35.dll $(_FLATRELEASEDIR)\sqlcecompact35.dll NK
    sqlceer35EN.dll $(_FLATRELEASEDIR)\sqlceer35EN.dll NK
    sqlceoledb35.dll $(_FLATRELEASEDIR)\sqlceoledb35.dll NK
    sqlceqp35.dll $(_FLATRELEASEDIR)\sqlceqp35.dll NK
    sqlcese35.dll $(_FLATRELEASEDIR)\sqlcese35.dll NK
  2. 在postlink.bat file增加下列指令
    echo copying sqlceme35.dll
    copy "C:\Program Files\Microsoft SQL Server Compact Edition\v3.5\Devices\wce500\armv4i\sqlceme35.dll"
  3. Rebuild the Windows Embedded CE 6.0 OS image

WinCE4.2 Add ADOCE


To use the ADOCE control, you need the following software:
  1. Microsoft Windows CE Services version 2.1 or later。
  2. Microsoft Windows NT Workstation version 4.0 or Windows 95 or 98 Microsoft Windows CE Platform SDK for the device you are using。
  3. Microsoft Visual Basic Professional Edition version 6.0, development system or Microsoft Visual Basic Enterprise Edition version 6.0。
  4. Microsoft Windows CE Toolkit for Visual Basic version 6.0。
The ADOCE control is included in the Windows CE Toolkit for Visual Basic.
Please refer http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnce30/html/adoce30.asp
Add SQL Server CE 2.0 component。

WinCE使用SNTP同步時間

#include <Service.h>
int _tmain(int argc, _TCHAR* argv[])
{
HANDLE hFile = CreateFile(TEXT("NTP0:"), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
// Stop SNTP service
DeviceIoControl(hFile, IOCTL_SERVICE_STOP, NULL, 0, NULL, 0, NULL, NULL);
// Get service status
DeviceIoControl(hFile, IOCTL_SERVICE_STATUS, NULL, 0, &dwState, sizeof(DWORD), NULL,NULL);
// Start the SNTP service
DeviceIoControl(hFile, IOCTL_SERVICE_START, NULL, 0, NULL, 0, NULL, NULL);
// set sync event
DeviceIoControl(hFile, IOCTL_SERVICE_CONTROL, L"Sync", sizeof(L"Sync"), NULL, 0, NULL, NULL);
// Refresh
DeviceIoControl(hFile, IOCTL_SERVICE_REFRESH, NULL, 0, NULL, 0, NULL, NULL);
CloseHandle(hFile);
return 0;
}
好像不會一執行馬上就同步,執行後要等一小小段時間。

WinCE設定Static IP


設定其下的registry key,
[HKEY_LOCAL_MACHINE\Comm\NE20001\Parms\Tcpip]
"EnableDHCP"=dword:0
"DefaultGateway"=""
"UseZeroBroadcast"=dword:0
"IpAddress"="192.168.80.2"
"Subnetmask"="255.255.0.0"

WinCE Active Sync自動連結


增加下面的registry key即可
[HKEY_CURRENT_USER\Comm]
[HKEY_CURRENT_USER\Comm\RasBook]
[HKEY_CURRENT_USER\Comm\RasBook\我的連接]
"Entry"=hex:\
08,02,40,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,20,8b,53,00,0 1,\
00,00,00,01,d3,04,16,f0,b3,00,00,64,d3,04,16,01,00,00,00,20,8b,53,00,01,00,\
00,00,01,00,00,00,88,da,04,16,0a,00,00,00,f0,d3,04,16,01,00,00,00,9c,d3,04,\
16,44,94,03,00,b0,0a,54,0a,9c,d3,04,16,98,96,03,00,ac,d3,04,16,7a,1a,05,16,\
00,00,00,00,00,00,00,00,ae,01,00,00,00,00,00,00,00,00,00,00,b0,0a,54,0a,b0,\
0a,54,0a,00,00,00,00,0a,00,00,00,d0,d3,04,16,00,00,00,00,ae,01,00,00,a4,af,\
c6,02,d0,23,1a,00,00,00,00,00,84,d5,04,16,00,00,00,00,18,d4,04,16,00,00,00,\
00,00,00,00,00,00,00,00,00,0a,00,00,00,00,00,00,00,40,d5,04,16,00,00,00,00,\
01,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,c2,a1,86,23,00,00,00,00,b0,\
0a,54,0a,01,00,00,00,56,01,00,00,00,00,00,00,c4,b3,c6,02,96,01,00,00,49,01,\
00,00,ae,01,00,00,58,01,00,00,01,00,00,00,e0,eb,55,00,b0,0a,54,0a,01,00,00,\
00,2c,d7,04,16,f0,d3,04,16,0a,00,00,00,01,00,00,00,00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,01,00,00,00,64,00,69,00,72,\
00,65,00,63,00,74,00,00,00,04,16,9c,ab,03,00,98,d4,04,16,00,00,00,00,00,00,\
00,00,0a,00,55,00,53,00,42,00,20,00,43,00,61,00,62,00,6c,00,65,00,3a,00,00,\
00,00,00,00,00,c2,a1,86,23,00,00,00,00,01,00,00,00,00,00,00,00,01,00,00,00,\
0a,00,00,00,b0,9a,d9,81,00,00,00,00,f0,d4,04,16,28,a9,0f,00,20,8b,53,00,89,\
01,00,00,01,00,00,00,7a,1a,05,16,00,00,00,00,01,00,00,00,0a,00,00,00,7a,1a,\
05,16,0a,00,00,00,01,00,00,00,0a,00,00,00,0a,00,00,00,b4,14,f6,03,7a,1a,05,\
16,7a,1a,05,16,34,d5,04,16,fc,7a,0f,00,c0,8a,53,00,81,00,00,00,7a,1a,05,16,\
00,00,00,00,b0,0a,54,0a,60,2d,17,00,c2,a1,86,23,7a,1a,05,16,7a,1a,05,16,00,\
00,00,00,58,d5,04,16,c8,11,03,00,00,00,00,00,c0,8a,53,00,68,d5,04,16,fc,5c,\
08,00,78,d5,04,16,00,00,00,00,3a,ba,97,23,74,d5,04,16,00,61,0d,80,00,00,00,\
00,e4,e5,01,00,3a,ba,97,23,e0,eb,55,00,00,00,00,00,00,00,00,00,00,00,00,00,\
00,00,00,00,a4,d5,04,16,10,37,09,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
00,00,00,bc,d5,04,16,94,3e,08,00,80,4d,1a,00,40,49,55,00,00,00,00,00,00,00,\
00,00,d4,d5,04,16,ac,2e,0c,00,3a,ba,97,23,0a,00,00,00,01,00,00,00,01,00,00,\
00,00,00,00,00,c0,8a,53,00,3a,ba,97,23,7a,1a,05,16,0c,d6,04,16,3a,ba,97,23,\
0c,00,00,00,08,d6,04,16,00,00,00,00,0a,00,00,00,3a,ba,97,23,3a,ba,97,23,7c,\
b8,0f,80,3a,ba,97,23,24,d6,04,16,4c,5e,08,00,7a,1a,05,16,a8,d6,04,16,12,32,\
b7,23,3a,ba,97,23,3a,ba,97,23,c4,37,f6,03,00,00,00,00,01,00,00,00,3a,ba,97,\
23,3a,ba,97,23,12,32,b7,23,58,d6,04,16,30,38,09,00,00,ff,04,16,b0,0a,54,0a,\
b0,0a,54,0a,60,2d,17,00,c2,a1,86,23,01,00,00,00,01,00,00,00,00,00,00,00,80,\
d6,04,16,c8,11,03,00,00,00,00,00,b0,0a,54,0a,90,d6,04,16,fc,5c,08,00,a0,d6,\
04,16,bc,d6,04,16,b0,d6,04,16,a4,d6,04,16,00,d6,04,16,00,00,00,00,a4,75,0f,\
00,12,32,b7,23,c0,87,53,00,00,00,00,00,7a,1a,05,16,0a,00,00,00,00,00,00,00,\
7a,1a,05,16,d8,65,d7,81,0a,00,00,00,00,00,00,00,c0,87,53,00,01,00,00,00,01,\
00,00,16,c0,d6,04,16,01,6a,0d,80,01,00,00,00,c0,87,53,00,01,00,00,00,01,00,\
00,00,01,00,00,00,0a,00,00,00,70,d7,04,16,01,00,00,00,1c,d7,04,16,44,94,03,\
00,b0,0a,54,0a,1c,d7,04,16,98,96,03,00,2c,d7,04,16,7a,1a,05,16,00,00,00,00,\
00,00,00,00,d8,65,d7,81,b0,9a,d9,81,90,73,87,83,b0,9a,d9,81,02,00,00,00,00,\
00,00,16,50,d7,04,16,78,55,0d,80,e4,a8,86,83,01,00,00,00,b0,9a,d9,81,90,73,\
87,83,b0,9a,d9,81,02,00,00,00,00,00,00,00,2c,d8,04,16,7a,1a,05,16,dc,3f,bb,\
83,0f,00,00,00,00,00,00,00,90,73,87,83,e4,a8,86,83,01,04,00,00,7a,1a,05,00,\
00,00,00,16,00,00,00,00,00,00,00,00,c8,94,d9,81,00,00,00,00,74,60,c0,03,90,\
73,87,83,01,00,00,00,00,00,00,00