2010年4月29日 星期四

Switch between MIPS and Win32

在VS2008中 要switch MIPS & Win32,
發現
1. Standard SDK x86 build 出來的執行檔無法在Windows(Win32) 下執行??
2. comment stdafx.h, include 及其它的如 就可以 compile了
3. 研究 CE 下的 stdafx.h
// stdafx.h : include file for standard system include files,


// or project specific include files that are used frequently, but

// are changed infrequently

//



#pragma once



#pragma comment(linker, "/nodefaultlib:libc.lib")

#pragma comment(linker, "/nodefaultlib:libcd.lib")



// NOTE - this value is not strongly correlated to the Windows CE OS version being targeted

#define WINVER _WIN32_WCE



#include

#if defined(WIN32_PLATFORM_PSPC)

defined(WIN32_PLATFORM_WFSP)

#define SHELL_AYGSHELL

#endif



#ifdef _CE_DCOM

#define _ATL_APARTMENT_THREADED

#endif



#include









#include

#include



#if defined(WIN32_PLATFORM_PSPC)

defined(WIN32_PLATFORM_WFSP)

#ifndef _DEVICE_RESOLUTION_AWARE

#define _DEVICE_RESOLUTION_AWARE

#endif

#endif



#ifdef _DEVICE_RESOLUTION_AWARE

#include "DeviceResolutionAware.h"

#endif



#if _WIN32_WCE < 0x500 && ( defined(WIN32_PLATFORM_PSPC)

defined(WIN32_PLATFORM_WFSP) )

#pragma comment(lib, "ccrtrtti.lib")

#ifdef _X86_

#if defined(_DEBUG)

#pragma comment(lib, "libcmtx86d.lib")

#else

#pragma comment(lib, "libcmtx86.lib")

#endif

#endif

#endif



#include



// TODO: reference additional headers your program requires here


WIN32_PLATFORM_PSPC   WinCE Pocket PC ( or Palm Size PC )
WIN32_PLATFORM_WFSP  WinCE SmartPhone

Printer.swap

在 CE 的根目錄下發現了 Printer.swap 這個檔案,大小為 2,000,000
搜尋了一下,這個檔案是由 smbserver 所create,作為network printer的spool
好像沒辦法消除,不過目前可由registry控制其大小。

[HKEY_LOCAL_MACHINE\Services\SMBServer]


"PrintSwapFile"="\\Hard Disk\\Spooler.file"

"PrintSwapMax"=dword:A00000

"PrintSwapInc"=dword:5000

2010年4月28日 星期三

Silverlight for Windows Embedded

http://msdn.microsoft.com/en-us/library/ee502198(v=WinEmbedded.60).aspx
http://geekswithblogs.net/WindowsEmbeddedCookbook/archive/2009/10/01/silverlight-for-embedded-tutorial.aspx

在Windows CE 6 R3 中加入 silverlight component

Silverlight for Windows Embedded 對應到 Silverlight 2 版本
而且 只能用C++ 來寫而非 C# or Visual Basic
而且好像不依賴 .net compact framework

大致上是
http://msdn.microsoft.com/en-us/library/ee503558.aspx

To create an application for a Windows Embedded CE powered device that is based on Silverlight, you create the XAML file that defines the UI and create a subproject. Then, use the Silverlight C++ API to initialize Silverlight, parse the XAML file into an object tree, and add event handlers to the parsed elements.

1. include some header
2. call XamlRuntimeInitialize()

詳細範例可參考
\WINCE600\PUBLIC\COMMON\OAK\DEMOS\XAMLPERF

和silverlight 差異的部份
http://msdn.microsoft.com/en-us/library/ee501848(v=WinEmbedded.60).aspx

2010年4月27日 星期二

Visual Studio 2008 Link Problem

http://msdn.microsoft.com/en-us/library/cc664727.aspx

在Visual Stdio 2008 中,要使用 #define _BIND_TO_CURRENT_VCLIBS_VERSION 1;
才會對 SP1 的Library binding 。不然的話,預設的連結方式為連結到 release version。

To show what version of libraries that lib file needs, type:
dumpbin /directives .lib
The output might contain something like:




Linker Directives

-----------------

/manifestdependency:"type='win32'

name='Microsoft.VC90.CRT'

version='9.0.21022.8'

processorArchitecture='x86'

publicKeyToken='1fc8b3b9a1e18e3b'"

/DEFAULTLIB:"MSVCRT"

/DEFAULTLIB:"OLDNAMES"



related info:
http://www.nuonsoft.com/blog/2008/10/29/binding-to-the-most-recent-visual-studio-libraries/
http://blogs.msdn.com/vcblog/archive/2008/08/12/bugs-fixed-in-mfc-in-visual-studio-2008-sp1.aspx

2010年4月26日 星期一

WaitForSingleObject thread (等待執行緒結束)

WaitForSingleObject ( threadHandle )
會等待執行緒結束

USB Timeout Related Issue

USB stick 插入和拔出的時間問題。

在USB Host Client Driver Registry Settings 有一項

[HKEY_LOCAL_MACHINE\Drivers\USB\ClientDrivers\Mass_Storage_Class\6]
MediaPollInterval:1250 ; msec
ReadSectorTimeout:2000
WriteSectorTimeout:2000
ScsiCommandTimeout:5000
UnitAttnRepeat:10

UnitAttnRepeat 是指測試 Unit 是否Ready,其測試次數。

flow:
IOCTL_DISK_READ, IOCTL_DISK_WRITE ( disk.c ) -->
ScsiRWSG --> ScsiReadWrite ( scsi2.c )  --> ScsiUnitAttention
--> ScsiTestUnitReady

如果 UnitAttnRepeat 為10的話,則 ScsiTestUnitReady 執行10次

而MediaPollInterval
則是在 disk.c 的 MediaChangeThread() 裡面會用到

2010年4月20日 星期二

German TimeZone Problem

德國的客戶有個問題,用網路存取檔案,總是會有一些時間差。懷疑是TimeZone的Problem。

的確,因為我根本還沒有處理時區的問題。

經過查證後(Use GetTimeZoneInformation() ),WINCE 5 default time zone 為 Pacific Standard Time, UTC -0800。

德國,查證 Wiki後,為 Central European Time (CET),現在(4月)為 CEST, Central European Summer Time。

CET 為 UTC + 0100, CEST 為 UTC + 0200
切換時間為 每年三月的最後一個星期日 UTC 1:00
及每年 十月的最後一個星期日 UTC 1:00

其它請參閱 SetTimeZoneInformation

註:
設定秘訣 year 為 0 ,幾月的第幾個星期格式, 5為最後
然後此函數daylight轉換的時間 為local time,要注意。

2010年4月16日 星期五

JPEG Library Study

 jpeg_write_raw_data() -->

jpeg_write_raw_data() 每次16行,也就是一個 imcu row

encode_mcu_huff() 被 call 8160 次
encode_one_block() 被 call 65280次

2010年4月13日 星期二

Warning: Image exceeds specified memory size by 9280 bytes and may not run.

When makeimg, there is the warning above.
AUTOSIZE
要修改 config.bib 或 eboot.bib

ce.bib 也是最終的 bib

WINCE 6 SD Card driver build error, PBInitEnv.bat

In AU1200 BSP, build SD Card driver has the following error!
There is no SDbus.lib.
So remove SD Card driver.
In platform.bib we want to remove BSP_SDHC_AU1X,
and it is defined in PBInitEnv.bat.

But PBInitEnv.bat is created by system.
When u setup catalog item. It will write variables to pbinitenv.bat.