星期六, 10月 28, 2006

Change to realchecko.blogspot.com

越來越不穩了。
因為這個blogger每次發佈都要reflash 整個blog,所以文章多的blog在發佈時就會越來越慢,而且常常會update失敗。

這個blog用到現在,文章好像也有1600多篇(篇數雖然多,但是長度都很段短,有一段時間還當作memo用...),所以update 失敗的次數就越來月多了..

沒辦法,只好遷移到blog-beta去,但是blog-beta還真的是beta,轉移還有些問題,所以就新開一個好了... 就是上次try blog-beta時register的 blog : http://realchecko.blogspot.com

以後都會po到那了。

有空的時候也會拿那邊的data update這裡一下。

Change HD for X32

換上命運多舛的80G HD。
換得時候看了一下 兩顆hd的spec。
原來用的是Toshiba, 1A。
新的是 是seagate 0.45A。
所以,換上去電池會撐得比較久嗎?

還有,速度會便得比較慢嗎? -- 好像有比較曼的樣子。

順便試試上次做的X32 回復光碟,果然很方便,都不用到bios設定了。
一路裝完。大約要2 hours。

星期四, 10月 26, 2006

CE : MISC Work Record : Tiny Kernel Mode ,, Test Program

在build log 中會出現:

CE_MODULES=coredll nk shell relfsd loaddbg shellcelog fsdmgr filesys toolhelp rt_tests
COREDLL_COMPONENTS=coremain lmem showerr thunks corecrt corestrw snotify coregwestub coreimmstub coresiow serdev locmini multiui full_crt crypthash rsa32
NK_COMPONENTS= nkcompr nkmapfile
FILESYS_COMPONENTS=fsheap fsmain fsreg fsysram msgqueue
可以看出NK.EXE, COREDLL.DLL, 各由哪一些 lib 組合而成,但是不知道決定dependency 的地方在哪裡。

New Platform : build 出來的platform在OS design View中會自動依照Platform-Setting - Build Option 的項目加入需要的item,所以刪除該item時,會出現一個dialog,說明同時要將 ENABLE_XXX 的item 關閉。

但是雖然OS Design View 中有該item,實際看workspace.pbxml 卻還是只有基本的item (就是有選的item),也就是說... 實際的和OS Design View 不符。

將 platform-Setting-build option 中的item 都不勾選,TinyKernel 就只有標準的nk, coredll 兩個。


  1. uncheck all "Platform - Settings - Build Options" except "FullKernelMode".
  2. uncheck "Clean befor build" and "make run-time image after build".
  3. build and sysgen
  4. modify platform.bib
    1. comment out FlashDrv.dll
    2. comment sdmmc ...
    3. comment pnashell.bib
  5. modify *.reg <- seems not need to do this


TinyKernel Test Program的位置在
PUBLIC\COMMON\OAK\tktest

在common.bib中有描述,當指定使用MODULE_TKTEST時,會將tktest.exe copy到 image中,rename成filesys.exe。

這是因為 CE 的 kernel : 寫死了 起動後 run ...
  • schedule.c : SchedInit( ) : CreateThread( ... SystemStartupFunc ...)
  • schedule.c : SystemStartupFunc : CreateKerelThread( ... RunApps ... )
  • kmisc.c : RunApps( ) : CreateProcess( ..filesys.exe... )
所以...第一個啟動的是filesys.exe (?)。
跟Linux一樣,kerel boot後,指定root filesystem, kernel 用內建node id找到後,找到裡面的init.. load, run。
所以makeimg完,用viewbin -top nk.bin 看 MODULE 只有看到filesys.exe,沒看到tktest.exe。
dir 出來看,tktest.exe 和 filesys.exe 的size一樣大。

download and Run ...
In TKTest
Page size=4096, 13426 total pages, 13402 free pages. 13401 MinFree pages (102400 MaxUsed bytes)
Event created successfully, About to set event
Look, a message from a thread
In thread, loop cnt = 0
In thread, loop cnt = 1
In thread, loop cnt = 2
In thread, loop cnt = 3
...
.成功。

很愚蠢的是 沒有單純build tktest.exe 的方法,tktest\source 中指定target是sharelib,所以build 出來會是 tktest.lib (!!)。
好像是到該folder build -c 後 sysgen ,修改platform.bib後再makeimg就可以..

這樣啟動的kernel,因為filesystem 沒有啟動,所以registry 都沒有用。

the 1st Process launched by nk.exe

SchedInit( ) OpenExecutable ("nk.exe").. in nk.exe..

Kernel 的sheduler好像是在 NK\KERNEL\scheduler.c 中的 SystemStartupFunc ( )

  1. 在pROM 結構中找到sharedll 區域的位置
  2. Alloc Memory
  3. Load coredll.dll
  4. 在load 到memory 的coredll.dll 中找到需要的一些function pointer ( 用 function index的方法 )。
  5. Create Kernel need synchronize object - event, critical section..
  6. CreateThread : PowerHandlerGuardThrd,
  7. Load shimeng.dll
  8. CreateThread : CleanDirtyPagesThread
  9. CreateThread : RunApp
  10. Endless While - Wait Alarm (Time limit - oneday), give CleanDirtyPages a chance to run.
RunApp 在 kmisc.c
  1. CreateProcess : filesys.exe <-- this is the very 1st process Lives after nk.exe

New Platform - why I have somthing I don't want ?

New Platform

問題:每次New Platform 一個新的platform ,結果出來的OSDesign View Item 好像都不一樣。

回答:

這是因為 Platform Builder很自動(多事?)的幫你加入一些item 的關係(即使你選了"custom"也一樣)。

在platform builder中使用New Platform Create一個platform 時,第一個動作: "BSP"。
在選定BSP後,Platform builder會參考該BSP下的bat檔 (platform\<your_platform>\<your_platform>.bat),執行他,所以該BAT檔中所有設定的環境變數,都會在接下來的操作中繼承。

舉例來說:在 <your_platform>.bat中設定了SYSGEN_BINFS=1,則接下來Platform Builder就會自動在New Platform 中加入 Binary File System 這一個component (將游標移掉Catalog item 上, platform builder會顯示出該item 對應的SYSGEN_VAR)。即使你在接下來的各item 選擇中都沒有加入該item (Custom ),最後那一個item 還是會被 加入。

New Platform 完成後,在Workspace的OSD View中就可以看到被自動加入的item,如果去delete他,會有warning dialog出現,請你刪除掉 " SYSGEN_XX" 環境變數。

反過來說,當自己create一個platform時,可以藉由定義SYSGEN_XXX的方式來強制使用該BSP的設計加入需要的item。

另外Platform Setting 中build option 也會影響到被加入的item,可以在New Platform 的最後一步 "modify building options without leaving the dialog" 按下這個link,將不要的build option 拿掉,這樣最後Create出來的platform 才會包含你需要的item (不會被自動加入其他的item )。

CE 的Build Phase

一般的software , os run time image的 build 動作,不外乎是..

  1. config, generate heder and defines
  2. compile
  3. link
  4. relocate resource and exe files
  5. combine all to rom image
但是CE platform build卻看不出這幾個動作..

首先,這一篇(要用IE 或IE Tab來看,因為裡面的圖用了IE特殊的script )有說明build phase. 出乎意外的是:
  1. Compile
  2. Sysgen
  3. Release Copy
  4. Make run-time image
Compile在sysgen之前。

文章的圖對於各build tool 之間的關係說得很仔細:

所以blddemo.bat 是最大的batch program,做了所有的事。依據呼叫cebuild.bat, buildrel.bat 和makeimg.exe。

cebuild.bat 作 上面.. 1.Compile 和 2.sysgen 的動作。

所以sysgen 並沒有compile 囉?


blddemo.bat 可以有以下使用法:
blddemo [clean | noclean] [rel | norel] [-q | -qbsp] [Cebuild.bat parameters]
clean, noclean - clean 的目標是指%_PROJECTROOT%\Cesysgen 和 %_PLATFORMROOT%\Cesysgen。
當有修改 %_WINCEROOT%\Public\CEBASE\OAK\Misc\Cesysgen.bat 時,才需要clean。
含有environment variable 中,以SYSGEN 和BSP 開頭的變數有變更時,也需要clean。

rel, norel - norel 大概是指要不要自動將 compile完的file copy 到release folder,及之後的動作(makeimg)。

-q - 這是pass給cebuild.bat 的參數, -qbsp 是告訴cebuild 只要build plaform folder以下的source。 -q 是說 ? 有點conflict.. 好像說,所有source 和sysgen 變數都沒有改變。

cebuild.bat parameters - 是任何呼叫cebuild.bat 時傳遞的參數。


在command line 使用blddemo.bat 來build image的話,可以先設定好環境變數:
set BLDDEMO_MI_LOG=1
這樣blddemo.bat會在目前目錄下產生
  • Makeimg.out : makeimg.bat 的log
  • SysgenSettings.out : sysgen 在做完dependency check 後的setting.

Cebuild.bat
  1. 在%_WINCEROOT%\Public\ 中,所有env var : _DEPTREES 中所包含的 folder name,一一的到該目錄下執行 build.exe 來compile source code。
  2. 對每一個_DEPTREES 中包含的item XXX,執行 Sysgen.bat -p XXX 。
    Sysgen.bat 將會 還會依照cesysgen.bat 產生的module 需求,buid module。
    Sysgen.bat 還會build %PROJECTROOT%\Oak\Misc 下的module。
  3. 到%_PLATFORMROOT%\%_TGTPLAT% 作build.exe,compile hardware platform的module
猜測Build 作compile, sysgen 才作link。
為此,使用Cebuild.bat時,可以加上 " -q " 叫cebuild.bat不要呼叫build.exe將source code重新compile,直接叫sysgen 重新link就好。

Sysgen.bat

真的是作link的動作...

sysgen.bat 將Cesysgen.bat中指定的所有module,用nmake.exe將各個lib link起來。
  1. sysgen.bat 到%_PROJECTROOT%\Oak\Misc中參考Cesysgen.bat,設定好適當的envvar。
  2. 參考 %_WINCEROOT%\Public\Common\Cesysgen 下的makefile,如果有-p option時,則follow -p option 指定的 Project ,參考 %_WINCEROOT%\PBWorkspaces\<Project Name%gt;\Cestsgen 下的makefile。參考這些makefile,作以下..
    1. Create Target system directory
    2. 將Cesysgen.bat中指定的 .lib link 起來
    3. Call Res2res.exe, 將所有resource file 合併起來
    4. call Cefilter.exe 處理 CE header file 和其他source file,
      CE header file 中有些comment 被用來作condition statement : @CESYSGEN。
      利用這些condition statement,可以讓Cefilter變更處理的動作。
    5. Cefilter.exe處理%_COMMONPUBROOT%以下四個folder中的file,並且output到 %PROJECTROOT%\Cesysgen\的對應位置:
      1. \Sdk\Inc\*.* ==>\Sdk\Inc
      2. \Oak\Inc\*.* ==>\Oak\Inc
      3. \Ddk\Inc\*.* ==>\Ddk\Inc
      4. \Oak\Files\Common\*.* ==> \Oak\Files
    6. Copy modules 到target directory
  3. Sysgen.bat會將Error輸出log到%_WINCEROOT%\Build.log中
stsgen   [-c] [-p Tree] [NmakeTarget] [NmakeTarget] ...
-c : Run Nmake.exe時, 加上clean 參數
-p Tree : 對 Tree 作sysgen,當沒有指定時,對common project 作 (?)
NmakeTarget : 指定build Target module就好,當沒有指定時,sysgen 對所有Cesysgen.bat中列出的module作sysgen。
 sysgen -p wceshell
這個動作指示sysgen build/link wceshell module,並且copy 到 target folder

Cesysgen.bat
?

簡單的說:
  • build.exe 是compile,但是build.exe產生的是lib (也是就ar 起來的一堆obj)
  • sysgen 是link,依照cesysgen.bat 的內容將各 lib link成target : exe, dll
  • resource arrangement - 略
  • makeimge : 依照binary image script (*.bib) 將各exe, dll , res,... 合併成一個image。
以上整個動作可以由blddemo.bat完成。

星期三, 10月 25, 2006

CE : Register an INT handler - Thread

Interrupt Handling Process..
用Thread來作

  1. Create an Event
  2. Associate this Event to specific INT
  3. while loop - WaitForSingleObject

讓event 和INT關聯起來的方法: IOCTL_HAL_REQUEST_SYSINTR
argument:
  • lpInBuf : 要"觀照"的 IRQ - 例如...EXT_INT0
  • lpOutBuf : 取得的ID
之後再用 InterruptInitialize ( ) 把剛拿到的ID和Event關聯在一起(跟kernel 註冊)。

但是不知道 .. INT ... sispatch .. int handler .. event .. waitObject thread.. 這個flow 的code再哪裡。

CE : MISC Work Record : Tiny Kernel Mode ,, Test Program

在build log 中會出現:

CE_MODULES=coredll nk shell relfsd loaddbg shellcelog fsdmgr filesys toolhelp rt_tests
COREDLL_COMPONENTS=coremain lmem showerr thunks corecrt corestrw snotify coregwestub coreimmstub coresiow serdev locmini multiui full_crt crypthash rsa32
NK_COMPONENTS= nkcompr nkmapfile
FILESYS_COMPONENTS=fsheap fsmain fsreg fsysram msgqueue
可以看出NK.EXE, COREDLL.DLL, 各由哪一些 lib 組合而成,但是不知道決定dependency 的地方在哪裡。

New Platform : build 出來的platform在OS design View中會自動依照Platform-Setting - Build Option 的項目加入需要的item,所以刪除該item時,會出現一個dialog,說明同時要將 ENABLE_XXX 的item 關閉。

但是雖然OS Design View 中有該item,實際看workspace.pbxml 卻還是只有基本的item (就是有選的item),也就是說... 實際的和OS Design View 不符。

將 platform-Setting-build option 中的item 都不勾選,TinyKernel 就只有標準的nk, coredll 兩個。


  1. uncheck all "Platform - Settings - Build Options" except "FullKernelMode".
  2. uncheck "Clean befor build" and "make run-time image after build".
  3. build and sysgen
  4. modify platform.bib
    1. comment out FlashDrv.dll
    2. comment sdmmc ...
    3. comment pnashell.bib
  5. modify *.reg <- seems not need to do this


TinyKernel Test Program的位置在
PUBLIC\COMMON\OAK\tktest

在common.bib中有描述,當指定使用MODULE_TKTEST時,會將tktest.exe copy到 image中,rename成filesys.exe。

