11.30.2007

DEBUGMSG FUNCTION_ENTER_MSG.

FUNCTION_ENTER_MSG();
在usbfn.h中..
#define FUNCTION_ENTER_MSG() DEBUGMSG(ZONE_FUNCTION, (_T("%s ++\r\n"), pszFname))
#define FUNCTION_LEAVE_MSG() DEBUGMSG(ZONE_FUNCTION, (_T("%s --\r\n"), pszFname))
ZONE_FUNCTION 又定義在..dbgapi.h
#define DEBUGZONE(n)  (dpCurSettings.ulZoneMask&(0x00000001<<(n)))
這個變數 dpCurSettings ...

11.27.2007

紀錄一下...boot 起來的log

但是也只有boot,不知道有沒有OK..
Enter your selection: u
+TOC_Write
[OK] Write 1 th Block Success
-TOC_Write
System ready!
Preparing for download...
Please send the Image through USB.

Download BIN file information:
-----------------------------------------------------
[0]: Base Address=0x80040000 Length=0x15ef28
[1]: Base Address=0x80200000 Length=0xef97d4
[2]: Base Address=0x81400000 Length=0x528
-----------------------------------------------------
RAM image
rom_offset=0x0.
RAM image
rom_offset=0x0.
RAM image
ROMHDR at Address 80040044h
+WriteOSImageToBootMedia: g_dwTocEntry =1, ImageStart: 0x80040000, ImageLength: 0x15ef28, LaunchAddr:0x800704fc
g_dwMBRSectorNum = 0xa000
Erase Block from 0xa, to 0x3b
Found the Chain region: StartAddress: 0x81400000; Length: 0x528
Writing multi-regions
BINFSPartMaxLength[0]: 0x4000, TtlBINFSPartLength: 0x4000
dwMaxRegionLength[2]: 0x4000
BINFSPartMaxLength[1]: 0x1c0000, TtlBINFSPartLength: 0x1c4000
dwMaxRegionLength[0]: 0x1c0000
BINFSPartMaxLength[2]: 0x1200000, TtlBINFSPartLength: 0x13c4000
dwMaxRegionLength[1]: 0x1200000
dwBlock = 10
OpenPartition: dwStartSector = 0xa000.
OpenPartition: dwNumSectors = 0x15000.
OpenPartition: dwPartType = 0x21.
OpenPartition: fActive = 0x1.
OpenPartition: dwCreationFlags = 0x2.
IsValidMBR: MBR sector = 0xa000
.OpenPartition: Invalid MBR. Formatting flash.
Enter LowLevelFormat [0xa, 0x1e].
BP_LowLevelFormat: // Erase all the flash blocks.
BP_LowLevelFormat: // Erase all the flash blocks.-End
WriteMBR: MBR block = 0xa.
WriteBlock: dwMBRBlockNum = 0xa.
Done.

