WinCE Eboot中的BLCOMMON

<!-- /* Font Definitions */ @font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:SimSun; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-charset:1; mso-generic-font-family:roman; mso-font-format:other; mso-font-pitch:variable; mso-font-signature:0 0 0 0 0 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} @font-face {font-family:"/@宋体"; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; mso-pagination:none; font-size:10.5pt; mso-bidi-font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-fareast-font-family:宋体; mso-bidi-font-family:"Times New Roman"; mso-font-kerning:1.0pt;} p {mso-style-noshow:yes; mso-style-priority:99; margin:0cm; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:宋体; mso-bidi-font-family:宋体;} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; font-size:10.0pt; mso-ansi-font-size:10.0pt; mso-bidi-font-size:10.0pt; mso-ascii-font-family:Calibri; mso-fareast-font-family:宋体; mso-hansi-font-family:Calibri; mso-font-kerning:0pt;} /* Page Definitions */ @page {mso-page-border-surround-header:no; mso-page-border-surround-footer:no;} @page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:36.0pt; mso-footer-margin:36.0pt; mso-paper-source:0;} div.Section1 {page:Section1;} -->

EBOOT 中,从 Startup.s 跳转到 C 程序入口以后,程序就可以用 C 语言来编写了,这样感觉就好多了。一般 C 语言的入口就是一个 Main 函数,也可能叫其他的名字。在这个 Main 函数中会掉用 BootloaderMain 函数,该函数在 BLCOMMON 模块中被定义的。一般 Main 函数的写法如下:

 

void (void)

{

    // Common boot loader (blcommon) main routine.

    BootloaderMain();

 

    // Should never get here.

    SpinForever();

}

 

从程序中可以看出, EBoot 在进入 C 程序以后,只调用了 BootloaderMain 函数,至于 SpinForever 函数实际上就是一个 while 的死循环。所以可以看出, Eboot 的所有工作都在 BootloaderMain 中完成,源代码可以在 ” /WINCE600/PUBLIC/COMMON/OAK/DRIVERS/ETHDBG/BLCOMMON” 里找到。具体流程如图:

http://space.ednchina.com/upload/2009/11/15/7e8f6339-7956-4cec-b708-eea766dd210d.jpg

 

下面介绍一下具体步骤:

 

1. BootloaderMain 函数首先调用 KernelRelocate 函数将 Bootloader 中用到的全局变量拷贝到 RAM 中。

2. 然后调用 OEMDebugInit 函数来初始化 Debug 调试功能,一般都是初始化串口,这样从这里以后就可以使用串口打印调试信息了。

3. 之后调用 OEMPlatformInit 函数,来对板子进行初始化,很多和平台相关的初始化工作都可以在这个函数中完成。

4. 调用 OEMPreDownload 函数,从流程上来说应该是为下载内核做一些准备工作,该函数执行后,根据返回值得不同可以选择下载内核,或者跳转执行。实际上,该函数中首先会读取 Boot 配置信息,然后初始化下载设备,一般是网卡设备。

5. 如果 OEMPreDownload 函数返回 BL_DOWNLOAD 时,将会从主机下载 WinCE image

6. 如果 OEMPreDownload 函数返回 BL_JUMP 时,直接跳转到 WinCE image 所在的位置开始执行。

 

其中涉及的 OEM 函数都是需要用户自己实现的,然后被 BLCOMMON 模块来调用。这些函数会在以后介绍。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值