2012年11月8日 星期四

Porting New SMSC LAN9211 Driver from XSCALE to MIPS

加入platform builder 後 第一個 build 錯誤訊息
1. cannot find ndis.h,  在 \WINCE500\PUBLIC\COMMON\CESYSGEN\DDK\INC 中
2. Remove xscale-50.c xsc-util.S
3. 在 platform.h 中, comment #include "xscale-50.h" 或者不要定義 BSP_MAINSTONE (Correct Way)
然後 include "au1200_smsc.h"
4. 在 au1200_smsc.h 中定義 CACHE_LINE_BYTES  32
5. 把有 DMA_XFER 相關的CODE用 ifdef mark 起來,暫時不用DMA
6. 剩下 ChipSetup 中的 INT_DEAS 和四個未定義的函數
PlatformInitialize, PlatformDisplayInfo, PlatformSetBusWidth, PlatformSetBusTiming

Bad Database Entry 把platform 下的 build.dat 刪掉就行了

2012年11月1日 星期四

WINCE 7 Building Error (BSP)

裝好 RMI Au1200 BSP之後 build 還是會出現錯誤停住
主要是BSP build 有問題

過了之前的 compiler option 問題之後 出現以下問題

BUILD: [02:0000000219:ERRORE] f:\wince700\platform\db1200\src\drivers\usb20\ehci\cehcd.h(71) : error C2555: 'CEhcd::AddedTt': overriding virtual function return type differs and is not covariant from 'CDeviceGlobal::AddedTt'
BUILD: [02:0000000220:INFO  ]         f:\wince700\public\common\oak\drivers\usb\hcd\usb20\usb2com\cdevice.hpp(65) : see declaration of 'CDeviceGlobal::AddedTt'



主要因為 WINCE 7  OAK 中 cdevice.hpp 中class  CDeviceGlobal 的一些函式定義改變


  virtual PVOID   AddedTt( UCHAR uHubAddress,UCHAR uPort)=0;
  virtual BOOL    DeleteTt( UCHAR uHubAddress,UCHAR uPort, PVOID ttContext)=0;
  virtual LPCTSTR GetControllerName( void ) const = 0;

在 WINCE 5 中為
    virtual BOOL    AddedTt( UCHAR uHubAddress,UCHAR uPort)=0;
    virtual BOOL    DeleteTt( UCHAR uHubAddress,UCHAR uPort)=0;
    
在 WINCE 7  hcd.hpp 中 class CHcd  多了下面這個函式
  virtual DWORD GetNumOfPorts() = 0;

而舊的WINCE 有 GetNumberOfPort() 這個函式


Class Hierarchy

USB2lib --> CEhcd
CDeviceGlobal --> CHcd --> CHW --> CEhcd

在解決了AddedTt, DeleteTt, GetControllerName, 及GetNumOfPorts 之後
USB20的部份就過了

接下來在 DISPLAY 的 display.cpp 遇到阻礙
#include 找不到
gxinfo.h 為GAPI (GameX) 的header file

主要提 struct GXDeviceInfo 的定義

可是 GAPI 遠在 WINCE 5.0 之前就消失了


GPESurfRotate not defined
這個在WINCE 5 中有(Link with GPERotate.lib )  在CE 7中好像沒有了

解決了GPESurfRotate  之後 build 又遇到 link problem
如同以下

BUILD: [00:0000000063:WARNN ] F:\WINCE700\platform\DB1200\Src\Drivers\DISPLAY\: Missing source file: F:\WINCE700\public\common\oak\lib\MIPSII\retail\ctblt.lib.
BUILD: [00:0000000064:WARNN ] F:\WINCE700\platform\DB1200\Src\Drivers\DISPLAY\: Missing source file: F:\WINCE700\public\common\oak\lib\MIPSII\retail\EMUL.lib.
BUILD: [00:0000000065:WARNN ] F:\WINCE700\platform\DB1200\Src\Drivers\DISPLAY\: Missing source file: F:\WINCE700\public\common\oak\lib\MIPSII\retail\GPE_LIB.lib.
BUILD: [00:0000000078:PROGC ] Building EXPLIB Pass in F:\WINCE700\platform\DB1200\Src\Drivers\DISPLAY\ directory.
BUILD: [01:0000000091:ERRORE] Error(s) in directory "F:\WINCE700\platform\DB1200\Src\Drivers\DISPLAY\".
BUILD: [01:0000000092:ERRORE] NMAKE : fatal error U1073: don't know how to make 'F:\WINCE700\public\common\oak\lib\MIPSII\retail\ctblt.lib'