這是因為 CE 的 kernel : 寫死了 起動後 run ...
  • schedule.c : SchedInit( ) : CreateThread( ... SystemStartupFunc ...)
  • schedule.c : SystemStartupFunc : CreateKerelThread( ... RunApps ... )
  • kmisc.c : RunApps( ) : CreateProcess( ..filesys.exe... )
所以...第一個啟動的是filesys.exe (?)。
跟Linux一樣,kerel boot後,指定root filesystem, kernel 用內建node id找到後,找到裡面的init.. load, run。
所以makeimg完,用viewbin -top nk.bin 看 MODULE 只有看到filesys.exe,沒看到tktest.exe。
dir 出來看,tktest.exe 和 filesys.exe 的size一樣大。

download and Run ...
In TKTest
Page size=4096, 13426 total pages, 13402 free pages. 13401 MinFree pages (102400 MaxUsed bytes)
Event created successfully, About to set event
Look, a message from a thread
In thread, loop cnt = 0
In thread, loop cnt = 1
In thread, loop cnt = 2
In thread, loop cnt = 3
...
.成功。

很愚蠢的是 沒有單純build tktest.exe 的方法,tktest\source 中指定target是sharelib,所以build 出來會是 tktest.lib (!!)。
好像是到該folder build -c 後 sysgen ,修改platform.bib後再makeimg就可以..

這樣啟動的kernel,因為filesystem 沒有啟動,所以registry 都沒有用。

星期日, 10月 22, 2006

CE book Notes : Process and IPC objects

以下是"Building Powerful Platform with Windows CE"的筆記..



和大部分的Realtime OS一樣...

Program ,Process,Thread

在Storage中,還沒活化(也就是說,還沒有依照program header alloc memory, 給他用,還沒將run-time 環境設好的狀態)。叫Program。
Program活化後,就叫Process,Process有自己的memory space,OS 用virtual memory的方式為每個process提供自己的memory space,並且保護不讓彼此影響,也不會影響到OS。
Thread是OS scheduler的排程單位,每個Process都是自己的"Pimary Thread",當然,可以create 多個Thread,方便設計,同一個Process的Thread都和share同一個memory space,所以可以互相access彼此宣告的變數。

Thread可以run在kernel mode或是user mode,這是由CE kernel決定的,一般ISR thread會run在kernel mode,其他就run在user mode,kernel mode的thread可以access所有kernel resource,所以也可以crash kernel。

在kernel mode執行的thread 效能會比較好一點,因為減少了access right check的時間。所以如果你很勇敢的話,可以啟動"full kernel mode"選項,讓所有的process (thread) 都run在kernel mode。


Process是用CreateProcess( )來啟動,argument是Process的對應program name,可以在argument中直接指定program所在的path,不然kernel會依照 "WINDOWS", "\","PPSHELL","."。OEM 可以在registry : HKEY_LOCAL_MACHINE\Loader\SystemPath 中寫入search path string。

Thread用CreateThread( )來啟動,argument是thread的function address (pointer),還有一個argument是用來傳遞給這個thread的working space,通常是一個structure。Thread可以啟動在suspend mode,然後用ResumeThread 恢富工作。


Schedler

CE的schedule是preemptive,priority, time-slice base。預設的tread quantum是100ms,OEM可以在kernel 啟動時設定自己要的thread quantum。

每個thread可以有0-255 的priority,0是最高的priority。當有很多thread是相同的priority時,scheduler採用round robin的方式。


Synchronization

和其他RTOS一樣,CE也有Mutex,Semaphore,Events,Critical Section用於IPC的object。每個object在使用前都要用create來取得一個handle作溝通用。thread可以用WaitForSingleObject 或是WaitForMultipleObject 來wait(取得)單一或多個IPC object。
所以syhchronization object的用法通常是宣告一個global variable 的object handle,在還沒使用前create他,然後各thread用這個global variable來操作。

Mutex 就是簡單的互斥物件,CE為了防止programmera acqure到一個mutex後還沒release就又acquire他,設計成"acquire一個已經擁有的mutex時,會馬上return,不會被block..。

Semaphore 可以看作是counting mutex,在create semaphore時可以決定他的available number是多少(32 bit int)。

Events是用來"通知"的object,一個thread可以signle 一個event,讓wait 這個event的thread知道該事件已經發生。CE的設計是:當有多個thread都在wait同一個event,只有第一個wait這個event的thread會return。

Critical Section 用EnterCriticalSection和LeaveCriticalSection來形成一個不會被swap out 的code section。(但是不清楚ISR會不會也被disable)。


Communication between Process


剛剛講的都是Thread之間的IPC,因為同一個process的thread都在同一個memory space,所以可以用共用變數來傳遞IPC object handle。但是在Process間就不能這樣用了,因為Process間有OS的virtual memory 隔開,不互相存取對方的變數。所以Process間的IPC就要用其他的方法。

CE利用Windows Message作為Process間同步的機制,一樣,要使用前,必須要用RegisterWindowsMessage向kernel 索取一個沒有人用的message id,然後用這個message來傳遞資料給其他Process (那其他Process怎麼會知道他要對哪一個Message ID反應?)。

傳遞message時,可以同時包含兩個參數: lParam, wParam。都是DWORD,這也就代表只能傳遞 8 bytes的資料,如果要傳更大的資料,就要先用structure包裝好,然後將structure pointer放在lParam中,但是因為Process間的virtual memory mapping是不同的,所以光傳address過去,對方也取不到你的memory 資料。為此,要使用WM_COPYDATA這一個message來傳遞參數才行,這個message的lParam是COPYDATASTRUCT型別,包含一個pointer和一個size,kernel會負責將size的資料copy到對方的空間。這樣的需求(kernel幫忙處理),就要用SendMessage這一個function來傳遞WM_COPYDATA,讓kernel在將message交到reciver process前,先將data copy好。

身份證字號?

購物網站PayEasy 的login帳號竟然是身份證字號,光是註冊資料要求身份證字號的 就已經很誇張了。
竟然還有直接用身份證字號作login name的!

大概PayEasy的客戶群的關係,使用身份證字號對PayEasy的客戶群來說,反而是比較方便的方法(不用記login name,,)。

反過來想,會考慮到將身份證資料提供給網站所存在的危險性,這樣的人,可能也不會被PayEasy的商品吸引,所以PayEasy也沒必要為這些人考慮,去設計其他比較安全放心的註冊方式。

星期五, 10月 20, 2006

可以直接作還原光碟了 - X32

這裡 (lenovo China) 看到的, X32不用再到hpa - F3-F11, 下command FWBACUP XXXX 才能做出HPA的備份光碟了。

現在 在Windows 中就內建 "建立恢復光碟",所以可以直接燒錄DVD/CD囉!
(這是X32才有的喔,X31, X30 都沒有 ... 難道是因為X32 才會常常用到"恢復光碟" ? )

等我寄回送修的HD拿到後再來試試... (希望銀箭線上會寄一個良品回來給我..)。

CE : QFE on "PRIVATE" source code.

CE 5.0 Product Update Rollup 2005 中有...
041028_KB887702 - This is an update to the private source code files that will allow to rebuild the kernel for debugging purposes.

The file(s) with the new public source code changes for this component can be found in the directory %_WINCEROOT%\:

private\winceos\coreos\core\acl\accchk.c
private\winceos\coreos\inc\gweapiset1.hpp
private\winceos\coreos\inc\kmodeentries.hpp
這個大概就是news groupe 中提到的吧,
這個QFE是在"年度" update中。

星期四, 10月 19, 2006

some feeling about .. C & L

搞了一陣子,終於有點了解CE的結構和code directory 安排方式。

感想:....

即使原來是很好的結構(其實我並不覺得architecture有比較好),
但是為了要做到"某些 source code要隱藏","某些source code 讓客戶修改",
所以還要特別將明明就是同一個模組的code拆開成兩個lib, obj,
然後明明是同一個module的code,還不能放在一起,要放在很遠的地方,
這樣,
導致module, source dependency 一團混亂,makefile 和 config 也一團亂,
所以沒辦法真的 在build的時候follow source, header dependancy...
所以還特地設計build tool,能夠盡量正確的follow到dependency...
但是,
結果還是一團混亂,build的process非常不清楚。
導致 user無法確定自己的修改到底有沒有 compile, link進去 (所以,為求保險,都enable "clean before build")導致build時間超長...
這樣就好像最近很有名的"有名大站"一樣,工程師 花時間在"內嵌一個讓人無法block掉的廣告"的技術上,而不是在增加服務品質(嗯,和資料保全上),所以 就算 他真的是一個很好的服務商,也被這些東西稿得一團亂。
所以我覺得wince 6.0 將原來kernel + oal 合在一個exe的設計,拆成kernel 和oal 兩個exe,然後用"插銷"讓兩個exe除傳送需要的"function table"給對方,這樣的設計,其實是為了 方便將kernel.exe的source code整個隱藏起來,不會像 5.0 一樣,因為oal 要讓custom設計而導致kernel 的大部分module都要release出來。

嗯,為甚麼要花這麼多時間在"隱藏"上?把原來很好的架構 攪得五馬分屍,
(CE的設計者看到他的設計被搞成這樣應該傷心吧..)

這樣有點了解到open source 為甚麼進步得比較快,為甚麼source code的品質比較好.....
因為programmer不用花時間這些無聊的事情上呀,完全依照功能需求來寫code,
不必為了這些狗屁到灶的事情傷腦筋....





很明顯的,這一篇是"純抱怨"....... :P

捉迷藏 : nk.exe nk.lib kern.exe..

build and sysgen BSP .. 將log copy 下來用ultra editor 打開 -- 目的是要find "nk.exe",發現..
makeimg 時有:
Copying C:\WINCE500\PBWorkspaces\CoreOS2440\RelDir\smdk2440a_ARMV4I_Release\kern.exe to
C:\WINCE500\PBWorkspaces\CoreOS2440\RelDir\smdk2440a_ARMV4I_Release\nk.exe for debugger
所以實際上nk.exe就是kern.exe (?)。
難怪找不到kern.exe..因為被rename掉。

nk.exe 的build sources file 在 platform\<your platform>\Src\Kernel\Kern\sources

但是指定要link oal.lib 和 nk.lib

oal.lib 就在同目錄的oal folder。

newsgroupe ( http://groups.google.com.tw/group/microsoft.public.windowsce.platbuilder/
browse_thread/thread/4eb1eee943701dc1/68f759ac9fc8049d?lnk=st&amp;amp;amp;amp;q=
nk.lib+nkmain.lib&rnum=1&hl=zh-TW#68f759ac9fc8049d )說:
nk.lib= nkmain.lib + nkcomp.lib+nomapfile.lib 
有些private folder的source code到最近才release,所以要install QFE ( http://www.microsoft.com/downloads/results.aspx?productId=&amp;amp;amp;amp;CategoryID=
&freetext=ce+update&DisplayLang=en&DisplayEnglishAlso=&sortCriteria=date&startDate=
&amp;amp;amp;amp;period=0&type=&nr=20 )

網路上只有這一篇成功build出nk.lib,其他都是說明由於MS release source 不全,所以沒辦法build nk.lib。

一陣惡搞之後,的確已經build出modified kernel image ( 從debug message 可以看到.. ),但是已經忘了是怎麼弄出來的 (因為build 一次最少要40 min,最多要 2 hours )。

大概紀錄一下:
  • private 內的source 大部分是 *.lib,最後會放在 PUBLIC\COMMON\OAK\LIB中,讓其他project link.
  • nk.exe from kern.exe, kern.exe 的 sources (makefile 描述檔)在platform\smdk2440\src\kern

從頭開始:
  1. restore WINCE500
  2. disable multixip, active configuration = release, build and sysgen current BSP
    Error : don't know how to make fal.lib.
  3. 改 Build and sysgen .
成功!也就是..
  1. 先到 private\src\ ... nk 下 作" build -c"
  2. 到public\common\oask\...\lib 去看 nkmain.lib 的time tag對不對
  3. build and sysgen ....then wait.
但是在log中還是看不到哪裡build 出nk.lib...所以沒辦法只build nk.lib.

但是我是要build device.exe ... @_@.

星期二, 10月 17, 2006

X32 arrived

X32 收到 (其實是昨天收到的),就是pchome的29900 (雖然抱怨這麼多,還是繼續光顧)。
就和大多數人一樣(真的很多人喔),當初也煩惱是要X60還是X32,而TPUSER論壇在當時也很巧的un-available一下,所以只好靠著少少的資訊,最後還是選了X32 (因為沒$$)。

結果,X32的缺點還蠻多的呢:
  • pcmcia card 的上緣會斷
  • Fn- F5 會失效
  • LCD 顏色不準
  • 鍵盤不夠好
  • 一下子就很熱
  • ...

但是用起來還是不錯,比R40e, 570 都好。 現在就希望他能好好服役一陣子,不要太快壞 (雖然這台有3年保固,要去換還是很麻煩的)。

拿到機器,IBM 的啟動完成後,第一步...竟然是 download windows update... 十多項..
天哪!8月生產的機器,10月就要上十多項的update !!

然後..download firefox. 酷音...

yeh ! 使用Benq的外接DVD可以開機。

開始測試battery life - 開啟wifi, lcd 亮度1格,一般web browsing... msn..
... 9:18 開始。 5:43 left.
... 10:32 2:43 left 76%.
... 10:55 2:13 left 65%.

Jserv 的 orz microkernel . part I

收到Jserv 的Orz microkernel 了..Lucky :)

因為現在用的pc等級實在太低,光是run 起PlatformBuilder 就loading 過重,所以沒辦法再run qemu 和install build environment,只好先看一下code...



果然是簡潔有力,雖然全部都是用assembly 寫的,但是一點也不影響可讀性 (這就是長年在open source 社群中Coding的習慣?)。

source code的安排也很清楚,依照功能與階層相依性安排folder。

連bootloader, shell, sample appliction 都有 (這真的 都是在端午節下午完成的 ?)

具體而微的OS,沒有多餘的code,因為microkernel 的架構,讓interface切得很清楚。

從這個開始學OS真是再好不過了。


kernel : 整個kernel 在main.asm 中安排得很好:
  • 先是16 bit code, load GDT, IDT, 進入protect mode.
  • 32 bit mode, configure and enable timer.
  • create system service proram - 這些service 都是application喔,不是直接link到kernel image,而是build好,成execution image 後放入kernel 的data block。所以跟一般user application 的地位是相同的。
  • 進入scheduler,完成。
kernel 中,Create Task 時要AllocPage 要求一塊記憶體,這個MM模組就不屬於 service module,而是和kernel link在一起。

kernel 中,Task 模組提供 Create, Kill 和Scheduler 的function.

