WinCE6.0 DEVICEEMULATOR BSP在GEC2410开发板上的移植(1)-eboot及串口驱动移植

WinCE6.0自带的DEVICEEMULATOR就是基于s3c2410处理器的模拟器,我们可以经过修改让其运行在我们的GEC2410开发板上.
一. eboot
之前想直接用5.0的eboot来下载6.0的镜像,但是始终不成功,后来发现两个BSP的bib内存配置和MMU映射不一样,如果要用5.0的eboot需要修改不少配置,既然要跑6.0,就先从6.0的eboot开始吧.把原来5.0的eboot实现的功能移植到6.0的eboot就可以了.
先修改DEVICEEMULATOR的eboot,让它能够跑起来,并且能从PB下载镜像,同时支持KITL.
移植方法和之前在CE5.0上的移植过程基本相同.主要就是eboot参数在flash上的存储(Nor或Nand),LCD显示等.可以参考在CE5.0上的移植笔记:
http://blog.csdn.net/shevsten/archive/2009/07/18/4359439.aspx
http://blog.csdn.net/shevsten/archive/2009/07/06/4326267.aspx

下面就来简单介绍下移植过程,详细步骤可参考上面2篇文章.
1. 添加Nor Flash的支持(SST39VF1601)
(1)添加sst39vf1601.c驱动文件
(2)注释掉AMD Flash调用代码,去除source中引用的库.
(3)在OEMPlatformInit中原来AMD Flash初始化处调用SST39VF1601_CheckID来检测Nor Flash
if(!SST39VF1601_CheckID()) { OALMSG(OAL_ERROR, (TEXT("ERROR: OEMPlatformInit: Nor Flash initialization failed./r/n"))); OALMSG(TRUE, (TEXT("ERROR: OEMPlatformInit: Nor Flash initialization failed./r/n"))); goto CleanUp; }
2.修改eboot参数存储方式
修改WriteBootConfig和ReadBootConfig函数,设置Nor或者Nand两种存储方式(通过条件编译#ifdef NOR_BOOT,默认存储在Nor Flash中).
分别通过调用SST39VF1601_EraseFlash,SST39VF1601_WriteFlash,SST39VF1601_ReadFlash,FMD_EraseBlock,FMD_WriteSector,FMD_ReadSector来写flash.
#ifdef NOR_BOOT /* @func BOOL | WriteBootConfig | Write bootloader settings to flash. @rdesc TRUE = Success, FALSE = Failure. @comm @xref */ static BOOL WriteBootConfig(PBOOT_CFG pBootCfg) { BOOL bResult = FALSE; OALMSG(OAL_FUNC, (TEXT("+WriteBootConfig./r/n"))); if (!pBootCfg) { goto CleanUp; } // First, erase the eboot settings area in flash... // if (!SST39VF1601_EraseFlash(EBOOT_CONFIG_OFFSET, sizeof(BOOT_CFG))) { OALMSG(OAL_ERROR, (TEXT("ERROR: WriteEbootConfig: Flash erase failed./r/n"))); goto CleanUp; } // Write settings to flash... if (!SST39VF1601_WriteFlash(EBOOT_CONFIG_OFFSET, (PBYTE)pBootCfg, sizeof(BOOT_CFG))) { OALMSG(OAL_ERROR, (TEXT("ERROR: WriteEbootConfig: Flash write failed./r/n"))); goto CleanUp; } bResult = TRUE; CleanUp: OALMSG(OAL_FUNC, (TEXT("-WriteBootConfig./r/n"))); return(bResult); } #else //NAND_BOOT static BOOL WriteBootConfig(PBOOT_CFG pBootCfg) { BOOL bResult = FALSE; OALMSG(OAL_FUNC, (TEXT("+WriteBootConfig./r/n"))); if (!pBootCfg) { goto CleanUp; } // First, erase the eboot settings area in flash... // if (!FMD_EraseBlock(EBOOT_CONFIG_BLOCK)) { OALMSG(OAL_ERROR, (TEXT("ERROR: WriteEbootConfig: Flash erase failed./r/n"))); goto CleanUp; } // Write settings to flash... // if (!FMD_WriteSector(EBOOT_CONFIG_SECTOR, (PBYTE)pBootCfg, NULL,EBOOT_CONFIG_SECTOR_SIZE)) { OALMSG(OAL_ERROR, (TEXT("ERROR: WriteEbootConfig: Flash write failed./r/n"))); goto CleanUp; } bResult = TRUE; CleanUp: OALMSG(OAL_FUNC, (TEXT("-WriteBootConfig./r/n"))); return(bResult); } #endif //#ifdef NOR_BOOT
3.修改InitDisplay
修改LCD控制器参数,添加bitmap.c显示启动画面.
static void InitDisplay(void) { volatile S3C2410X_IOPORT_REG *s2410IOP = (S3C2410X_IOPORT_REG *)OALPAtoVA(S3C2410X_BASE_REG_PA_IOPORT, FALSE); volatile S3C2410X_LCD_REG *s2410LCD = (S3C2410X_LCD_REG *)OALPAtoVA(S3C2410X_BASE_REG_PA_LCD, FALSE); unsigned int XSize; unsigned int YSize; unsigned int BppMode; if (pBSPArgs->ScreenSignature == BSP_SCREEN_SIGNATURE) { YSize = pBSPArgs->ScreenHeight; XSize = pBSPArgs->ScreenWidth; switch (pBSPArgs->ScreenBitsPerPixel) { case 16: default: // assume 16bpp if the value is unsupported BppMode = 12; break; case 24: BppMode = 13; break; case 32: BppMode = 14; break; } OALMSG(OAL_WARN, (TEXT("Using emulator-specified video parameters: %dx%dx%d/r/n"), XSize, YSize, pBSPArgs->ScreenBitsPerPixel)); } else { YSize = LCD_YSIZE_TFT; XSize = LCD_XSIZE_TFT; BppMode = 12; // 16bpp } // Set up the LCD controller registers to display a power-on bitmap image. // s2410IOP->GPCUP = 0xFFFFFFFF; s2410IOP->GPCCON = 0xAAAA56A9; s2410IOP->GPDUP = 0xFFFFFFFF; s2410IOP->GPDCON = 0xAAAAAAAA; s2410LCD->LCDCON1 = (5 << 8) | /* VCLK = HCLK / ((CLKVAL + 1) * 2) -> About 7 Mhz */ (0 << 7) | /* 0 : Each Frame */ (3 << 5) | /* TFT LCD Pannel */ (BppMode << 1) | /* bpp Mode */ (0 << 0) ; /* Disable LCD Output */ s2410LCD->LCDCON2 = (2 << 24) | /* VBPD : 1 */ ((YSize-1)<< 14) | /* Vertical Size : 320 - 1 */ (2 << 6) | /* VFPD : 2 */ (4 << 0) ; /* VSPW : 1 */ s2410LCD->LCDCON3 = (8 << 19) | /* HBPD : 6 */ ((XSize-1)<< 8) | /* HOZVAL_TFT : 240 - 1 */ (8 << 0) ; /* HFPD : 2 */ s2410LCD->LCDCON4 = (LCD_MVAL << 8) | /* MVAL : 13 */ (6 << 0) ; /* HSPW : 4 */ s2410LCD->LCDCON5 = (0 << 12) | /* BPP24BL : LSB valid */ (1 << 11) | /* FRM565 MODE : 5:6:5 Format */ (0 << 10) | /* INVVCLK : VCLK Falling Edge */ (0 << 9) | /* INVVLINE : Inverted Polarity */ (0 << 8) | /* INVVFRAME : Inverted Polarity */ (0 << 7) | /* INVVD : Normal */ (0 << 6) | /* INVVDEN : Normal */ (0 << 5) | /* INVPWREN : Normal */ (0 << 4) | /* INVENDLINE : Normal */ (0 << 3) | /* PWREN : Disable PWREN */ (0 << 2) | /* ENLEND : Disable LEND signal */ (0 << 1) | /* BSWP : Swap Disable */ (1 << 0) ; /* HWSWP : Swap Enable */ s2410LCD->LCDSADDR1 = ((IMAGE_FRAMEBUFFER_DMA_BASE >> 22) << 21) | ((M5D(IMAGE_FRAMEBUFFER_DMA_BASE >> 1)) << 0); s2410LCD->LCDSADDR2 = M5D((IMAGE_FRAMEBUFFER_DMA_BASE + (XSize * YSize * 2)) >> 1); s2410LCD->LCDSADDR3 = (((XSize - XSize) / 1) << 11) | (XSize / 1); s2410LCD->LCDINTMSK |= 3; // MASK LCD Sub Interrupt s2410LCD->LPCSEL |= ~0x7; s2410LCD->TPAL = 0x0; s2410LCD->LCDCON1 |= 1; memcpy((void *)IMAGE_FRAMEBUFFER_UA_BASE, ScreenBitmap, LCD_ARRAY_SIZE_TFT_16BIT); }
CE6.0的2410BSP中nand驱动(FMD)中的错误已经得到修正.我们就不需要像在SMDK2410的BSP中那样修改了.
这样最简单的eboot就可以运行了,设置必要的参数,如IP地址等,然后就可以BOOTME了.

4.BINFS在Nand上的实现(OS镜像的烧写与加载)
接下来我们来让eboot支持BINFS在NandFlash上实现,方法和在5.0eboot中实现的方法基本一样,请参考5.0 eboot的笔记:
http://blog.csdn.net/shevsten/archive/2010/02/08/5299002.aspx
需要注意的是因为MMU映射,bib内存配置和之前5.0的配置有所不同,有些内存地址定义地址需要修改,如BINFS RAM的地址:
#define BINFS_RAM_START             (0x83E21000 | CACHED_TO_UNCACHED_OFFSET)   // uncached
#define BINFS_RAM_LENGTH            0x5000

经过测试,就可以通过以太网下载并保存OS image到Nand中,启动时可以设置自动读取Nand中的image加载到RAM中并启动CE了.
eboot的配置菜单:
WinCE6.0 DEVICEEMULATOR BSP在GEC2410开发板上的移植(1)-eboot及串口驱动移植_第1张图片
从Nand加载OS Image:
WinCE6.0 DEVICEEMULATOR BSP在GEC2410开发板上的移植(1)-eboot及串口驱动移植_第2张图片

二. 串口驱动
DEVICEEMULATOR BSP中串口驱动和SMDK2410下的串口驱动基本相同,移植方法也一样(实际上基本没什么工作),在GEC2410.bat文件中设置BSP_NOSERIAL=以及组件设置中BSP中的serial组件被选上即可。
WinCE6.0 DEVICEEMULATOR BSP在GEC2410开发板上的移植(1)-eboot及串口驱动移植_第3张图片
这里就不多做介绍了,关于驱动分析和测试程序可参考5.0下的移植笔记:
SMDK2410 Serial驱动移植及测试程序:
http://blog.csdn.net/shevsten/archive/2010/02/02/5280367.aspx
Serial驱动分析:
http://blog.csdn.net/shevsten/archive/2010/06/08/5655749.aspx
http://blog.csdn.net/shevsten/archive/2010/06/10/5661216.aspx
http://blog.csdn.net/shevsten/archive/2010/06/13/5668696.aspx

你可能感兴趣的:(image,Flash,存储,Parameters,WinCE,initialization)