ctblt.lib EMUL.lib GPE_LIB.lib 在WINCE 6 public\common\oak\lib 中是有的
不過在 WINCE 7中就沒有了
找到以下網址有說明
http://msdn.microsoft.com/en-us/library/aa447499.aspx


You might receive linker errors while migrating a display driver from Windows CE .NET 4.1 to Windows CE .NET 4.2 and later.
As of Windows CE .NET 4.2, Sysgen variables replace the Ctblt.lib and Emul.lib static libraries, as shown in the following table.
Windows CE .NET 4.1 libraryWindows CE .NET 4.2 and later Sysgen variable
Ctblt.libSYSGEN_GPE_CLEARTYPE
Emul.libSYSGEN_GPE_NOEMUL
To fix a linker error, you might need to set the value of the SYSGEN_GPE_CLEARTYPE or SYSGEN_GPE_NOEMUL variables to 1.
Effective with Windows CE .NET 4.1, Windows CE no longer supports 2-bits-per-pixel (bpp) video drivers and hardware. The lowest supported resolution is 8 bpp.


再繼續build 下去
在 lan91c111.c 中 出現2個Warning 
since warning treated as error when compiling drivers, 所以要解決


BUILD: [01:0000000186:WARNN ] f:\wince700\platform\db1200\src\kitl\lan91c111.c(170) : warning C4013: 'VBridgeInit' undefined; assuming extern returning int
BUILD: [01:0000000187:WARNN ] f:\wince700\platform\db1200\src\kitl\lan91c111.c(171) : warning C4013: 'VBridgeKSetLocalMacAddress' undefined; assuming extern returning int


VBridgeInit() 及 VBridgeKSetLocalMacAddress((char*)mac) 未定義




再來就是 oal\oallib\power.c
extern EDBG_ADAPTER Adapter;
EDBG_ADAPTER 好像沒有定義 (本來在 Public\Common\OAK\INC\Halether.h )


還有build db1200\common\LDREBOOT 下面的 eboot.c 及 lan91c111.c 時
EDBG_ADAPTER 沒有定義





在WINCE 6
/*
 *  @struct EDBG_ADAPTER | Adapter info struct
 *
 *  Contains information pertaining to the debug Ethernet adapter.
 */
typedef struct _EDBG_ADAPTER
{
    EDBG_ADDR Addr;       // @field Ethernet and IP Address of device
    DWORD     SysIntrVal; // @field Logical interrupt for Ethernet controller. If set to EDBG_SYSINTR_NOINTR,
                          //        no interrupt will be registered, and the adapter will only be accessed
                          //        in polled mode.  This may be used for systems with limited IRQ lines, but
                          //        is not recommended due to delays in the system which may occur when packets
                          //        are dropped on the network.
    DWORD DHCPLeaseTime;  // @field Duration of DHCP IP lease in seconds
    DWORD EdbgFlags;      // @field Information about ethernet system
} EDBG_ADAPTER;




In Japan MSDN

typedef struct {
EDBG_ADDR Addr;
DWORD SysIntrVal;
DWORD DHCPLeaseTime;
DWORD EdbgFlags;}
EDBG_ADAPTER;




OAL 在WinCE 5 中並不存在
Start from CE6
http://blogs.msdn.com/b/ce_base/archive/2006/11/21/ce6-oal-what-you-need-to-know.aspx

So what did change?  In CE6 we split up three components that previously linked together to make the kernel executable, nk.exe.  CE5 the kernel, OAL and the Kernel Independent Transport Layer (KITL) all linked into nk.exe.  In CE6 these are broken into kernel.dll, oal.exe and kitl.dll.




再來就是 don't know how to make \WINCE700\PLATFORM\DB1200\LIB\MIPSII\RETAIL\stall.lib
在  \OSDesigns\XXX\Au1200\WinCE700\db1200_MIPSII_Retail\cesysgen\platform\DB1200\lib\MIPSII\retail 裏是有 stall.lib的。
先暫時從sysgen copy 過去就行了


還有在BSP GPIO 少了 oal_log.lib, 這個也是從   \OSDesigns\XXX\Au1200\WinCE700\db1200_MIPSII_Retail\cesysgen\PLATCOMM\db1200\lib\MIPSII\retail  copy 到 \WINCE700\PLATFORM\COMMON\LIB\MIPS\RETAIL 就行 $(_COMMONPLATROOT)