CreatePartition: Enter CreatePartition for 0x21.
CreatePartition: Start = 0x1000, Num = 0x15000.
WriteMBR: MBR block = 0xa.
WriteBlock: dwMBRBlockNum = 0xa.
nCount = 0
BP_SetDataPointer at 0x1600000
BP_WriteData: Start = 0x1600000, Length = 0x15ef28.
BP_WriteData: dwSectorAddr = 0xb000, dwOffsetSector = 0x0.
BP_WriteData: dwNumSects = 0xaf0
BP_WriteData: dwNumExtraBytes = 0xf28
BP_WriteData: dwSectorAddr = 0xb000
BP_WriteData: dwNumSects = 0xaf0
BP_WriteData: dwSectorAddr = 0xbaf0
BP_WriteData: pbBuffer = 0xac95e000
Updateded TOC!
nCount = 1
BP_SetDataPointer at 0x17c0000
BP_WriteData: Start = 0x17c0000, Length = 0xef97d4.
BP_WriteData: dwSectorAddr = 0xbe00, dwOffsetSector = 0x0.
BP_WriteData: dwNumSects = 0x77c0
BP_WriteData: dwNumExtraBytes = 0x17d4
BP_WriteData: dwSectorAddr = 0xbe00
BP_WriteData: dwNumSects = 0x77c0
BP_WriteData: dwSectorAddr = 0x135c0
BP_WriteData: pbBuffer = 0xad8b8000
nCount = 2
BP_SetDataPointer at 0x29c0000
BP_WriteData: Start = 0x29c0000, Length = 0x528.
BP_WriteData: dwSectorAddr = 0x14e00, dwOffsetSector = 0x0.
BP_WriteData: dwNumSects = 0x0
BP_WriteData: dwNumExtraBytes = 0x528
BP_WriteData: dwSectorAddr = 0x14e00
BP_WriteData: dwNumSects = 0x0
BP_WriteData: dwSectorAddr = 0x14e00
BP_WriteData: pbBuffer = 0xadbc0000
Written Chain Region to the Flash
LoadAddress = 0x81400000; FlashAddress = 0x0; Length = 0x20
memcpy : g_pTOC->chainInfo.dwLoadAddress = 0x81400000; dwRegionStart = 0xADBC0000; dwRegionLength = 0x528
-WriteOSImageToBootMedia
+TOC_Write
[OK] Write 1 th Block Success
-TOC_Write
TOC {
dwSignature: 0x434F544E
BootCfg {
ConfigFlags: 0x2820
BootDelay: 0x5
ImageIndex: 1
IP: 0.0.0.0
MAC Address: 00:00:00:00:00:00
Port: 0.0.0.0
SubnetMask: 255.255.255.0
}
ID[0] {
dwVersion: 0x20004
dwSignature: 0x45424F54
String: 'eboot.nb0'
dwImageType: 0x2
dwTtlSectors: 0x400
dwLoadAddress: 0x8C038000
dwJumpAddress: 0x8C038000
dwStoreOffset: 0x0
sgList[0].dwSector: 0x3000
sgList[0].dwLength: 0x400
}
ID[1] {
dwVersion: 0x1
dwSignature: 0x43465348
String: ''
dwImageType: 0x2
dwTtlSectors: 0xAF8
dwLoadAddress: 0x80040000
dwJumpAddress: 0x800704FC
dwStoreOffset: 0x0
sgList[0].dwSector: 0x0
sgList[0].dwLength: 0xAF8
}
chainInfo.dwLoadAddress: 0X81400000
chainInfo.dwFlashAddress: 0X00000000
chainInfo.dwLength: 0X00000020
}
RAM image
RAM image
Read OS image to BootMedia
ImageLength = 1437696 Byte
Start Page = 2816, End Page = 2991, Page Count = 176
.
Read OS image to BootMedia Success
waitforconnect
INFO: OEMLaunch: Jumping to Physical Address 0x33E704FCh (Virtual Address 0x800704FCh)...


Windows CE Kernel for ARM (Thumb Enabled) Built on Jun 24 2004 at 18:25:00
ProcessorType=0920 Revision=0
sp_abt=ffff5000 sp_irq=ffff2800 sp_undef=ffffc800 OEMAddressTable = 800707b0
DCache: 8 sets, 64 ways, 32 line size, 16384 size
ICache: 8 sets, 64 ways, 32 line size, 16384 size
FCLK:534000000, HCLK:133500000, PCLK:66750000
Sp=ffffc7cc
[OEMIO:INF] + IOCTL_HAL_POSTINIT
[OEMIO:INF] - IOCTL_HAL_POSTINIT
+OALIoCtlHalInitRTC(...)
+OEMSetRealTime(2005/5/27 12:0:0.000)
-OEMSetRealTime(rc=1)
OEMIoControl: Unsupported Code 0x101008c - device 0x0101 func 35
[HALWP:INF] nCtrlCode = PM_HAL_FIL_INIT
[FIL] ################
[FIL] MID = 0xec
[FIL] DID = 0xd7
[FIL] HID[0] = 0x55
[FIL] HID[1] = 0xb6
[FIL] HID[2] = 0x78
[FIL] ################
[FIL] ##############################
[FIL] FIL Global Information
[FIL] BANKS_TOTAL = 2
[FIL] BLOCKS_PER_BANK = 2048
[FIL] TWO_PLANE_PROGRAM = 1
[FIL] SUPPORT_INTERLEAVING = 1
[FIL] SUBLKS_TOTAL = 2048
[FIL] PAGES_PER_SUBLK = 256
[FIL] PAGES_PER_BANK = 262144
[FIL] SECTORS_PER_PAGE = 8
[FIL] SECTORS_PER_SUPAGE = 16
[FIL] SECTORS_PER_SUBLK = 4096
[FIL] USER_SECTORS_TOTAL = 7598080
[FIL] ADDRESS_CYCLE = 5
[FIL] ##############################