以上兩部份是 microkernel 的 process 和 memory management,剩下一個microkernel 要有的功能就是 IPC: 這部份 orz microkernel 用message來作,message用 x86 的軟體中斷來提供,從0x30 開始,這部份的INT handler 在kernel boot時,load IDT時就將INT handler都設定好了。

Message Service 有
  • Get Message
  • Send Message
  • Process Message
  • Remove Message
  • Answer Message
Message中的reveiver Task 決定是由kernel (ID=0)還是 service module 來接收這個message。


所以這個kernel 真的是 pure microkernel 呢。



雖然很小,但是包含的東西有好多好多:execution file format, loader, file system(?), shell...先寫到這邊,接著再來看 keyboard interrupt 到 keyboard service module 的path ....

CE : build debug IMAGE

將eboot (整個bootloader) 從 Src/dirs 中刪掉後,已經可以build出debug 的image 了。
但是:
SIZE....
  • Release : 16M
  • Debug : 33M
放不進 Flash 里 @_@

只好啟動XIP了... (但是XIP /None XIP 省的是 exeution RAM space,不是Flash size 吧..)。

應該是放不進RAM才對,因為用的是signle block, 整個image都要load到ram中來run的方式。

XIP build Fail - size exceed the entry address.

只好刪除driver了.. 留下LCD, Backlight 和 power button. 改回 single bin block。

一樣,33,920,403 bytes.

刪除 .net 試試 - 從IDE的Workspace中 remove - IDE整個當掉,workspace中的catalog window 不見 :P

星期一, 10月 16, 2006

要自己寄回去.....真倒楣...下次不要買這家..

真的是超級麻煩...
請您將問題商品妥善包裝後,郵局掛號寄回廠商處作更換。請記得一定要註明您的姓名、訂單號碼、電話、地址及故障原因,感謝您的協助。廠商會再退回郵資給您,請您放心。

廠商資料如下─
廠商名稱:銀箭資訊股份有限公司
這次買的HD拿到壞品,竟然要自己掛號寄回...郵資是小事,上班時間要怎麼去郵局呀?

所以下次買pc home的東西要小心,這一家"銀箭資訊" (注意 注音要選字喔)的,是要自己寄回的。跟其他 會叫快遞來收的不一樣。...上次那個hd box不到1000,也是快遞來收的呀,這次這個2600竟然還要自己寄。..真是!

CE : about Shared Source Code ("PRIVATE" folder)

關於source code,誤會了CE,因為CE 也幾乎提供的所有的source code (只是build 的動作太不清楚)。

CE將Code分為兩部份 - Public and Private,Private的部份是需要另外的 license。Public 的地方可以任意修改。

Private 的部份又稱作"Shared Source Code" (因為要簽署Shared Source Code Agreement),放在"PRIVATE" folder李。

安裝時,安裝了所有source的人,private (shared) source code可以當作是public的部份一般,可以用IDE在code中設break point,觀察call stack,也就是說,可以作source debugging。
-- 參考 這裡 http://msdn.microsoft.com/library/default.asp?url=
/library/en-us/wceosdev5/html/wce50condebuggingsharedsourcecode.asp

MS允許你利用shared source了解和修改CE kernel,但是不允許你使用修改過的shared source 出貨。
所以在你修改shared source之前,要先將所有shared source 和library備份起來。
(? lib ? 所以並不是所有source都有release..)。
被分的方法是用 command line tool : CeBackup Tool.
-- 參考 這 http://msdn.microsoft.com/library/default.asp?url=
/library/en-us/wceosdev5/html/wce50concreatingabackupofthesourcecodefiles.asp

備份source code:
  1. 就是單純的把你要修改的code的folder整個copy到另外的folder中 (以後copy回來覆蓋就OK)。
備份 *.lib
  1. "Open Release Directory" 出現command console。
  2. 輸入
    cebackup backup
    將會backup public, private ... WINROOT下所有的*.lib。
Restor 呢?
  1. Source Code部份就是把folder copy回來就OK。
  2. *.lib部份,一樣,"open release directory"在console中輸入
    cebackup restore
  3. 確認IDE中"Copy Files to Release Directory After Build" 和 "Make Run-time Image" 都要check。
  4. "Build and Sysgen"
如果沒有備份到source code,可以..
  1. To differentiate between modified and original files, use Windows File Explorer to sort by date. Modified files have a more recent date than original files.

  2. Run the Windows CE Setup Wizard.
  3. From the Program Maintenance dialog box, choose Repair.

    This action reinstalls the files you deleted.

  4. From the Build OS menu, verify that Copy Files to Release Directory After Build and Make Run-Time Image After Build are selected.
  5. From the Build OS menu, choose Build and Sysgen.

    This action rebuilds your run-time image with the original files. Your run-time image will no longer contain your modified files.


--參考 這裡 http://msdn.microsoft.com/library/default.asp?url=
/library/en-us/wcepbguide5/html/wce50conCeBackupTool.asp
--參考 這裡 http://msdn.microsoft.com/library/default.asp?url=
/library/en-us/wceosdev5/html/wce50conrestoringtheoriginalbinaryfiles.asp


有列出一些command argument,可以備份某個folder,如果整個 WINROOT的 *.lib都要備份,會用掉20G (??) ,,, 所以要作之前最好先看一下這一份reference。


最重要的部份 : 用修改過的Shared Source Code build你的Image :
http://msdn.microsoft.com/library/default.asp?url=
/library/en-us/wceosdev5/html/wce50conbuildingaplatformusingmodifiedsharedsourcecode.asp

重點好像是 只能build "debug" version,所以Active Configuration 要設debug,否則build不出來。(大概又是沒有release 的library 用debug build的關係...)

還有說明不是所有的Private folder都可以build,在 這裡 可以一層一層的去check 哪一個folder 可以build。
( http://msdn.microsoft.com/library/default.asp?url=
/library/en-us/wcepbguide5/html/wce50conSharedSourceCodeDirectories.asp )

Build的步驟:
  • Open Workspace,Build OS - Set Active Configuration - 選 debug,這樣才會去build share 的source code。
  • 確認"Build OS" 中的 "Copy Files to Release Directory After Build" 和 "Make Run-Time Image After Build" 都有選。
  • 選 "Build OS - Sysgen",開始build image,這是未修改前的base line。可以用來backup用。
  • 備份:
    將整個"Private" folder copy下來備份。
    用CeBackup 備份所有library。
  • 可以修改private 下的code了。


build shared source code一定不會很順利,看 這篇 : build shared source 時當機怎麼辦 ?
http://support.microsoft.com/kb/887702

星期日, 10月 15, 2006

Scatchbox : 讓cross-compile的動作變成native.

一樣,從hemi上看到jserv摘的,所以到原網站看一下,真是不錯的東西,TS看到應該會很高興吧。
一般作embedded system的人要作:
  • install cross -tools
  • cross compile library
  • cross compile application
tool install 還好,因為target不多,而且大部分都有人已經做好package 了,apt-get或是tar一下,follow 一般application 安裝步驟就可以做得很好。

library 也差不多,常用的library 也都可以職些安裝,有些甚至在安裝cross tool 時,就會一併把library都build好。

所以,作embedded system 花最多時間的就是在 cross compile自己需要的application上。

一般都是這樣:
  • 找自己要的applicaion,download source
  • run config 產生make file
  • 修改makefile ,讓他改用cross compile和target的environment
  • test build -- 如果不成功,修改makefile,直到build ok為止
  • 拿到 target system上run,看看跟library link得怎麼樣,需要的/etc 設定當是否OK
其中改makefile那一段真是花時間呀。常常都會希望能像native build一樣,run "make config" 就ㄎ可以自動將makefile中各項參數config好。

Scratchbox 這個專案就是這個用途,他是用chroot的方式,模擬出一個target system的環境,所以在裡面 autoconfig的detect function都可以正確使用,detect出target system的參數i。

Scratchbox中build target 的application,就像native build一樣簡單了。

新的microkernel approach 和benchmark 文章