後面出現以下錯誤

在build BSP中的 ehcipdd ( ehci.dll )時
hcd2lib.lib( cdevice.obj ) 中找不到 CreateControlPipe, CreateIsochronousPipe, CreateBulkPipe, CreateInterruptPipe
這是因為在BSP 的ehci 中的 cpipe.cpp (ehcimdd.lib), CreateControlPipe ... 跟 WINCE 7 OAK 中的定義不同
WINCE 7 OAK 中的 CreateXXXPipe 都多了一個參數,倒數第2 個參數為 const PVOID ttContext


解決:在bsp中的 cpipe.cpp,幫 CreateXXXPipe() 多加倒數第二個參數 IN const PVOID ttContext,然後再用
UNREFERENCED_PARAMETER( ttContext ); 去除Warning


接著出現一堆 Link error, GPE::EmulatedBlt(), ..... GPE::xxxx()
Display driver 沒有Link GPE.lib 
http://support.microsoft.com/kb/247058/en-us




然後出現 KITL 少了 oal_kitl.lib, kitl_log.lib, vbridge.lib
oal_kitl.lib, kitl_log.lib 從 \OSDesigns\XXX\Au1200\WinCE700\db1200_MIPSII_Retail\cesysgen\PLATCOMM\db1200\lib\MIPSII\retail
copy 就行了,而 vbridge.lib 在WINCE5, WINCE6 的時候 是在 COMMON\OAK\LIB 下
http://msdn.microsoft.com/en-us/library/aa447112.aspx
http://msdn.microsoft.com/en-us/library/ms901803.aspx

之後又少了 oal_io.lib oal_ioctl.lib oal_cache.lib oal_cache_mips32.lib

之後在\WINCE700\platform\DB1200\Src\Bootloader\BUILDEXE\ 下面 少了 EBOOT.LIB
其路徑在WINCE5 6是指向 Public\Common\Oak\Lib 下面,但是在WINCE7 沒有在 OAK 目錄中
Eboot.lib 在\OSDesigns\XXX\Au1200\WinCE700\db1200_MIPSII_Retail\cesysgen\PLATCOMM\db1200\lib\MIPSII\retail 裏面


Eboot.lib 之後,出現了一堆 lib link error,unresolved external symbol KITLOutputDebugString 
很多Library 用到 KITLOutputDebugString
還有 inet_ntoa 及  EbootReadSerialIP



2012年10月31日 星期三

WINCE 7 Platform Builder: Cannot set an empty string on sourceFile

在安裝新的WinCE 7 之後,迫不及待地想make 新的Au1200 Image, 裝好 BSP之後 ( 指定folder 要從\WINCE600 變成 \WINCE700 或者手動 copy 整個目錄到 Platform )。 ( BSP解開的目錄 不能含有空白字元)

在 New Project --> RMI BSP -->  ... --> 之後 到最後一步 finish
就出現了視窗,寫著 Cannot set an empty string on sourceFile

搜尋這段字串 找到了一個韓國網站
又靠著Google大神偉大的翻譯 終於解決了問題

問題源由如下

The cause of this and the platform.regis platform.bib.
Usually well below two files, but 

IF XXX
ENDIF XXX 

IF XXX
ENDIF XXX!

Sometimes, several statements in the ENDIF; (semicolon) if there are attached.
For example, ENDIF ; BSP_NOKEYBD! And the same.



意思就是說 通常問題出在 platform.reg  platform.bib


IF XXX
ENDIF XXX 

IF XXX
ENDIF XXX!



在 ENDIF 之後 不能有 ; ( semicolon )
如  ENDIF ; BSP_NOKEYBD!
把 ; 去掉就 ok了


韓國人真是厲害!


platform\db1200\sources.cmn
public\common\oak\misc\makefile.def

再來遇到 assemble cache.s 時出現錯誤 /QMmips2 跟 /QMmips32 不能共用
修改 platform/db1200/sources.cmn
CDEFINES=$(CDEFINES) /QMmips32 
把 /QMmips32 拿掉就行了

再來就是 DB1200 Driver 裡的 WAVEMDD
在 wavemdd.h 中 把一些MACRO undefined 掉

#if _WIN32_WCE == 0x700
#define FUNC_WMDD(a)
#define HEXPARAM(a)
#define DECPARAM(a)
#define INTMSG(a)
#endif


再來就是 USB20\EHCI