[INFO] WMR_AREA_SIZE = 10
[INFO] SPECIAL_AREA_START = 10
[INFO] SPECIAL_AREA_SIZE = 50
[INFO] VFL_AREA_START = 60
[INFO] VFL_AREA_SIZE = 106
[INFO] VFL_INFO_SECTION_START = 60
[INFO] VFL_INFO_SECTION_SIZE = 4
[INFO] RESERVED_SECTION_START = 64
[INFO] RESERVED_SECTION_SIZE = 102
[INFO] FTL_INFO_SECTION_START = 166
[INFO] FTL_INFO_SECTION_SIZE = 10
[INFO] LOG_SECTION_SIZE = 7
[INFO] FREE_SECTION_START = 176
[INFO] FREE_SECTION_SIZE = 17
[INFO] FREE_LIST_SIZE = 3
[INFO] DATA_SECTION_START = 193
[INFO] DATA_SECTION_SIZE = 1855
[INFO] FTL_AREA_START = 166
[INFO] FTL_AREA_SIZE = 1882
[HALWP:INF] nCtrlCode = PM_HAL_VFL_INIT
[HALWP:INF] nCtrlCode = PM_HAL_VFL_OPEN
[BIBDRV:INF] stNandInfo.dwPagesPerSuBlk = 0x100
[BIBDRV:INF] stNandInfo.dwSectorsPerSuPage = 0x10
[BIBDRV:INF] stNandInfo.dwSpecialAreaSize = 0x32
[BIBDRV:INF] stNandInfo.dwSpecialAreaStart = 0xA
[BIBDRV:INF] MBR MAGIC CODE (First): 0xe9,0xfd,0xff
[BIBDRV:INF] MBR MAGIC CODE (Last) : 0x55,0xaa
[BIBDRV:INF] Part_BootInd = 0x0
[BIBDRV:INF] Part_FirstHead = 0x1
[BIBDRV:INF] Part_FirstSector = 0x1
[BIBDRV:INF] Part_FirstTrack = 0x0
[BIBDRV:INF] Part_FileSystem = 0x21
[BIBDRV:INF] Part_LastHead = 0x15
[BIBDRV:INF] Part_LastSector = 0x0
[BIBDRV:INF] Part_LastTrack = 0x0
[BIBDRV:INF] Part_StartSector = 4096
[BIBDRV:INF] Part_TotalSectors = 86016
BIBDRV_PS:GetProfileName - Profile = SMFlash, length = 16
[BIBDRV:MSG] DSK_IOControl unkonwn code(71c24)
OEMIoControl: Unsupported Code 0x1010104 - device 0x0101 func 65
OEMIoControl: Unsupported Code 0x10100d0 - device 0x0101 func 52
OEMIoControl: Unsupported Code 0x10100f8 - device 0x0101 func 62
Try to open Drivers\Active\02
DevIndex 0
DEBUG: CreateSerialObject 0
Try to open Drivers\Active\03
DevIndex 2
DEBUG: CreateSerialObject 2
Try to open Drivers\Active\04
DevIndex 3

11.22.2007

很糟糕的作法..
#include <..\\..\\kernel\\oal\\debug.c>
所以若是用 function name : OEMInitDebugSerial 來search,
會找到 oal 下的 debug.c,而以為會 link oal libary...
使用close source 的東西真是浪費時間。
尤其是 close source part 既然有使用到 外界定義的global variable (還很多)。
誰知道動了哪一個global variable 會讓那一部份fail 呀。

真是浪費時間

becuase it's C

typedef name "Addr" used in  expression context
這個error..

Addr 是typedef 的structure type。

