Windows Embedded开发之如何开发一个Boot Loader(一般性描述)

How to Develop a Boot Loader
如何开发一个Boot Loader


1. Build a complete platform based on a sample BSP for the CPU you intend to target.
生成一个完整平台 ---> Creating an OS Design with the Windows Embedded CE OS Design Wizard
 
2. Create a directory for your new boot loader code.
为你的新boot loader代码创建一个目录
 
3. Set up a command-line build shell to create and build the boot loader.
建立一个命令行生成shell以创建和输出这个boot loader

4. Generate all static libraries required by the boot loader image.
生成这个boot loader映像所需要的所有静态库
At the command prompt, enter the following command: Copysysgen

5. Create a file for your boot loader's StartUp function, and then establish a function framework as a starting point.
 为你的boot loader的StartUp函数创建一个文件,然后建立一个函数框架作为一个起点。---> Creating a File for the Boot Loader StartUp Function
 
6. Create a sources file and makefile file in the boot loader directory.
 在boot loader目录建立一个sources文件和makefile文件 ---> Creating the Boot Loader Sources and Makefile Files
 
7. Build your first boot loader executable (.exe) file.
 生成你的第一个boot loader可执行文件 ---> Building the Boot Loader Source Code
 
8. Implement the boot loader's StartUp function.
 实现boot loader的StartUp函数 ---> Implementing the Boot Loader StartUp Function
 
9. Create a boot loader main function.
创建一个boot loader main函数 ---> Creating the Boot Loader Main Function
This is typically using C programming language.
Starting with this step, all boot loader code should be able to operate in C instead of assembly language.

10. Create stub versions for a number of OEM functions, including generic hardware platform routines and flash memory operations.
 为一些OEM函数创建stub版本 ---> Creating Stubs for the Boot Loader OEM Functions
 
11. Add the new source files, Main.c. and Flash.c, created in the previous step to the SOURCES line in the sources file.
把先前步骤中创建的源文件Main.c和Flash.c添加到sources文件的SOURCES行 ---> Editing the Boot Loader Sources File
Add a TARGETLIBS entry that includes references to the BLCOMMON, GSNull, and FullLibc libraries.

12. Create the .bib file, which will be used by Romimage.exe to convert the boot loader .exe file into .bin and .nb0 files.
创建.bib文件 ---> Creating the Boot Loader .bib File
被Romimage.exe用于把boot loader .exe文件转换为.bin和.nb0文件

13. Rebuild the boot loader.
重新生成boot loader ---> Rebuilding the Boot Loader
Note:
After this point, the basic boot loader source infrastructure is in place.
Note:
To complete the remaining steps of this procedure, you must do the following:
Fully implement the routines that were stubbed
Add incremental functionality to the boot loader
Rebuild the boot loader
Test the functionality of the loader up to that point
 
14. Implement the following serial debug functions in your boot loader code:
实现下列串口调试函数 ---> Implementing the Serial Debug Functions
OEMDebugInit
OEMWriteDebugString
OEMWriteDebugByte
OEMReadDebugByte 
 
15. Rebuild the boot loader and verify that your code works by testing it on the target device.
重新生成boot loader并证实你的代码能够工作 ---> Rebuilding the Boot Loader
You should now be able to verify the following:
The startup code initializes the CPU
The debug routines initialize and write debug text to the serial universal asynchronous receiver-transmitter (UART).
If you encounter problems, verify that you correctly implemented serial debug functions.
 
16. Create the driver globals andboot args shared data areas.
 创建驱动全局和引导参数共享数据区 ---> Creating Driver Globals and Boot Args
 
17. Implement the remaining hardware platform initialization code by implementing theOEMPlatformInit function.
 通过实现OEMPlatformInit函数实现余下的硬件平台初始化代码 ---> Implementing the OEMPlatformInit Function
 
18. Add Ethernet debug libraries that have routines referenced in OEMPlatformInit to the TARGETLIBS entry in the boot loader sources file.
把以太网调试库添加的boot loader sources文件的TARGETLIBS项 ---> Editing the Boot Loader Sources File
 
19. Implement the following Ethernet controller-related functions:
实现以下以太网控制器相关函数 ---> Implementing the Ethernet Controller-Related Functions
OEMReadData
OEMEthGetFrame
OEMEthSendFrame
OEMEthGetSecs

 
20. Implement the OEMPreDownload function.
 实现OEMPreDownload函数 ---> Implementing the OEMPreDownload Function
 
21. Test boot loader communications by doing the following:
测试boot loader通信功能
Verify that the code can obtain an IP address from the DHCP server and can retrieve the user settings from Platform Builder.
Verify that your device name appears in Platform Builder.

22. Create a test .bin file to download from Platform Builder.
 创建一个测试.bin文件以从Platform Builder下载 ---> Creating a Test .bin File for Download
 
23. Verify that the boot loader can use Platform Builder to download a .bin file.
 证实这个boot loader 可以使用Platform Builder下载一个.bin文件 ---> Verifying .bin File Download
 
24. Implement the OEMLaunch function.
实现OEMLaunch函数
Note:
After you complete this step, you have essentially completed development of the boot loader.
Note:
The boot loader should now be able to
Initialize the hardware platform.
Obtain an IP address from a DHCP server.
Establish contact with Platform Builder.
Download a .bin file.
Obtain user preferences from Platform Builder.
Execute the downloaded run-time image.
Note:
To complete the remaining steps in this procedure, you must add support for writing the downloaded boot loader image to flash memory.
Note:
By doing so, the boot loader can update its own saved image.

25. Implement the OEMIsFlashAddr function.
 实现OEMIsFlashAddr函数 ---> Implementing the OEMIsFlashAddr Function
 
26. Implement the OEMMapMemAddr function.
 实现OEMMapMemAddr函数 ---> Implementing the OEMMapMemAddr Function
 
27. Implement the following flash memory erase functions:
实现下列flash存储器擦除函数 ---> Implementing the Flash Memory Erase Functions
OEMStartEraseFlash
OEMContinueEraseFlash
OEMFinishEraseFlash
 
28. Implement the OEMWriteFlash function.
 实现OEMWriteFlash函数 ---> Implementing the OEMWriteFlash Function
 
29. Modify the .bib file to produce a boot loader image that downloads to flash memory.
修改.bib文件以产生一个能下载到flash存储器的boot loader映像 ---> Modifying the .bib File to Produce a Downloadable Image

 
30. To add support for download progress indication, implement the OEMShowProgress function.
实现OEMShowProgress函数 ---> Adding Support for Download Progress Indication
 
31. To verify the RAM or flash memory used by the run-time image before the run-time image is downloaded completely, add support formemory verification.
 添加对存储器验证的支持 ---> Adding Support for Memory Verification
 
32. If you are developing a multi-BIN run-time image and you would find multi-BIN run-time image notification useful, add support formulti-BIN run-time image notification.
 添加对多BIN运行时映像通知的支持 ---> Adding Support for Multiple-BIN Image Notification
 
33. To have your boot loader validate the run-time image before downloading or running it, add support forrun-time image signatures.
添加对运行时映像签名的支持 ---> Adding Support for Image Signatures 
 
注:仅供参考

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值