在hemi看到jserv摘這一篇,所以看看。還真是不錯。說得非常仔細。
( http://os.inf.tu-dresden.de/pubs/sosp97/) The Performance of µ-Kernel-Based Systems
先是說明一下micro kernel的歷史.
第一代的u-kernel :Chorus, Mach。
第二代的 : L-4, QNX。

古老 u-kernel為人詬病之處就是效能,但是第二代的u-kenrl已經很不錯了。

所謂的 "pure" u-kernel 就是說,kernel 只提供
  • address space
  • threads
  • IPC
其他部份都交由user space的sevice application提供。

這篇文章將Linux porting到L4 上,並且調整一些server,看看實做一些到L4內,和增加一些是當的user space server 對於效能有甚麼影響。

這個porting,讓Linux Kernel 算是L4 的一個User Process (簡單的說,是一個Pager - 記憶體管理程式)。原Linux上的user program也算是L 4的user process。

這個porting 目的要保持所有ABI一致,同時說明,由於Linux source code的高度模組化,所以可以把porting到L4的動作當作是porting到另一個hardware architecture,所以只需要更動hardware dependent part (就是source code中的arch folder..)。

文章說明的東西很多:
  • L4
  • Linux
  • Linux on L 4
  • Linux on L4 的各項實做:kernel service, interrupt, user process, System call, Signaling, Scheduling, Tagged TLB, Dual Space Mistake (?),
解說了這麼多,最後說明完成的Linux on L4 完全維持binary compatibility。

接下來作調整和benchmark..
  • 先作基本的benchmark
  • 把Linux 中的pipe和RPC改為L4 中的IPC作法
  • 將Virtual Memory Operation 由Linux Server中分離出來,成為一個獨立的user space server。
最後... 這樣的micro kernel 是否可用呢....

拿來作backup的Eponym 要停止免費服務了

今天收到這封信:
Starting November 1st Eponym will start providing a free 30 day trial blog and will be discontinuing our free blog package. For those of you who are using our free blog package, you will be automatically moved to the free 30 day trial package on November 1st. At the end of the 30 day trial (November 30th), your blog will need to be upgraded for your blog to remain active.

If you wish to keep your blog active, please go to https://secure.eponym.com/upgrade/ to upgrade.

It was a hard decision for us to stop offering the free blog package, however there were two major factors that influenced us. First, we did not like having to put advertisements on people's blogs. We know that our users would put up with the ads to have a free blog, but we don't want you to have to “put up” with anything, especially an invasive and annoying ad on your blog that you can't control. Second, the advertising revenue from the free blogs that we did receive was not nearly enough to cover the costs of providing the free blogs. Looking at these two reasons, we knew that we had to make a change to keep Eponym going strong.

We apologize for the inconvenience that this causes for some of you, but we feel that it is absolutely necessary for us to continue to provide the best blogging service, software, and community on the Internet.

Thank you for using Eponym!
也就是說,拿來作backup的bloghost : Eponym 要收費了。

大概也猜得到,因為用沒多久就開始限制流量,然後又這個的,又那個的。
現在終於...宣佈停止免費的服務,所以。那個blog就要被刪掉囉。

這也是很奇怪的事,另一個blog backup的的方式 MSN Live Space (因為Eponym 和 MSN Live Space都支援 mail to blog),兩個site的文章是一模一樣,但是在Eponym的流量就大得多(很多)`知道是甚麼原因。
(難怪有這麼多人死命的就是要待在無名)

剛發現 這個: http://checko.beeplog.com/ 也支援mail to blog,那就轉換到這吧。

星期六, 10月 14, 2006

又拿到壞品 : pchome Seagate 80GB 2.5吋 NB硬碟

為了ThinkPad R40e買的,80G。2666。

結果一裝上只有detect到34.14G (奇怪的數字)。不管,用HPA 開始retore... 兩次..都沒成功。
改用spfdisk來看,partition根本沒切出來。spfdisk也只有顯示 34.14G。

放棄,用usb外接何來接..XP直接出現"無法辨識的USB裝置"。

這個HD大概是掛了吧,因為R40e用80G用得很OK呀。
usb 外接盒接過120G的也OK。
所以應該是這個HD的問題吧。

這是第二次在pc home買到不良品了。

害我浪費一下午。

星期四, 10月 12, 2006

CE : Memory, Storage... XIP, Process ...

這一篇: System Memory Management in Windows CE.NET
( http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/dncenet/html/systemmemorymgmtwince.asp)
的筆記

這一篇說明CE的Memory, Filesystem 觀念,所有第一次作CE的人都應該要看這個。
然後配合 CE的HELP : ms-help://MS.WindowsCE.500/wcecoreos5/html/wce50conMemoryArchitecture.htm

... 我是指..有作過Embedded Linux的人.....


可以作成" Relocatable" 和 "XIP" (execution in place, none-relocatable)。

relocatable :

OS loader自行選定要將code load到哪裡。
好處 : RAM由OS管理,比較有效率。也不用麻煩決定memory layout。
缺點 : load program 時需要花比較多時間。

XIP:

code只能在build時指定的位址執行,所以需要在SRAM 方式的memory interface device中。
好處 : ?可以直接在NORFLASH中執行,省DRAM。
缺點 : ?

要決定使用哪一種,要了解CE工具中安排binary file的ROMIMAGE.EXE和 *.bib 的內容格式。

利用 壓縮與指定執行時期位址的方式,可以分別將OS中各component指定為relocatable或XIP。

要放到flash中的資料可以是少用到的module,並且可以利用壓縮來檢少需要的空間。
設定為壓縮,也就等於是指定這部份的code會在RAM中執行。

*.BIB

BIB檔由三個部份組成:MEMORY, MODULES, FILES.

MEMORY

通常在CONFIG.BIB中,每個bspc會有自己的config.bib。
NK  80001000 01FFF000 RAMMAGE
RAM 82000000 01DB0000 RAM
其中RAMIMAGE這個region是要romimage.exe將所有executables, modules, data 檔和compress section 放在這裡,而且給定virtual address 018000.1000 - 0x81FF.FFF的區域。這塊區域可以是在RAM或NORFLASH中。
RAM這個region是給CE Kernel用的,所有file system, object store, heaps, stacks, memory mapped file, writable data sections 都放在這個區域中,同時給定virtual address 0x8200.0000 - 0x83DB.0000的區域。

MODULES

這個section指定所有要放入各區域的file 名稱,同時指定他的attrib。

FILES

這部份的內容和MODULES類似,但是這個section的內容一定會被壓縮。
MODILES中指定的DLL檔,執行時會被load到Slot 1,這部份的資料則會被load到每一個slot中,所以會浪費virtual space 。



CE OS啟動時,create一個4G的virtual memory space,然後切割為33個slot,每個slot 32M。

CE使用 paged virtual memory management, 每個page 4K。

每個process 只能用到(看到) 32M 的位址空間。Process, DLL,heaps, stacks, ..都在這32M的區域中。

CE : Device Driver - DLL and GetProcAddr

msdn的文章(CE5.0 開發測試驅動程式)的筆記

CE的drvice driver只是DLL檔,Process將DLL load到memory中,就可以使用DLL中公開的API。

一般使用 LoadLibrary( ) 或 LoadDriver( ) 來load DLL,不同的是 LoadDriver( )除了將DLL load到memory外,同時還會確認DLL沒有被pageout。

將DLL Load進來後,使用 GetProcAddress( ) 來詢問需要的function存不存在,如果在,就會return 該function的address,如果不在,就return NULL。

有關 GetProcAddress : ( http://msdn2.microsoft.com/zh-tw/library/64tkc9y5(d=printer).aspx )以下就是load MyDLL進來,然後取得DLL中DLLFunc1( )這個function address的code..
HINSTANCE hDLL = LoadLibrary("MyDLL");

typedef UINT (CALLBACK *LPFNDLLFUNC1)(DWORD, UINT);
LPFNDLLFUNC1 lpfnDllFunc1 = (LPFNDLLFUNC1)GetProcAddress(hDLL,"DLLFunc1");

..
GetProcAddress( )中的第二個argument是function name,這是在module的.DEF檔中列出得的名字,如果該module export很多function,他會在DEF檔中同時列出ordinal (Index),這時可以用Index來取出address,省略掉FunctionName字串比較時花費的時間。

在 這一篇 Using exported DLL functions(http://blogs.msdn.com/peterrosser/archive/2006/02/22/ExportedDllFunctions.aspx ) 有說明用ordinal 取出function entry address的方法。

星期三, 10月 11, 2006

Windows CE Virtual Memory Layout for Debugging

這一篇(Sue Loh's blog ) 的同名筆記:

CE只有32個process,每個process只有32MB的virtual address。
這是因為CE的設計是使用整個virtual memory address space,即使該process並不在執行中,他依然佔有該部份的virtual memory space。

CE將低位址區分成32MB大小的slot:
  • 32M的hex 是 0x02000000
  • Slot 0 = 0x00000000 - 0x01FFFFFF
  • Slot 1 = 0x02000000 - 0x03FFFFFF
  • 最後一個process的最後一個address是0x41FFFFFF
  • 0x42000000 - 0x7FFFFFFF 是"share area",給VirtualAllocs 和 memory-mapped files 使用。所以這一段不會有symbol。
  • 0x80000000以上是"kernel stuff",kernel 佔用,並且在此處執行,同時kernel load的dll(如"Installable Interrupt Routine)也使用此區域。
Slot 0 比較特殊,他的內容就是"目前正在執行的process"。目前正在執行的process除了擁有他自己的slot外,還會被mapping到slot0來。

也就是說,如果你打開一個process,檢查其中一個variable或function的address是0x00012345,而這個process 原來佔有的slot 是0x12000000 - 0x13FFFFFF,那麼在0x12012345也可以找到和0x00012345一樣的資料。

Slot 1 也很特殊,"MODULES" section內的DLL都會load到這一個slot,但是只有DLL的code部份。
如果有兩個process load相同的DLL,他們都會使用到相同的Slot 1 code,但是DLL中的global data還是會放在caller process自己的memory space中(slot 0)。

DLL 可能被load到任何地方(slot0, slot1 和kernel space)。但是Slot1 只會load ROM DLL code。

有關slot0 的load方式,EXE檔會被load到bottom (0x00000000)的地方,DLL被load到top的地方(0x01FFFFFF)中間部份則是給HEAP和STACK用。

以下,可以由address大概分出他的類型:
  • 0x00012345 : 在Slot 0,並且在bottom,所以是在EXE中
  • 0x0056789A : 雖然在Slot 0,但是距離0x00000000和0x01FFFFFF都很遠,應該不會有這麼大的EXE檔,所以大概是EXE或HEAP。
  • 0x03123456 : 在Slot 1,所以是一個DLL,實際的offset是0x02123456
  • 0x3456789A : 在以0x34000000開始的slot中,offset是0x00456789A,和第二點一樣,距離bottom, top都太遠,所以應該是heap或stack。
  • 0x019ABCDE : 離top (0x01FFFFFF)很近,所以可能是DLL。
  • 0x6789ABCD : 不在32 slot中,也不數於kernel ,所以應該是在中間"share memory"處。

原文寫的比較好,很神奇。

星期四, 10月 05, 2006

Help Dillo Survive

看到這個 : Campaign to help Dillo survive

Dillo - 是一個很小的browser ,大概只有350k 大小,由於他的硬體需求很低,所以可以在一些老舊的電腦,或是embedded system中執行。

Dillo 已經支援:
  • 文字與圖形 rendering (PNG, JPEG, GIG)
  • SSL
  • Plugin
  • cookies
  • more..
Dillo 即將要支援:
  • i18n, l10n
  • CSS (目前以完成70%)
  • javascript
Dillo原以GTK+作為圖形引擎,但是在GTK+ v2後,因為不符合Dillo Small, efficenet的需求,所以改用FLTK2。

現在,porting到FLTK2的工作幾乎完成了,Dillo的Author : Jorge Arellano Cid 決定,沒有人來幫忙這個案子前,不會release這一版的source。
這個計畫大約需要2個full time的programmer,因為browser的規格變更實在太快了,如果這個browser改版的速度跟不上browser的需求變更,會馬上變得一文不值,所以Jorge Arellano Cid希望有人能幫忙這個Project (man and money)。



目前open source,符合embedded system的browser還真的很少。希望這個project能活下去。

星期二, 10月 03, 2006

SLEEP Mode in Datasheet

從Samsung網站download的datasheet:

Datasheet p 7-18

Signaling EINT[15:0] for Wakeup
  1. EINTn pin上的level 正確或是有edge 產生(依照INT設定)。
  2. 該EINTn pin被configur成EINT。
  3. nBATT_FLT 是High。
一旦wakeup後,該EINTn就不再作Wakeup使用,而作為一般的INT。

進入SLEEP Mode後,Databus (D[31:0]/D[15:0]),可以設定為Hi-z或是Output-Low模式。
  • 將Databus的pull-up開啟,同時將databus pin為Hi-z (databus的特殊模式)。
  • 將Databus的pull-up關閉,同時將databus pin為low (logic low state)。
但是若是databus上有另一個bus holder ic,例如74LVCH162245,則可以將pull-up 功能關閉(不管設定成Hi-z或是Low)。

接下來這一段有點奇怪.. p 7-19
Output Port State and SLEEP Mode
poweroff 時(就是Sleep ?),output port必須要給定一個位準,以降低電源消耗。
如果該port pin沒有負載,建議設為High。
當設為Low時,內部的寄生電阻會消耗電流。

如果可以選擇,建議將port設為High,降低功耗。
Battery Fault Signal (nBATT_FLT)

有兩個功能:通知applicaton battery is Low,保護system在low power時不會開機,延長battery life。
  • 平常時,將MISCCR的BATT_FUNC設為10b,可以在nBATT_FLT是Low時,產生 interrupt。
  • 在Sleep mode,將MISCCR的BATT_FUNC設為11b後,在nBATT_FLT的level是Low時,可以禁止所有EINT pin產生wakeup interrupt。
ADC Power

ADCCON 中有一個power-down bit,可以讓ADC進入power-down mode。

星期一, 10月 02, 2006

CE : inside build process - msdn

從Platform下的一個folder (platform)來看..

Platform下的file : dirs ,其中列出build時要深入的folder。
dirs 只有說明要build的有哪些目錄。

folder中的 sources 這個檔案則說明了該folder在build時的各項資料(有點像Linux的 config )。

有sources 這個file的folder就會有makefile這一個檔案,代表這個folder要實際作build動作。

幾乎所有的makefile都只有一行:
!INCLUDE $(_MAKEEVNROOT)\makefile.def
其中 _MAKEENVROOT 這個環境變數,可以在open release enviroment 中用
SET _MAKEENVROOT
來看,應該會是
_MAKEENVROOT=C:\WINCE500\public\common\oak\misc
所以這個"system-wide makefile是
_MAKEENVROOT=C:\WINCE500\public\common\oak\misc\makefile.def
在makefile中使用環境變數的方式和在command shell中不一樣。
makefile中用 $( )將環境變數刮起來,command shell中用 % % 刮起來。

build process依照幾乎統一的makefile,同時follow dirs, sources這兩個file的內容來 build。
在dirs, sources中可以定義macro,改變make的行為。macro的定義方式是:
Macroname= value
和Linux的Makefile一樣,Marconame和"="之間不可以有space。
一樣,用"\"代表聯到下一行。
Macroname 不分大小寫。

Build.exe和Nmake.exe都會將macro展開。

sources 這個檔案中,有一些常用的Macroname:
  • TARGETNAME=
    最後build出來的targetname (不含extension)
  • TARGETTPE=
    build出來的target的extensionname,PROGRAM的話就是 .exe,DYNLINK 就是 .dll。
  • TARGETLIBS=
    列出要link的library
  • SOURCES=
    要compile -in的source file有哪些,不包含header。
  • EXEENTRY=
    exe 檔的進入點,"WinMain" sets the entry point for a Windows application
  • INCLUDES=
    用到的header file
  • SOURCELIBS=
    這一個說明很奇怪,指定要link的library,這個和TARGETLIBS有什麼不一樣?
sources 決定build options。
makefile都是同一個。
dirs 決定builder recursive的path。

some messages - on/off log

BtnLED_ON(FALSE);!Data Abort: Thread=8fb42db0 Proc=8c3b7d20 'device.exe'
AKY=00000005 PC=03f92414(coredll.dll+0x00022414) RA=066d4038(device.exe+0x006c4038) BVA=066d4059 FSR=00000003
是在on/off 5142次後發生。
每次on 10sec, off 10 sec。所以一次需要20sec。
 5142 *20/60 /60  /24 = 1天 hr 
不確定是....

需要的東西:
  • 25 pin socket (mal) x 2
  • 鱷魚夾(R+B 4 組)
  • 電線

星期日, 10月 01, 2006

測試- 相片角落- 外連

新的照片網站,跟flickr一樣,但是是用flash (跟flickr剛開始時一樣)。
每個月有20M上傳流量。
可以外聯?



好像可以喔。

台灣的服務就是這樣,災難..
完全沒辦法信賴..

星期六, 9月 30, 2006

Windows CE Build Environment ToolWindows CE Build Environment Tool

寫寫這篇( http://msdn.microsoft.com/library/en-us/wcepbguide5/html/
wce50conWindowsCEBuildEnvironmentTool.asp?frame=true
)

在command window中執行wince.bat時,這個batch檔會使用三個環境變數來決定build process:

%_TGTCPU% : target cpu ?
%_TGTPROJ% :
%_TGTPLAT%
所以在執行wince.bat前,要把這三個環境變數設好。

wince.bat同時還需要%_WINCEROOT%這一個變數,告知整個WINCE source的root path。
wince.bat會呼叫一些其他的batch file來設定一個build parameter:
  • setenv.bat : ? 不知道要幹嘛
  • %_TGTPLAT%.bat : wince.bat會自動呼叫在%WINCEROOT%\Platform\%_TGTPLAT% 下的這個batchfile

無聊的..

依照他的表現,就算是不去踹這一腳,倒下去的日子也不遠了吧。
好的產品還是最重要的,不管是作口碑的高價位產品,或是C/P值高的市場殺手。對公司都有好的影響。

應該要想想,別人作不好的,自自己有甚麼能力能比他做得更好。

或許他本身就不適合作這類的產品,這也是他一直虧損的原因?

照這樣看來,就不是比誰的口袋深,能夠撐到開始賺錢,而是他註定要倒閉的命運。

最後,到了這裡....
好壞姑且不論,知名度到是有增加。

星期五, 9月 29, 2006

CE : Trace Exception Message

讀取一個invalid address,出現Data Abort。
Search "Data Abort",在 kernel\ARM\mdarm.c 中找到這個string.
在 ( http://msdn.microsoft.com/library/
default.asp?url=/library/en-us/dncenet/html/
HW_debugHardware-AssistedDebugging
WithPlatformBuilder42.asp?frame=true&hidetoc=true
) 也有提到這個file是處理所有exception的地方。
這一篇也是一篇很好說明,說明 在platformbuilder上使用hardware debugger可以做到的事和大略的debug方法。
對照message,應該是在"ExceptionDispatch( )這一個function 印出來的。

Blog不能亂寫呀...

在另一個blog隨便寫的一個為波盧加熱水的經驗, 結果有人 去看了,
是搜尋 "微波爐使用方法" 找到了.



所以說,blog不能隨便寫呀,或許是一個剛買了為波爐的新婚夫婦,面對著新微波正商著腦筋而看著我的網頁呀。

星期四, 9月 28, 2006

Writting ARM Assembly in Embedded VC - V2

上一篇轉貼別人的方法,實際照著作不OK,很奇怪,會有error說 AREA 後面的是unrecognizable opcode,所以?

MSDN上也沒有說明"AREA"這個directive,甚至連ARM Assembly source file的基本格式指令 - 設定CODE節區,Data節區... etc 也沒有。只有說...參考CE Kernel的code,所以去copy了一份flushic.s到eVC中。compile - 出現...kxarm.h 這個就是定義TEXTAREA這個MACRO的include file。

看一下,猜測 AREA這個directive大概是要
AREA |.text|,ALIGN=2,CODE,READONLY
這樣寫,把這個加在assembly source file開頭,就可以compile了,以下是測試的function:
EXPORT TestIncrease

AREA |.text|,ALIGN=2,CODE,READONLY

TestIncrease
mov r12,sp
stmfd sp!,{r4-r11,lr}
add r0,r0,#1

ldmfd sp!,{r4-r11,pc}


END
在*cpp 中使用的地方:....
extern "C" int TestIncrease(int a);
.....
int test=0;

test = TestIncrease(test);
....
可以作remote debug,在TestIncrease( )設break-point,可以看到test 這個variable由0變成1。

eVC因為不"直接支援"programmer 寫assembly source code,所以在eVC的環境和設定中都沒有相關的設定。
要加入assembly file,就要用"custom" option,自己寫入assembler command:

  1. 自己在project folder中新增一個 .s file 如: myasm.s
  2. 在eVC的Workspace panel中,source folder的部份,將myasm.s加入到source 中。
  3. 選 Project - Settings - 會出現各個configuration, 各source file的操作,選好configuration, 和myasm.s ,右邊會出現兩個tab - General, Custom Build。
  4. 選Cuntom Build,在"Commands的地方加入:
    armasm "$(InputPath)" "$(IntDir)\$(InputName).obj" 
  5. 在"Output"的地方填入:
    $(IntDir)\$(InputName).obj 
  6. OK
這樣,就可以開始編輯myasm.s了,編輯完後,用Ctrl-F7 "Compile"就可以assembly myasm.s。OK後就可以build 整個project。

Writting ARM Assembly in Embedded VC

這一篇也是轉貼,因為只有找到這一篇,所以copy下來。
是從packetmatrix forume 看到的一篇 ( http://www.pocketmatrix.com/forums/viewtopic.php?t=4063 )
內容說明在embedded VC++ 內使用assembly language。
專注在ARM。

因為embedded VC++ 的IDE要create source file,沒有assembly filed可以選,還有有關C- Assembly 間的argument passing 規則,不知道MS和ADS一不一樣。
以下就是說明。

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

1) Is there a good book about ARM assembler?
2) Can I use inline assembler in my c code with Embedded Visual C++?
3) Can I see what assembler code the c compiler creates?
4) How do I add an assembley source file to my project, and get EVC to assemble it?
5) How do I write a function in assembler and call it from the c code?
6) How are values passed to and from the assembler function?
7) Can I use any of the 16 registers for anything?
8) Useful resources.


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

1) Is there a good book about ARM assembler.

ARM System-on-chip architecture (second edition)
Steve Furber
Addison-Wesley

As well as some chapters aimed more at hardware designers, it has an explanation of the ARM instruction set plus a complete reference of the assembler format for each one. It doesnt teach programming in any way, but if you are experienced in c programming and just need full details of the instruction set and info on how the processor works it is great.

2) Can I use inline assembler in my c code with Embedded Visual C++?

There is no supported way of doing this. You need to put your assembler in seperate functions which can be called from your c code. See below for details of how to do this.

3) Can I see what assembler code the c compiler creates?

Yes, and this is very useful for a few reasons. You can see how optimal the code being produced is, and also learn how the compiler does things. You need to:

From the 'Project' menu choose 'Settings'. Go to the 'C/C++' tab. In the 'Category' drop-down-list choose 'Listing Files'. In the 'Listing file type' drop-down-list choose 'Assembley with Source Code'.

Now the compiler will produce .asm files in the output directory which contain the assembler code with the c source as comments.

4) How do I add an assembley source file to my project, and get EVC to assemble it?

Create a blank file 'myfile.asm' in your project directory with notepad. From the menu in EVC select 'Project->Add to Project->Files' set the 'Files of type' field to 'All Files' and select the myfile.asm file. It will appear in the file list on the left, drag it into the 'Source Files' section.

Select 'Project->Settings' from the menu. On the left of the dialog: select the 'ARM release' configuration and select the 'myfile.asm' file. On the right of the dialog: select the 'Custom Build' tab. In the 'Commands' box add the text 'armasm myfile.asm' and in the 'Outputs' box add the text 'myfile.obj'. Repeat this for the 'ARM debug' configuration.

Now you can open and edit myfile.asm from EVC and it will be assembled into your project.

5) How do I write a function in assembler and call it from the c code?

First a note about the assembler source code layout. All command lines should begin with a tab. Any lines that have text on the left are labels. You need to use labels for function names and as targets for branch instructions. Use a semicolon to mark the rest of a line as a comment. The file should finish with an END command.

Example file:

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
AREA ArmGfxLib,CODE,READONLY
EXPORT FunctionA
EXPORT FunctionB

FunctionA
MOV r12, sp
stmfd sp!, {r4-r11,lr}

; useful code to do something goes here!

ldmfd sp!, {r4-r11,pc}

FunctionB
MOV r12, sp
stmfd sp!, {r4-r11,lr}

; useful code to do something goes here!

ldmfd sp!, {r4-r11,pc}

END

21 lines; 2 keywds; 0 nums; 32 ops; 0 strs; 0 coms Syntactic Coloring v0.3 - Dan East


Explanation: the AREA command gives a name to this code section. The EXPORT command makes those labels available as functions. The stmfd/ldmfd commands save and restore the registers to the stack, so you dont corrupt values that the calling function depends on.

In your c++ code add the line:

#ifdef ARM
extern "C" void FunctionA(int a, int b);
#endif

The #ifdef is because we have written the function in ARM assembler so it isnt available in MIPS/SH3 builds.

6) How are values passed to and from the assembler function?

If you declare a function of the form:

extern "C" int armfunction(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6);

The first 4 arguments will be passed in the registers r0-r3. These registers will contain the passed values at the start of your assembler function. Further arguments are passed on the stack, see the code below to read them.

The return value should be placed into register r0 at the end of your assembler function (just before you return to the caller).

This works well with int's and pointers (all pointers are 32 bits). If you try and pass a structure directly as an argument it gets more complex. I advise you to only pass/return integers and pointers to/from your assembler functions, at least to start with.

Here is an example function (declared as above) which adds its six arguments and returns the result.

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
armfunction
MOV r12, sp ; these two lines are
stmfd sp!, {r4-r11,lr} ; standard setup code

; r0-r3 are the first 4 arguments passed

ldr r4, [r12] ; load 5'th argument into r4
ldr r5, [r12, #4] ; load 6'th argument into r5

add r0, r0, r1 ; r0 = r0 + r1
add r0, r0, r2 ; r0 = r0 + r2
add r0, r0, r3 ; r0 = r0 + r3
add r0, r0, r4 ; r0 = r0 + r4
add r0, r0, r5 ; r0 = r0 + r5

ldmfd sp!, {r4-r11,pc} ; standard cleanup and return code

16 lines; 1 keywds; 3 nums; 52 ops; 0 strs; 0 coms Syntactic Coloring v0.3 - Dan East


7) Can I use any of the 16 registers for anything?

No. You can use r0-r12 and r14 for anything you like. r15 is the program counter, if you write a value to it then execution will jump to that location. Use the branch instruction, dont alter it directly. r13 is the stack pointer, do not alter it unless you are sure you know what you are doing. r14 (which you can use) is the link register. If you want to call another function you need to set this to the return address, I will include an example in a future version of this FAQ.

8) Useful resources.
什麼時候要用?

要用 mcr, mrc 和co-processor instruction 時好像就要用到...

星期三, 9月 27, 2006

ARM MMU :Address Translation : Level One Descriptor

在ARM User Manual 上看MMU : address translation 時一直有一個疑問,作level one translation時:


mmu 的 TTB (translation base register) 內的bit 14-31


要轉換的address的 bit 20-31

組合成一個 30 bit的address
H  --------------------------L
[TTB 31-14] [ Address 20-31] 1. 0
這個位址就是level one descriptor。
descriptor的內容決定address要怎麼轉換。

問題是...address只有 30 bit呀,後面還有兩個bit怎麼辦?
都用 0 ? 那這個descriptor table不就不連續 ?

真蠢。

descriptor的size是32 bit,所以一個descriptor需要4 bytes。
最後兩個bit當然就不能用囉。


會被混淆的原因是 descriptor的內容,
剛好bit 0, 1 用作 traslation type 的id:
00 - Fault
01 - Coarse Page
10 - Section
11 - Fine Page

星期一, 9月 25, 2006

Windows : 網路ok但是不能瀏覽網頁和telnet

這一篇'是從資安論壇copy過來的,原文是 王世達 先生所作,因為太過重要,所以轉貼再這裡。
如何修復被惡意程式破壞的Winsock?
« on: August 15, 2006, 09:49:02 AM »
________________________________________
有些惡意程式(如Trojan.Riler.F、TROJ_AGENT.CAC)或間諜軟體(如NewDotNet、WebHancer等)安裝一些附加 元件至系統的Winsock2機碼中(有時候稱為Layered Service Provider, aka, LSP),以利於監視系統的網路訊息。當你(防毒軟體或反間諜軟體)不小心移除它時,會造成網路中斷或網路不穩定。如果發生這種情形,如何檢查及修復它 呢?

如何判斷Winsock2已經被損毀了呢?

方法一:使用Windows XP SP2所提供的命令(netsh winsock show catalog)
1. 按一下[開始],然後按一下[執行],輸入cmd,然後按一下[確定]。
2. 在命令列視窗中,輸入netsh winsock show catalog。
3. 如果Winsock2機碼沒有損壞且只安裝TCP/IP的話,[通訊協定]中會有10個區段,每個區段的名稱將如下所示:
‧ MSAFD Tcpip [TCP/IP]
‧ MSAFD Tcpip [UDP/IP]
‧ RSVP UDP Service Provider
‧ RSVP TCP Service Provider
‧ MSAFD NetBIOS [\Device\NetBT_Tcpip...
‧ MSAFD NetBIOS [\Device\NetBT_Tcpip...
‧ MSAFD NetBIOS [\Device\NetBT_Tcpip...
‧ MSAFD NetBIOS [\Device\NetBT_Tcpip...
‧ MSAFD NetBIOS [\Device\NetBT_Tcpip...
‧ MSAFD NetBIOS [\Device\NetBT_Tcpip...

方法二:使用msinfo32.exe
1. 按一下[開始],然後按一下[執行],輸msinfo32,然後按一下[確定]。
2. 展開[元件],再展開[網路],然後按一下[通訊協定]。
3. 如果Winsock2機碼沒有損壞且只安裝TCP/IP的話,[通訊協定]中會有10個區段,每個區段的名稱將如下所示:
‧ MSAFD Tcpip [TCP/IP]
‧ MSAFD Tcpip [UDP/IP]
‧ RSVP UDP Service Provider
‧ RSVP TCP Service Provider
‧ MSAFD NetBIOS [\Device\NetBT_Tcpip...
‧ MSAFD NetBIOS [\Device\NetBT_Tcpip...
‧ MSAFD NetBIOS [\Device\NetBT_Tcpip...
‧ MSAFD NetBIOS [\Device\NetBT_Tcpip...
‧ MSAFD NetBIOS [\Device\NetBT_Tcpip...
‧ MSAFD NetBIOS [\Device\NetBT_Tcpip...

如何修復已經被損毀的Winsock2呢?

方法一:
如果你的系統已經是Windows XP SP2的話,只要在命令列視窗中,輸入下列的命令即可:netsh winsock reset
不過,如果你有安裝其他的附加元件的話(如Google Toolbar),此命令會還原至只有TCP/IP的狀況。

方法二:使用LSP-Fix程式
1. 你可以從http://cexx.org/lspfix.htm下載此程式。

方法三:刪除毀損的登錄機碼,然後重新安裝 TCP/IP 通訊協定
1. 按一下[開始],然後按一下[執行]。
2. 在[開啟]方塊中,輸入regedit,然後按一下[確定]。
3. 在[登錄編輯程式]中找出下列機碼,再用滑鼠右鍵按一下每個機碼,然後按[刪除]:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Winsock
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Winsock2
4. 提示您是否確定要刪除時,請按一下[是]。
注意 刪除Winsock機碼之後,請重新啟動電腦,否則,下列的步驟就會無法正確執行。
5. 安裝 TCP/IP,用滑鼠右鍵按一下網路連線,再按一下[內容]。
6. 按一下[安裝],按一下[通訊協定],然後按一下[新增]。
7. 按一下 [從磁片安裝],輸入C:\Windows\inf,然後按一下[確定]。
8. 在可用通訊協定的清單中按一下[Internet Protocol (TCP/IP)],然後按一下[確定],然後重新啟動電腦。

參考:
1. KB811259: http://support.microsoft.com/default.aspx?scid=kb%3Bzh-tw%3B811259
2. LSP-Fix: http://cexx.org/lspfix.htm
可惜知道得太晚,已經重灌了。

Windows真是一個奇怪的系統呀,ping得到,網路Ok,但是網頁,telnet竟然都不通。
不知道是怎樣搞出來的。

系統能作成這樣也算是偉大了。

ARM Assembly Pseudo Codes : MAP, FIELD

ARM Assembly 中MAP和FIELD是用來產生類似 C 的"structure" 的資料區塊
  MAP  0x100
A FIELD 16
B FIELD 32
C FIELD 256
以上在位址0x100的地方宣告了一個structure,A的位置是16 byte,B 32 byte,C 256 byte。
和 C的structure一樣,reference 到A時,代表位址0x100,
B 代表位址 0x100 + 0x10
C 代表位址 0x100 + 0x10 + 20

另外比較討厭的是ARM Assembly每個pseudo code幾乎都有一個簡寫符號,MAP是 " ^ ",FIELD是 " # "。

所以上例變成:
  ^  0x100
A # 16
B # 32
C # 256
要注意"#"在instruction 中代表literal。

另外,如果不是在MAP中,要宣告一塊空間,要用 " % ",使用 %符號,該位置由locator決定。

* 其他還有很多奇怪的 pseudo code代表符號,可以參考 : http://checko.blogspot.com/2005/02/ads.html

CE : Kernel Startup Sequence and some others

在MSDN 這一篇:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnce50/html/ce50prev.asp
有說明 CE 的startup sequence..

從bootloader開始講,範例是ARM。
要配合BSP的code來看,BSP的code中,bootloader 依照boot flash type : NOR 或是NAND。而有不同。(BSP中有一個readme,說明boot environment: FLASH Layout)

NOR : EBOOT
NAND : STEPLOADER

EBOOT 就是 etherboot,支援download image from ethernet,writing to NANDFLASH。
(這個功能是因為demo board上有一個JMP可以設boot device : FROM NOR/NAND)。

STEMPLOADER是一個小size的bootloader,配合cpu NAND boot support的功能。boot時,cpu會從NANDFLASH讀取4k的data進入internal SRAM,再由internal SRAM boot。


Wakeup 和 Reset不一樣的地方在於Wakeup 時,SDRAM的內容是Sleep時的內容,沒有消失,所以只要適當將週邊再設定好,就可以回到當初sleep的狀態繼續執行。
Reset就不一樣。

這個bootloader的starup code要作的事情很多,因為不管是wake from sleep,reset 和WDT timout都是從這裡開始執行。
所以要判斷是wakeup,reset還是WDT,wake up的話,要check saved data是不是OK。restore saved data (CACHE/MMU control)。
WDT的話,要clear DRAM data。
reset的話,要將kernel從NANDFLASH load進來(C code)。


Bootloader的部份都是以EBOOT為範例解說。 -- 這部份略過,因為NAND FLASH不使用EBOOT作bootloader。

Kernel

由 Src\Kernel\OAL\Startup.s 開始。 負責hardware 相關的初始化(dram, cache...),最後計算好OEMAddressTable 的位置,當作是argument,呼叫KernelStart。
OEMAddressTable 宣告在Src\inc\oemaddrtab_cfg.inc。

KernalStart在MS的private code folder的armtrap.s(也就是說,其內容是不能在公開場合提及的)。在msdn這一篇 ( http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcecoreos5/html/wce50conNkexeBootProcess.asp ) armtrap.s 這一個assembly 不太好看,裡面包括很多部份,大部分是要setup MMU,所以有一堆Virtual, Physical 轉換。

ARM MMU architecture (furber P.302)

ARM MMU 使用 2-level page table和一個TLB(存放最近用過的translations)。
memory mapping的size可以有以下選擇:
  • Sections - 1M byte
  • Large Pages - 64K Byte,其中每16K byte又被分為一個sub page,可以分開控制
  • Small Pages - 4K Byte,分成 1K byte subpage
  • Tiny Pages - 1K Bytes tiny page
在KernelStart (armtrap.s) 中看到設定MMU Translation Table的部份,最後的 byte是1。
所以是 Coarse page - 64k per entry。

使用Corse Page,所以Address Translation 要經過兩次轉換:由 MMU的 TTB(Translation Table Base)register 和要轉換的address查表到一個descriptor,由descriptor內的


有關MMU - ARM MMU : CP15 (P.299 furber)

C3 : Domain Control - 16 個domain的access control (2 bits/domain)
C2 : Translation Table Start Address - 在RAM中存放Translation Table的start address
C8 : 控制每個domain動作 - Flush.. etc
C1 : MMU的各項funtion (enable MMU,address alignmnt fault, data cache, Write buffer...)




CE 的system call 和Linux kernel service 類似,有implement一個call-gate,將API轉為Service_ID傳入統一的kernel 介面。

Service ID 定義在oak\inc\psyscall.h

星期日, 9月 24, 2006

CE : Filesystem architecture and FileSys.exe

這一篇是翻譯這裡(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnembedded/html/embedded06172003.asp)的前半段...
CE 的 File 操作是由 FileSys.exe完成的,也就是說,program中有關file 的操作,file的api都是由FileSys.exe 這個 progam 完成。

詳細一點說,FileSys.exe 負責 ObjectStore和Storage Manager。

CE的檔案系統結構跟Linux比較相似,存在於 Root : "\" 下。
跟Windows 的file system 有很多driver letter 為root 反而比較不同。

CE中,File Driver 會mount在 Root "\" 下的一個folder (跟linux一樣)。

FileSys.exe 含有以下三個component:
  • ROM Filesystem
  • Storage Manager
  • Object Store
Object Store實際上是在memory heap中,Object Store內含 RAM system Registry,RAM filesytem,Property Database。

Registry 是所有CE所必須的,在CE 4.0 之前,registery 都是存在RAM 中,到了CE .NET後,registery 可以在RAM 或是以file的形式存在其他storage中。

RAM filesystem和Property Database則是optional,designer可以依需要選擇是否要加入這個支援到FileSys.exe這個module中(在platformbuilder)。

RAM File System一般就會mount在root上"\",也就是說,Root就是RAM Filesystem。
RAM File system下的file會直接出現在root"\"下。

ROM File System則會mount在"\Windows"下。也就是說,CE的"\Windows" folder是read-only。

Storage Manager是CE .NET新增加的module,負責所有Storage和Storage中使用的Filesystem。
Storage Manager主要處理四件事:
  • Filesystem Filter
  • Filesystem Driver
  • Partition Driver
  • Storage Driver
這四個driver和整個FileSys.exe的關係如下圖所示:

圖中可以看出,Block device負責storage hardware相關的read/write動作,Partition Driver負責在Storage中模擬出partition的動作(分割),其上是Filesystem。在Partition(在沒有partition的storage則直接對Block)做出filesystem。
上面是Filter,Filter可以讓designer implement一些像encription之類的動作
。另外,看Filter的位置,可以知道,Filter的動作只能對Block device,所以designer沒有辦法在ROM Filesystem和Object Store加上自己實做的encription動作。

除了實際的Block device外,Storage Manager也可處理network filesystem,只要filesystem implment所有 Storage manager和Filesystem Filter所需要的API,就可以完成一個實際的storage。

以下說明system loading filesystem的動作:

boot - NK.exe 啟動,將在ROM Filesystem中的FileSys.exe 載入,FileSys.exe將在ROM 中的registry 載入到RAM中初始化。
FileSys.exe讀入registry,依照registry中的設定值load其他的driver,第一個load的是device.exe,這個driver依照HKLM\Driver\building的內容依序將其他driver load進來。
Block driver也會在這個registry key下,所以也會被load進來。Block Driver "advertise" 一個特殊的class id : BLOCK_DRIVER_GUID {A4E7E......略}。

FileSys.exe中的Storage Manger提供一接口,接收所有block device driver loading, unloading時發出的通知訊息。
當有Blockdevice driver loading時,Storage Manager 對block device driver作open動作,並且查詢他的profilename。
每個block device都在registry中存有一個自己的PROFILE,說明這個block device使用的partition driver和filesystem driver種類。

Storage Manager 知道了block device使用的partition 和filesystem driver後,就去把這些driver load進來。

partition driver load進來後,Storage Manager請parition driver將block device中所有的partition 列出。同時列出partition使用的filesystem,Storage Manager再將filesystem driver loading進來,將對應的partition mount到對應的目錄。

GPL Violation : D-Link

上一個廠商好像是ASUS吧,不過經過那次之後,ASUS似乎已經和open source合作得非常好了。

這一次是D-Link。

http://gpl-violations.org/news/20060922-dlink-judgement_frankfurt.html

為了真的維護gpl,gpl-violations.org成立。
這個案子就是其中一項,大概是說D-Link的DSM-G600 這個NAS產品使用了GPLed Source Code。
但是卻沒有依照GPL規定將source code公佈(或是提供給產品購買者),gpl-violation.org通之後,D-Link好像不承認,最後gpl-violation.org利用reverse-engineering提出證據,所以D-Link只好答應停止販賣這項產品(但是source code還是不提出),依照gpl,應該是有權要求全面回收,否則就要提供
source code,但是gpl-violation.org 也答應D-Link以不再販賣終結這個案子,但是要求D-Link支付當初reverse-engineering所花的錢。

結果?

D-Link 竟然向法庭提出這是gpl-violation.org的不當要求????

今年 9/6,德國法庭判定這並非不當要求,D-Link應該要支付這筆費用。

那,,,這筆費用到底是多少錢呢?

----- 300 EUR

(我不太暸解,是全額300 EUR還是雙方議價的差距是 300 EUR ?)


真是不可思議的D-Link呀。
這麼心不甘情不願,去用CE就好了呀。
(或是用bsd,但是driver比較不全)

真是讓人看不起....

星期六, 9月 23, 2006

最後的夥伴 - 海賊王 428

魯夫終於打敗CP-9,但是已經全身無法動彈。
四周都被海軍軍艦包圍...唯一的逃脫船也被擊沉,
所有海軍艦砲,瞄準著魯夫一行人...即將發射...

還有希望嗎?

騙人布隱隱約約聽到還有一個夥伴的聲音,,,"向大海去吧!向大海去吧....",

海軍艦砲發射!

"大家跳向大海吧!我們還有一個夥伴,來接我們了!" : 騙人布大聲呼喊著。

海賊團員們向著大海一躍而下! 在海上,迎接著他們的是.....飄揚的 草帽海賊旗


黃金梅利號


星期三, 9月 20, 2006

CE: mismatched time stamp on .rel file for module ...

在作CE image build時,因為整個build (build and sysgen,又check "clean before build)需要很長的時間( about 1.5 hr @ 2.5G 512M)。
所以通常都會開啟"Open Release Directory" 的command視窗,到有修改的folder中手動
build -c
作local build,然後再用platformbuilder的"make run-time image"來make image。
或是在command下用
 makeimg
來作相同的動作。
使用platform builder的"make run-time image"的好處是log會在log視窗中,可以看到全部,用command下的話,受限command 的buffer,只有最後幾行可以看到。
這樣作,有時候會出現
"mismatched time stamp on .rel file for module XXX.."
的warnning,然後有時候會導致error。
解決的方法是用用platformbuilder的"Copy File to Release Directory"(或是在command下 buildrel )。
之後再makeimge,錯誤就會消失了。

...當初是猜測既然是file time stamp 不符,所以把所有file的time stamp改掉不就可以... 可惜我不知道windows 有沒有 "touch" 這樣的命令。所以只好將releae folder刪除,一一由build folder copy到release folder... 後來才看到有這樣的command,試試,果然OK。
:)

UDA1380 - I2S Code-Decoder

  • I2C控制介面
  • I2S 資料介面
  • AD : Audio in -> I2S 8~55kHz
  • DA : I2S ->Audio 8~100kHz
  • Sampling Resolution : 24bit Max (?)
  • In/out path的clock和Gain AMP可以分開power down。
  • AD, DA可使用不同的freq : system clock或是由I2S的Word Selection Clock 鎖相。
  • 提供一個單音輸出和一個16 ohms立體耳機輸出端

以下是DAC部份:

system clock: SYSCLK

DAC的內部clock是128 sampling frequence (1 data value need 128 clocks internally).
這個內部clock要由SYSCLK產生,所以外部IC要提供正確的SYSCLK和設定好UDA1380的register,讓內部確實產生128 fs 的clock。

一般的音源sampling freq是44.1kHz (CD是96kHz),假設master cpu產生256fs的話,SYSCLK就會是44.1k * 256 =11.2896MHz。

進入UDA1380後,要設定register00[3:2] = UDA1380才能產生128fs 的clock。

* 從UDA1380的datasheet來看,register00[3:2] 的value:
00  256fs
01 384fs
10 512fs
11 768fs
所以SYSCLK最低是256fs。

星期二, 9月 19, 2006

Make Binary Image Tool and Add file in Images

有關make binary image 的動作,可以將 make run-time image後,PB的"Build" output windows中的log copy 出來看,可以知道make binary image的整個動作(依序run哪些command),再利用PB 的help search這些command 。
ms-help://MS.WindowsCE.500/wcepbguide5/html/wce50conMakeBinaryImageTool.htm

make image時 Makeimg.exe 會呼叫以下program:
  1. NLS(Native Languege Support) Compression tool (Cenlscmp.exe) enable
  2. Fmerge.exe - merge multi bib , reg, dat, db to one.
  3. RegComp.exe (Registry Compression Tool) 將Reginit.int 轉為binary 模式(Default.fdf),這個file會被包在image中(在ce.bib中可以找到)。
  4. Res2exe.exe (Resource Update Tool) : 將DLL.EXE 中與語系,地區相關的resource file換掉。
  5. Txt2ucd.exe (Text to Unicode Tool) : 將Fmerge.exe產生的Initobj.tmp中的ASCII string轉成Unicode string,放在Initobj.dat
  6. Romimage.exe (Rom Image Builder Tool) :根據 Ce.bib 的內容,將file 安排好。產生nk.bin。
喔,很多。大部分make image的動作都在這裡說明了,應該要看一下。

下一個,將檔案加到 image中:
ms-help://MS.WindowsCE.500/wceosdev5/html/wce50tskAddingaFiletoanOperatingSystem.htm

分成兩步驟
  1. 將檔案copy到release folder中
  2. 告訴pb 將檔案加到image中
copy的動作可以用手動或是自動,手動就不用說了,自動的話可以利用PB的Platform Setting功能,在Prebuild 過程 加入copy動作。

告訴pb 的方法是 將要加入的file加到Project.bib中的FILE Section。follow bib的格式:
FILES
; Name Path Memory Type
; -------------- -------------------------------- ------ ----
<file name> $(_FLATRELEASEDIR)\<file name> NK S
Name會檔案在Image中的名字。

有關bib的file 欄位說明,在
ms-help://MS.WindowsCE.500/wceosdev5/html/wce50confilessection.htm

FILE section的內容和MODULE section一樣,但是Romimage.exe會壓縮FILE section,

Name : 該file在image 中的名字(memory table中的名字)。
Path : 在image中的path (folder ?) - 但是實際上看起來好像是source file path/name。
Memory block : 在Config.bib中MEMORY section 宣告的區域
Section override :
Type : file type,可以是:
  • S : system file,只有OS可以用
  • H : hidden,不會顯示在一般的目錄中
  • U : Uncompressed
  • N : untructed module
  • D : 不能debug

PB的output windows在make run-time image時會輸出最後的image map,內容包括最後各file, program 的各section 的location, size。
最後還會列出Starting ip (image entry)

CE Command Tools - fmerge

在PB help裡:

Makeimg.exe 呼叫這個command將:
1. 所有 *.bib 合並成一個 ce.bin
2. 所有 *.reg合併成一個 Reginit.ini

所以在上述兩類(bib, reg)檔案中可以使用以下instruction 控制fmerge.exe:
#define
#undef
#include
#error : 輸出message並且停止執行
#message : 輸出message

在這些instruction 中可以使用:
&&
||
==
!=
變數的部分(用#define 定義的),可以用$( )來代表。
雖然沒有說明fmerge.exe如何將所有bib, reg合併成 ce.bin, reginit.ini,但是也可以知道最後的 relocation definition 在 ce.bin。
registry definition 在 reginit.int

還有這兩個file都是在 PBWorkspace下Reldir\XXX_Release

星期六, 9月 16, 2006

New iPod Nano - No Chip's Mark

這一篇文章 : http://www.ddj.com/dept/embedded/193000928?cid=RSSfeed_DDJ_All

說到這次新release的iPode Nano,內部IC的標誌都已經被mark掉了,大概是為了避免上次一樣的事件,被人家算出cost,而發現Apple大賺了一筆。

但是 文章中還是猜測了一下...

代替原來PortalPlayer的是Samsung的arm chip。
還有兩顆大概是Wolfsan的codec和Philip的power control 。
據說 這次新的 Nano,雖然價格比較低,但是Apple賺得更多 (換Vendor的關係?)。

聲音呢? codec用一樣的,音質大概沒差吧。

星期五, 9月 15, 2006

WINCE Driver

Windows CE 的driver source,是用類似dll export的方式提供呼叫介面,
source code中,使用一個 ***.def 將module name和要export的function name列出,以下以MYDRIVE的MYDRIVE.DEF為例
LIBRARY         MYDRIVE

EXPORTS
MY_Init
My_DeInit
My_Open
My_Close
My_PowerDown
My_PowerUp
My_IOControl
這樣

OAK - OEM Adaption Kit

在PlatformBuild中到處出現的 OAK 是什麼意思?

在 http://acronyms.thefreedictionary.com/OEM+Adaption+Kit+for+Windows+CE+(Microsoft) 找到,原來是 " OEM Adaption Kit"。

星期二, 9月 12, 2006

eVC : Debug with emulator - first look.

eVC 內建Emulator,在寫application時,可以用這個emulator作簡單的debug (當然,跟hardwae相關的就不行)。

開啟Project時記得要加入Emulator 這個configuration。(不然就要在 Build - Configurations - Add 增加你要的Configuration)。

Build - Set Active Configuration 選 Emulator,
之後,就follow一般programming, building 步驟就可以,最後,用Build-Start Debug - Go。就會啟動emulator。

Project可以配合不同的Platform (SDK),每個Platform(SDK)又有不同的configuration。
在Build-Set Active Platform 可以選擇你要使用的Platform (STANDARD_SDK or YourPlatform_SDK)。
之後在 Build -Set Active Configuration 選你要用的configuration (Emulator Release/Debug , ARM Release/Debug)。

在 Tools - Configure Platform Manager 可以看到所有的"Device "(?)。在這裡設定對Project與device的關係。
例如有一個STANDATDSDK_420底下有一個device : STANDARDSDK_420 Emulator,選"Properties"可以看到相關設定:
  • Transport : TCP/IP Transport for WinCE
  • Startup Server : Emulator Startup Server
另一個Platform "YourPlatformSDK",Transport和Startup Server都是選 ActiveSync。

這樣很複雜的,分散在各處的,名稱不一致的,很容易搞混的,不容找到的Platform - Configuration - Device 之間的設定,決定了Project的debug動作(是經由ActiveSync 與target 作remote debug還是用emulator作debug)。

星期一, 9月 11, 2006

eVC : Compiling/Linking Directory Setting/

Tools - Options - Directories - Show drirectories 有
  • Executable files
  • Include files
  • Library files
  • Source files
可以設定Build related directories。

如果只是Project Dependent path,要在
Project - Setting - C/C++ - Preprocessor - Additional include directories

Linker - General - Object/library modules

多組path以空格分開。

Offline Blog Editor : Zoundary

Blog 離線編輯軟體 : Zoundary。是free 的,Not sure if it's GPLed .

Zoundary Blog Writer

好像沒辦法過firewall/proxy

星期五, 9月 08, 2006

SDRAM Self-Refresh

Chip 的DRAM Controller提供兩種refresh mode : Auto Refresh 和 Self Refresh。
(? 依據DRAM的說法,self-refresh功能是由DRAM自己提供,而不是DRAM Controller)。
另外,還有一項跟DRAM的特性有關的是Refresh Period。

Self-Refresh 通常用在power-saving 模式,或是sleep mode。可以少耗電。
refresh period 越短,耗電量越大,為求省點,通常都盡可能的將refresh period加長。
但是period 太長是有危險的,一旦不足以保持DRAM的內容,就會造成data lost。

所以適當設計refresh period,是一個power and performance 的trade-off。

另外一個需要考慮的因素是溫度,當溫度高時,電晶體介面電阻變小,data cell的discharge current變大,所以DRAM中data lost速度變快,refresh period需要短一些。

這樣為了保持高溫時的正常,資採用short period,導致sleep時耗電量增加,很不划算。

所以出現了一種 : "依照環境溫度變更refresh-period"的DRAM設計:
http://www.elpida.com/pdfs/E0599E20.pdf#search=%22self-refresh%20period%20temperature%20%22

是 ELPIDA 的 "Mobile DRAM" 系列。

從文件的資料中可以看到,85'C時,因為refresh period變短,導致耗電量是 45'C時的一倍。

? 大部分SDRAM的max refresh period 竟然是 65 ms (不是us!!)

星期四, 9月 07, 2006

SLEEP Mode and Get IN , OUT

Chip在sleep mode時,除了RTC,SDRAM self refresh 控制器外,其他裝置(包括core logic)的power都被關閉。

系統要進入sleep狀態,要設定 control register的旗標。
系統要離開sleep狀態有兩種方法 :
  1. 由EINT pin腳輸入一個trigger信號。
  2. 藉由 RTC的timeup trigger。
進入sleep狀態時,chip僅提供"關閉週邊電源"的功能而已,其他的 housekeeping工作都要programmer自己作,諸如:
將IO pin設為floating,關閉USB。disable all interrupt。enable DATABUS pullup resister,enable SDRAM self-reflash function..
chip提供一組register,在進入sleep後,資料不會消失。所以可以藉由這個register來存放wakeup後需要的資料。

Wakeup

Chip wakeup的instruction flow跟hardware reset是一樣的,所以要由programmer自己判斷是由sleep中wakeup或是 hardware reset,一般就是藉由那個能keep data的register來完成。



以上是hardware相關的sleep/wakeup動作。

如果是software部份,就有很多事要作,為了要能恢復到sleep前的狀態,在sleep前,要將stack frame save在 SDRAM裡。Wakeup時再restore回來。還要注意一些週邊裝置,無法在wakeup後繼續的動作,在進入sleep前要把他關閉。若是可以繼續的週邊,在sleep前要把相關的register存在SDRAM李,並且在wakeup時回存。

ARM9 MMU : the coprocessor of ARM core

mmu (memory management unit)負責virtual-physical位址的mapping動作,ARM chip的 MMU是以coprocessor的方式提供服務的,在arm的定義(設計)中,mmu屬於coprocessor 15。
所以arm core要控制mmu就要藉由coprocessor溝通指令: mrc, mcr。

mrc/mcr的instruction syntax是:
<MCR|MRC>{cond} p#,<expression1>,Rd,cn,cm{,<expression2>}
MRC : 將coprocessor的register內容搬到ARM core register中
MCR : 將ARM core register的資料copy到coprocessor中
{cond} : 條件執行
p# :所要操作的 coprocesspr index (number?)
expresion1 : 要coprocessor執行的命令
.有關ARM MMU 的內容在fuber的arm bible中有說明。

舉例;
 mrc p15, 0, r0, c1, c0, 0
對coprocessor15(mmu)動作,要求coprocessor 將他的C0, C1 register作operation 0-0的操作,然後把結果放到 r0。
因為mmu的instruction中,CRm沒用到,所以上面的instruction 中c0沒用。還有mmu是經由register控制的,沒有內部operation,所以operation固定是0。
所以mmu的控制指令,只有上述紅色部分有效。
上述命令也就是:
將mmu的c1 register load到r0
MMU的protection register R1 是Configuration Register,
bit 31 : iA : 在940T中控制clock
bit 30: nf : 在940T中控制clock

Windows CE : bib (Binary Image Builder)

http://blogs.msdn.com/ce_base/

CE用*.bib來決定(reloade?) memory layout。
一般的project中會包含兩個 image : bootloader , OS,所以Project中會有 boot.bib和config.bib。

以下大略說明bib的內容:

OEMAddressTable

這個table宣告在code中,用來放置在mmu的位址轉換register中。
所以這個Table的內容是 Virtual - Physical Address,格式:
Virtual, Physical, Size
CE內的code address都是virtual address。藉由這個table,轉換到實體的address。

Config.bib

使用以下SECTION來控制memory的使用

RAMIMAGE - 所有Kernel, conpoment都會被放置在這個區域。(大概就是code,const region?)
RAM - Kernel 會利用這部份的區域作為application或kernel自己需要的RAM 空間(data,stack ?)
RESERVED - Kernel 不會使用這部份區域。programmer可以用hard-coded對此 區域位址存取。
AUTOSIZE - 這是一個option,當設定ON時,builder會把RAMIMAGE和RAM合併成一個region。

EBoot.bib(boot.bib)

和config.bib類似,但是要注意的是,如果我們的bootloader沒有啟動MMU,則這部份的memory range是phyical address,不是virtual address。

Bringing it together

一般來說,bootloader和 OS使用相同的OEMAddressTable,所以他們的virtual address 是相同的,利用RESERVED區域,可以作為bootloader和OS之間傳遞資料的空間,也可以作為DMA的buffer。
其實未在bib中宣告的位址就不會被用來放置component(code,const?)和allocate(data,stack?)。所以RESERVED這個SECTION的用途有點像是comment一樣,用來標示我們coding中自己使用的區域。

Example

在XX platform的 common\startup\startup.asm中宣告了以下 OEMAddressTable:
_OEMAddressTable:
dd 80000000h, 0, 04000000h
也就是說,virtual address 0x80000000會對應到實體0x00000000的位置,mapping的size是64MB。
在eboot\boot.bib中有以下section..
MEMORY
; Name Start Size Type
;-----------------------------------
EBOOT 00130000 00020000 RAMIMAGE
RAM 00150000 00070000 RAM
ETHDMA 00200000 00020000 RESERVED
.這個 platform的bootloader沒有啟動mmu,所以以上的定義使用的是physical address。
如果我們把他對應到virtual address,會是 .. 0x80130000 - 0x80220000的區域。
而bootloader的code+const的區域是0x80130000 - 0x80150000。

接下來看OS的config.bib:
MEMORY
; Name Start Size Type
;-----------------------------
NK 80220000 009E0000 RAMIMAGE
RAM 80C00000 00C40000 RAM
DMA 80100000 00030000 RESERVED
BOOTARGS 801FFF00 00000100 RESERVED
EDBG_DMA 80200000 00020000 RESERVED
?"讓"掉bootloader的區域(0x80130000 - 0x80150000)。

請畫一個圖,將兩個bib的使用區域重疊起來..可以看到::

最後的區域是NK 跟NK RAM。這樣確保kernel的工作區域會從0x80220000開始,不會毀損前面的bootloader code/data。

有一個區域是在config.bib和boot.bib中重疊的 : ETHDMA跟EDBGDMA。這樣一來,在由bootloader移轉到os時,這一段變數內容還可以繼續被OS使用。

有一個要小心的地方:0x80100000 - 0x80130000這一個區域,剛好在bootloader之前,如果kernel使用多了一些,就會overwrite掉bootloader code。這樣就沒有辦法在warm reset時,由kernel跳回bootloader去執行。

NAND Flash

NAND Flash 和一般的Flash存取方式不一樣,他不能提供一般Address/Data per byte/address的access方式,而必須要以block的方式存取(每次讀取16 byte or more..)。通常每個block都會有額外的checksum byte用來確保這整個block的資料都是正確的。

NAND Flash的使用方式比較接近HD。所以通常要有一個memory controller 來控制。
要當作program image storage的話,通常需要有MMU管理在RAM中的code zone,當access miss的時候,觸動exception,將對應的code data從NAND Flash中load到RAM中,再繼續動作。

奇怪,看不到ARM920T有關MMU的動作說明...

TEST : New Environmemt Network access ...

OK. 可以使用blogger..
gmail .. 上不去,dns 可以解,但是not reachable ..
fixed ip, no proxy,local dns,
掛點,不能用google service : calendar, reader, 甚至連login google account都不行。

所有ping都沒有回應,大概是鎖igmp了。

稍稍紀錄一下:
10.1.1.5
255.255.255.0
10.1.1.242
10.1.1.245

所有google service 都上不去,除了blogger以外(因為沒有和google account整合在一起? )。
果然,beta.blogger.com就上不去...

writely OK - 因為沒有用google account (?)

會不會是google account service的問題?
否則只鎖google service 會不會太誇張?

web msn是ok的... 沒試msn是不是ok.

星期三, 9月 06, 2006

有關外資媒體的新聞

為甚麼自己賺不到,外資賺得到?

前中華電信董事長,現任交大管理學院院長毛治國指出,數位匯流後的經營,對新舊業者都是全新的挑戰。電視傳輸數位化後,頻道從一百台增加到六百台,有線電視業者一方面要學習管理極小眾化的頻道,還要進一步推出原本不熟悉的語音電話服務,搶原本電信業者的生意。
不是雙方都是挑戰嗎?難道說,由電信事業進入媒體比媒體進入電信事業容易 ?

「外資大概五、六年就會獲利了結,不會做長期的建設,」一位中嘉人士也明白表示,「就網路建設,或是頻道內容的發展,坦白說都不是好事。」
也就是說,不做常長期計畫建設的經營方式,比較容易達到高獲利? HOW ?

簡單來說,外資「用財報管理企業」,每天訂出管理數字。從過去卡萊爾管理台灣寬頻的模式來看,原本一人服務八百戶,人事精簡後,一人管理一千兩百戶。財報上費用降低、員工生產力提升,卻也意味服務品質下降。
服務品質下降,用戶不會流失?還是說各地區媒體業者已經瓜分完畢,完成壟斷?所以收視戶沒有其他選擇?如果是這樣,中華電視MOD的推出的確對現有媒體業者是很大的挑戰,因為收視戶不滿意現有服務的話,可以有其他的選擇。

將照片放在地圖上 : Geotag : PicasaWeb Google Earth

Google的相簿軟體也支援地理標籤(GeoTag)。配合上Google 自家的地圖軟體 Google Earth,兩者整合得更完美了。

PicasaWeb(不是Picasa喔,一定要有"Web")的版本是 2.5.0 (Build 32.71,0)以上。
還要有最新的google earth,版本是4.0.1693。

操作說明


打開PicasaWeb,找到你要tag的照片



然後選Tools-Geotag-GeoTag with Google Earth

GoogleEarth會自動打開,


在左邊的位置輸入你拍照的地方(這一張是謙哥在成大圖書館拍的,所以輸入 Tainan Taiwan..



GoogleEarth就會帶你到台南的中心,用右邊的icon(會變化喔),找到成大圖書館..看到,有個十字箭頭..


讓十字箭頭標示在圖書館後,在右下角的照片作對話框上選"Geotag",然後選"Don"



你就可以看到圖書館上有一個小小的照片縮圖,還有作邊的tag folder會出現新增的照片tag


以後,點選地圖上的小照片icon,就會出現大照片。


OK,可以關閉GoogleEarth了,會詢問你要不要update到folder,說OK就可以。

做完geotag的照片,在PicasaWeb上會出現一個小十字。


選Tool-GeoTag-View In GoogleEarth


就會自動打開GoogleEarth,並且值些顯示照片的位置喔:



附記:要是覺得以上動作很麻煩,可以買倚天出的 PDA手機,那個手機照的相片直接支援geotag,只要用PicasaWeb import照片後就OK囉。

星期二, 9月 05, 2006

Install ICD2 driver in XP with mplab 7.41

安裝方法和一班的USB裝置不一樣,他的driver在mplab 里,所以要先裝mplab。
安裝mplab ide完後,會出現一個dialog

這就是重點了,右邊"install repair driver"部分有ICD2可以選,點兩下就會出現icd2 driver安裝說明。follow那個說明來裝就可以了。

這篇文章獻給屢屢安裝失敗的leo先生。

星期一, 9月 04, 2006

XPEmbedded 使用CF 作開機裝置

MB : AMD LX800。 CF : 1G PQI. NTFS

TS買新CF,PQI 512M。拿到已經format好(FAT),放入CF USB後在NT下format成NTFS。把原來的CF檔案copy過來(System Volume 和 Recycle除外)。
boot -- Fail :" Cannot find ntldr"

在XP 系統管理下,把partition刪除再create一個partition,format成NTFS,再copy 1G image。
boot -- Fail :"No system .."

使用CF-IDE board,用spfdisk 刪除,再用dos fdisk create partition,format/s,再到spfdisk設定active (腦殘dos fdisk只能設定C:的partition為active),先copy CLE266 target board的build image,在cle266上boot OK。再copy LX800 1G CF的data。
boot -- OK。

所以很奇怪,不知道是哪一個動作才是讓NTFS boot的主要原因。


拿Kingston來試試:
連BIOS開機 Update DPMI 都沒辦法過....


星期五, 9月 01, 2006

different Name in different Language..

一個VB Script : 找出IE的ProcessID:
    Dim service,Process

Set service = GetObject("winmgmts:")
For Each Process In service.InstancesOf("Win32_Process")
If UCase(Process.Name) = "IEXPLORE.EXE" Then
Wscript.Echo Process.processID
End If
Next
其中Process.Name在日文版Windows是小寫的"iexplore.exe",在中文版是大寫的"IEXPLORE.EXE"。所以要寫一個script能在日文和中文Windows下run,就要加上 UCase,把Process.Name改成大寫。
好奇怪,語系不同,ProcessName就不同。

CPUZ - Info of CPU, Mainboard, RAM


CPUZ 是一個偵測,顯示系統hardware資訊的程式,免安裝,解開後就可以執行。
顯示的資料有很多:
  • CPU
  • Cache
  • Mainboard
  • Memory
  • SPD

星期三, 8月 30, 2006

Online Presentation Website



這個線上簡報編輯網站挺不錯的,基本功能都有,又能export成html+folder格式(一般browser就可以撥),反應速度也不錯。
還可以將簡報 publish出來,這樣只要寄link給別人就可以了,別人可以在線上看(所以也可以link在自己的 blog )。

另外還有一個remote功能,可以讓你控制公開簡報的換頁動作,所以配上只要將link寄給所有人,在將大家一起加入skype,就可以作線上簡報囉。

http://www.thumbstacks.com/index.php


喔,是免費的。

這是測試的Link (http://www.thumbstacks.com/play.html?show=98481cdd620bda98da77eeaaa3600e4b )

嗯。越用越不錯.. 速度快,還有一些標準的"Arrow", "Circle", 基本圖案可以用。

據Thumbstacks的"development blog"所述,由於 google code 提供的javascript chart library,將會有以下的圖形元件功能:


這樣就更好用囉。
希望他們加加油,以後或許有機會像writely一樣被google買下。增加 "google office online"的實力。

Google Maps and Google Earth

LinuxJournal #145, May, 2006 有一篇說明,這一篇文章已經公開 (不用access account):
http://www.linuxjournal.com/article/8932

這篇文章簡單說明使用Google Maps API的步驟 (取得id, server side scripting..etc)。
Example是用Google Maps在自己的網頁上顯示Maps和在Map上做標示。

有一篇類似的文章,是中文的,在
http://blog.yam.com/syshen/archives/347151.html


Google Maps API,最詳細的當然還是在Google :
http://www.google.com/apis/maps/documentation/


Google Maps API 的應用主要在web server上,要使用Google API,需要一個web server。client端是browser。
利用Google Maps API的產品 :http://mehere.glenmurphy.com/
安裝這個軟體,用 ie 開啟 http://localhost:7305 ,連接上gps,就可以在ie上顯示gps所在地圖
(當然,pc要有連線到google maps server的能力)。



如果是在一般desktop上,就要使用Google earth。
Google earth除了提供和Google Maps一樣的衛星地圖外,還增加了3D影像的能力。

Google earth提供客製化的方式是plugin,google earth公開plugin interface(這一點有待商確),讓user自行撰寫plugin。
有名的plugin如近來推出的3D飛行模擬。

google earth另外有定義KML格式,相關文件在 http://earth.google.com/kml/

星期一, 8月 28, 2006

Wiki is not easy..

維基百科從成立到今天,經過多人的維護,據說條目已經超過大英百科,而且還不斷的增加中。

以前因為查到的東西都不錯,所以對他也有點好印象。如果真有機會,自己也會寫些東西在裡面,當作是報答。所以每次要是發現查不到的,或是只有英文的部份,還是自己知道的,就會加上/或是修改一下Wikipedia的條目。

Wiki的編輯是有一點特殊啦,用了一陣子還是不習慣,總是要看看別人的source才知道要用甚麼tag。Server的反應也還好,最近是有點慢了起來。不曉得是自己寬頻的限制還是用戶變多了。

剩下的,就是內容的部份了..

我沒有仔細閱讀Wikipedia的說明,不知道"不是甚麼知識都可以放入Wikipedia中",所以寫了一個智力測驗的條目。結果,馬上就被投票刪除。我看到通知之後,還真是不好意思,沒幫上忙,還替大家惹了麻煩。還好,這個條目無異議,一個月後就刪除了。後來,我也小心翼翼,注意一下哪些可以當作條目,哪些不行。

前一陣子因為TS強力推薦Coda這個Filesystem,我也Google了一下,順便看看Wiki沒有。我也就順便翻譯了一下我剛剛學會的部份,大概是Coda的sourceforge網頁太過炫耀,所以,我的內容也太過炫耀了。結果:


被認為是廣告啦!

寫 維基還真不是件容易的事呀。

星期五, 8月 25, 2006

Some Writely Format Testing

用Writely 寫出漂亮的文件

這只是練習用,所以是亂寫的,別當真。

版面設定

大概常常要注意縮排,這應該是首先要注意的事。但是這是用在很明顯的大量內容的文章。如果是一般電腦常用的log方式,就是item by item,這樣。另外,要多利用Writely的"Style"。明確區分出"Header"和"Normal Paragraph"。然後在本文部份,要是當設定好"Page Spacing",讓文件看起來清爽。


內文要分斷的話,怎麼辦? 好像就只有分行? 這樣比較不方便。也不好。這樣就表示Page Spacing要大於1。才會明顯區分header和內文的不同。

使用分項符號

內容要分條列的地方,可以用分項符號
  • 用這個
  • 和這個
  • 奇怪的是,Writely的分項符號會自動縮一排
  • 所以不會對齊
  • 但也好過沒有
縮排回來,這樣有比較好嗎?至少不會亂七八糟。

使用圖片

writely也允許使用內嵌圖片,但是當po到blog時,不知道image會link到哪裡。可以試試看..

writely的image可以設定size, padding, border,limit size = 2M。但是不方便的是,不會自動縮圖,項上面的圖垂直pixel size就不對。



所以也是有一些問題存在的...
  • 像h1, h2, h3 tag的定義就不一樣,所以在writely看到的內容和實際po出來時會不一樣。
  • 圖片的link不能用,就像上面一樣,writely的link沒辦法在blogger中使用。
  • Title 不見
或許,Writely, GooglePage和Blogger本來就是不同的三種東西..

但是 Writely 的"Public"功能,好像也可以代替 GooglePages。像這一篇在Writely的Public link就是: http://www.writely.com/View.aspx?docid=ajb6rhmm7kmw_9s6sf7m

不曉得是不是所有人都看得到 ?

星期四, 8月 24, 2006

GreenPhone

最近Linux Mobile很盛行 (雖然看不到什麼實際產品)。

Trolltech 宣佈一個 greenphone的開發平台(?)。
有圖片,和實際的操作影片。看起來好像都跟真的一樣。
但是... SDK 還沒開放下載,東西還沒得買,有關比較詳細一點的資料就只有 User Guide,從那裡面,大概可以猜一下,有哪些功能和application。連到底有沒有Wifi也都要猜半天。

有forume, mailinglist, irc。但是也都是空殼,甚麼都沒有。
(是說"蓄勢待發"的態勢嗎?)。

其他的開發文件就更不用說啦。


由以前的新聞和user guide來看,介面大概是Qtopia Phone Edition。
先前Trolltech還出了一個Qtopia Phone Edition的VMware image(http://www.trolltech.com/products/qtopia/learnmore/qtopiademo),讓你可以用Vmwae來run這一個UI。

...喔,的確是這樣,greenphone的新聞網頁第一頁就有說,SDK包含QPE。

好奇怪,是2.4的kernel,大概是因為size比較小吧。

Build ViewML

備份一下...

很多Embedded System都需要Browser,但是受限於system resource。沒有辦法使用標準的Browser。需要使用功能縮減後的Browser。

ViewML 應該是目前Open Source Project中footprint最小的Browser。

他使用KFM(KDE File Manager) 1.0 核心。原作者將KFM中對Qt的API 呼叫用FLTK重新實做。去除他對KDE(Qt)的依賴。另外將FLTK 對X-lib的部份修改使用Nano-X。去除對X Server的依賴。所以ViewML 特別適合小型系統。

ViewML的缺點在於:由KFM 1.0 修改。所以只有支援HTML3.01。不支援javascript。CSS和SSL。

ViewML 需要的library有:FLTK,LibWWW


問題:
因為g++ 的STL在3.3後經過大幅度的改版,所以和2.95 版所附的STL差異很大。原作者因為相容性問題。在2001年後就停止維護ViewML。

目的:
修改ViewML code,能在目前的Linux 系統中build。 完成後再在uclinux, uClibc , STLport , Nono-X , Flnx 上build。

風險
1. 目前Linux 上的STL不知道和STLport 差異是否很大。
2. ViewML 的功能會不會太過簡單。
3. 多國語系的支援


Start :

確認developement platform 的版本( 這裡使用Debian 3.1, stable )
到 ftp.viewml.com 下載ViewML 0.23.
到 fltk.org 下載 fltk 1.1.0


check 系統有沒有安裝libwww,如果沒有,安裝libwww:

# aptitude install libwww-dev


接著build fltk :

$ ./configure –-prefix=要安裝的位置
$ make
$ make install

可以run一下test folder下的program,看看是否成功

再build ViewML:

$ ./configure –-with-fltk=剛剛buildfltk的安裝位置
$ make 2>&1 | tee makeoutput

應該會有很多error了..會log在makeoutput中


已知紀錄:

先是config.h 找不到==>作一個假的 :

$ touch src/kdecore/config.h

接著是qstringl.h 的compile error : 這是因為namespace的問題 ==>在qstring.h中加入
using namespace std;
接著是 "沒有transform( )" function。這大概是因為algo.h 太舊,改為

#include <algorithm>

找不到par.h,google了一下。有人也問過這個問題。先刪除這個include 指述。

cmath : acosf, asinf not declared.-->google一下,發現是compiler 以為要使用C99 的header。


CE BSP Installation & Deploy Image to DOM

Windows CE的BSP安裝方式... BSP的提供廠商會提供一個msi 安裝檔。
執行就可以安裝。
以VIA CLE266為例,公司網站有提供下載viacle-cn bsp 下載。
安裝後,會在Third Party下,出現BSP分支。有VIA CN400/CLE266 CEPC:x86

然後在New Platform 時,BSP部份就會有VIA這一項可以選。

Application 部份選Digital Media Receiver (Window CE devices)

新platform會出現VIA CN400/CLE266 CEPC:x86這一個category。
展開後可以看到包含Device Drier這一個分之而已,分為Audio, Display, Networking三項。

由 於network card不是使用CLE266內建的 Via Rhine NIC,而是外加RTL8139。所以在右邊 Catalog - Device Drivers - Networking - Local Area Networking (LAN) device 中,選Realtek RTL8139 加入到OS中。


之後 BuildOS - Sysgen 開始 generate system base image(要一段時間)。
完成後,會放在 WINCE500\PBWorkspace\ViaTrial1\RelDir\VIACN_x86_Release

這個動作完成後,會在release folder下產生一個nk.bin 的檔案。
這個檔案包含了kernel和一些resource。

要在PC的平台下開機,必須要作開機磁片。要利用CE Platformbuild的tool來作

這個build boot image的tool所在位置比較奇怪,在 Windows CE tools install folder中(Program Files那一個,不是WINCE500那一個)。

這個動作是要做出一個用來boot nk.bin的environment,並不會自動將剛剛build好的nk.bin copy進去。

  1. 準備一個floppy disk (如果沒有,就用vfdwin 這個floppy emulator,類似DaemonTools)。
  2. 執行websetup,會出現dialog,要求安裝目錄,安裝websetup(因為是win2000,所以他default是Win2000)。
  3. 完成後,準備1.44的floppy (真的或是vfd)。
  4. 執行 CEPB\Utility的cepcboot.144 這個image (double click on this file, though its extension is not 'EXE')
  5. 出現dialog,選floppy driver。progress bar 到100% (之後又回到0, vfd的話很快)。
  6. OK! floppy內就是 boot environment。
將DOM format成fat,DOS bootable (也就是會包含command.com)。
將剛剛做好的boot floppy內的data都copy到DOM。
到release folder,把nk.bin 複製過來。

開機,出現start DOS。接著出現resolution選單,然後screen switch,顯示Jumping to 0x0022ae8..
black screen。

所以算是 Fail.. :P

查到..應該要選local boot,那些jump xxxx的message是eboot和sboot的message。
還有即使選eboot,出現jump to 0x00XXXXX 的message,等3 min後 還是會boot起來。

在boot floppy image中有readme.txt。有一些說明:

製作boot disk的方法,除了用剛剛cepcboot.144 這個image外,也可以用format dos bootable的方式。
如果可以自己做出dos boot disk,建議使用這個方法。
CE work folder中包含一個dos boot environment : public\common\oak\csp\i486\dos\bootdisk
  1. create一個dos bootable disk
  2. 將dos 的himen.sys copy到disk中
  3. 將 ce500\public\common\oak\csp\i486\dos\bootdisk的所有內容都copy到disk中
  4. 如果需要作ether boot,就copy eboot.bin。需要由serial boot就copy sboot.bin
  5. copy 自己build好的nk.bin到disk中
  6. 修改autoexec.bat。(也可以用default的,但是啟動時要選)。
開機,出現選單,選local boot。下方出現progress bar。完成,等1 min。CE才出來 (非常的慢)。

開機出現選單是因為Autoexec.bat 和 config.sys內有選單設定。



很奇怪的是,很多application (*.exe)都是在Windows目錄下,但是大多是隱藏起來。要開啟command prompt,用dir/a 命令才會全部顯示出來。

網路的部份,開機後是顯示xx,要等約1 min才會正常。

網誌存檔