error 的位置是...
static Addr LBAtoCHS(FlashInfo *pFlashInfo, Addr lba)
{
if(lba.type == CHS)
return lba;

Addr chs;
DWORD tmp = pFlashInfo->dwNumBlocks * pFlashInfo->wSectorsPerBlock;
...

結果...
錯誤的原因是..
這是 C,不是C++,所以所有變數都要先宣告在第一個expression 之前..
不懂為什麼這麼多人要定義 WORD,BYTE,DWORD...
直接用 unsigned short, char, unsigned long 不好嗎?

大家都要用自己的名子 (再加上模組化 做得不好),最後就是..
typedef short SHORT;
typedef long LONG;

typedef signed char INT8;
typedef unsigned char UINT8;
typedef signed short INT16;
typedef unsigned short UINT16;
typedef signed int INT32;
typedef unsigned int UINT32;

typedef unsigned char uchar;
typedef unsigned short ushort;
typedef unsigned int uint;
typedef unsigned long ulong;

typedef unsigned long ULONG;
typedef unsigned short USHORT;
typedef unsigned char UCHAR;

typedef unsigned long DWORD;
typedef int BOOL;
typedef unsigned char BYTE;
typedef unsigned short WORD;

typedef int INT;
typedef unsigned int UINT;

typedef short Int16;
typedef unsigned short UInt16;
typedef unsigned long UInt32;
typedef unsigned char UInt8;

#define U32 unsigned int
#define U16 unsigned short
#define S32 int
#define S16 short int
#define U8 unsigned char
#define S8 char

typedef unsigned int uint32;
typedef unsigned short uint16;
typedef unsigned char uint8;
typedef signed int int32;
typedef signed short int16;
typedef signed char int8;
他們沒有想過自己的code,有一天,會要和其他人的code一起工作嗎 ?

讓自己寫的code可以讓很多人方便的使用,不是比較好嗎?
還是自己寫得爽比較重要 ?

11.19.2007

hg 啟動內建的 http server -- part II

繼續..

每個 repository 可以自行設定一些特徵.. web style.. authorization... zip download support ..
就是利用每個 repository 下 .hg 目錄裡的 hgrc 檔 (要自己 create)

以下就是為了方便所寫的 hgrc 內容..
[web]
style = gitweb
allow_archive = bz2 gz zip
push_ssl = false
allow_push = *
這是..
  • 改用 git style 的 wen interface (比較詳細)。
  • 增加 bz2, gz, zip 的source snapshoot 下載
  • 不必用 ssl (因為不知道在windows command 下怎麼用 :P)
  • 允許 經由 http 作push 的動作 (可以讓別人 checkin)

hg 啟動內建的 http server

hg 的內建 webserver。

一般使用:

到已經開啟好 (init完畢)的 repository (例如 c:\writeMLC) 目錄下..
hg serve -p 8002
然後開啟 browser,到address
http://127.0.0.1:8002/
就可以看到那個repository 的資料..

一方面可以作為command line模式的"friendly front end" 替代品。
另一方面,可以跟同事share code。

如果有多個 repository ,就要用 webdir-conf 這個選項。
編輯一個設定檔,指定 web server path 和 repository 得關聯性:
編輯 一個檔案 (我叫 webdirconf)
[paths]
writeMLC = C:\Whimery\DownloadWriteMLC
UseYagarto = C:\Yagarto\UseYagarto
BootRun = C:\BootRun\BootRun_Robert
在啟動 hg serve 時,加上
hg serve -p 8002 --webdir-conf webdirconf
然後在 browser上,就會是..


可以看到..每個repository ...

11.12.2007

VSS impoter - migrate from VSS to SVN

從 VSS import 到SVN 的工具 : SVNImporter

這是一個用java寫的opensource 的工具,可以將source repository 由 VSS 轉移到 SVN 。

方法好像是 :將package解開,依照需要修改 config.properties。然後下command。

config.properties 裡面的sample 是以 windows 平台為例子的。

... 所以仔細來看,應該也不是真正 import VSS,因為 VSS中各revision 的checkin, out owner 資訊會喪失。

.. 大概是這樣吧,目前還沒正式run.

install java in Debian

sun-java 屬於 "non-free" ,所以要在 sources.list 中加入 "non-free"。

如果只是需要執行環境,就只需要安裝
  • sun-java6-jre
  • sun-java6-plugon
  • sun-java6-fonts
如果要寫java,要加裝
  • sun-java6-jdk
裝完後,command :
$java -version
看java版本。
java不是也GPL了嗎 ? 為甚麼還是在 "non-free" ?

svn http, user-password and access control

使用 http:// 作為svn 的 url,是利用 apache 的 dav_svn module。
dav 是 (distribution authorization and versioning ,是 http 協定的一個擴充)。
AuthUserFile  /etc/apache2/dav_svn.passwd
AuthzSVNAccessFile /etc/apache2/dav_svn.authz
所以
  1. 要先準備好這兩個file,並且 follow .conf 的內容,擺在對應的path 中
  2. user-passwd file 的內容是用 htpasswd 操作的,add user, change password 都要用htpasswd 來作。
  3. svn 下各個 folder 的access 權限就由 dav_svn.authz 設定。 這個file 是plain text。
Add User :
htpasswd  'target .passwd file' user-name
這裡 'target.passwd file' 就是 /etc/apache2/dav_svn.passwd.

權限設定:
[/]
* =
guest = r
svntest = rw
charles-chang = rw
意思是對 [/] 目錄的權限設定:
* - 所有人 - 無法access
guest - 僅能讀取,無法修改
svntest, charles-chang 都是一般user,可以讀取,修改。
當然,要用htpasswd把 guest, svntest, charles-chang都加到 user-passwd file 中
僅能讀取的 user 一樣可以最 checkout,add file.. 但是在 commit 時會出現 error,svn log上也不會有 該user的更動紀錄。

mod-python in apache2

安裝完 libapache2-mod-python 後, 測試一下..

修改 /etc/apache2/httpd.conf 加入下面的部份 (測試完後,再刪掉)
<Location /mpinfo>
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler mod_python.testhandler
</Location>
reload apache2 ,或是用 a2enmod mod_python 將module load進來。

然後開啟 browser,網址 : http://10.1.1.152/mpinfo 就可以看到 python module info page。

11.10.2007

folder 方式 access subversion folder

在 svn-book 看到的。
在 Windows XP 中使用 file explorer 瀏覽 WebDAV folder。

據說是 XP 的bug。
在 傳送 authorization 時,為一直用 Host\username,這是不符合 WebDAV規定的,所以會不成功。

所以在 網路芳鄰中新增網路位置時,要 把 port 寫上去..
http://host:80/repository