Partager via


Ethernet Boot Loader Code Implementation (Windows CE 5.0)

Send Feedback

Typically, you use an Ethernet connection to download run-time image files to a target device. The Ethernet boot loader communicates with Microsoft Platform Builder running on the development workstation to download run-time images and configure debugging services. An Ethernet connection provides faster image transfer and better integration with the Windows CE Ethernet debugging services.

When you download the contents of a ROM image into RAM or flash memory on a target device, Windows CE treats the region of memory into which the image is loaded as ROM. This saves you from burning a new ROM each time you test a new image, but allows you to emulate the ROM-based environment. The following process shows the steps an Ethernet boot loader completes to download a run-time image:

  1. The boot loader formats and sends a broadcast Ethernet debugging BOOTME packet.

    The format of the packet is defined in %_WINCEROOT%\Public\Common\Oak\Inc\Ethdbg.h. This packet informs Platform Builder of target device availability and contains the target device IP address and name. Platform Builder uses this information to initiate the download of the run-time image.

  2. The boot loader initiates a Trivial File Transfer Protocol (TFTP) to transfer the run-time image to the target device.

    This step is skipped if you do not download an image, for example, if the target device boots with a run-time image previously written to flash memory.

  3. When the download is complete, the debug tool in control sends an Ethernet debugging JUMPIMG packet. %_WINCEROOT%\Public\Common\Oak\Inc\Ethdbg.h defines the format of the packet.

    The packet instructs the boot loader to jump to the loaded run-time image and contains run-time image information necessary to configure the Ethernet debugging services. Depending on the implementation, the boot loader might pass this run-time image information to the OAL in a shared memory section.

Platform Builder provides Eboot.lib, a support library, to assist you in developing Ethernet boot loaders. Eboot.lib is in %_WINCEROOT%\Public\Common\Oak\Drivers\Ethdbg\Eboot directory.

The following table shows the hardware platform-independent routines for Eboot.lib.

Routines Description
DHCP routines Used to obtain a dynamic IP address at boot time from a DHCP server
TFTP routines Used to download a run-time image to a target device
Ethernet debugging routines Used to assist in formatting the Ethernet debugging messages, which are used to communicate

Platform Builder includes the BLCOMMON library, which is a common infrastructure that can be reused by all boot loaders. For a description of the functions in the new BLCOMMON infrastructure, see the source and header files in %_WINCEROOT%\Public\Common\Oak\Drivers\Ethdbg\Blcommon\Blcommon.c and %_WINCEROOT%\Public\Common\Oak\Inc\Blcommon.h, respectively. The following process describes the flow of control with this infrastructure:

  1. During the hardware platform boot process, the startup code in the OEM adaptation layer (OAL) calls the hardware platform-independent BootloaderMain function.
  2. BootloaderMain initializes the hardware platform, chooses the download transport, and then initializes the download transport by calling a set of control flow functions.
  3. The boot loader starts downloading the image to the target device using a set of download and flash functions. During the download process, the boot loader might implement functions to show download progress.
  4. When the download is complete, the boot loader boots the OS by calling the OEMLaunch function, which jumps to the OS entry point.

For more information about the control flow, download, and flash functions, see BLCOMMON Code Library.

The easiest way to develop your boot loader code is to begin with and reuse existing sample code included with Windows CE. Windows CE provides sample boot loader code for each hardware platform that Windows CE supports. The boot loader code is available as part of the BSP for that hardware platform and is typically in the %_WINCEROOT%\Platform*\<Hardware Platform Name>*\Src\BootLoader\Eboot directory. For a list of all BSPs supported in Platform Builder, see Supported Board Support Packages.

**Note   **All of the sample boot loaders developed for Windows CE BSPs use the Ethernet port for downloading run-time images. However, you can also use alternative methods in your boot loader for downloading run-time images, as long as you install the run-time images in a reliable manner. At a minimum, you will still be required to modify a reference boot loader to properly initialize your board. You must write only hardware platform-specific and CPU-specific code modules for the boot loader. These modules initialize the CPU, the serial port, and the Ethernet adapter for a target device.

For simplicity and to reuse as much code as possible, the boot loader typically uses the same routines implemented in the OAL kernel source code for CPU and board-level initialization, including PCI, serial UARTs, and Ethernet controllers.

A debug serial port is an I/O channel used for debugging a device driver or target device. This is different from the normal serial port code, which is implemented in driver form in Serial.dll.

The following table summarizes the boot loader elements that you must implement.

Boot loader element Description
OEM startup code The OEM-specific startup routine that initializes the kernel.

It jumps to the main entry point implemented in %_WINCEROOT%\Platform\<Hardware Platform Name>\Src\BootLoader\Eboot\Main.c.

Kernel startup code A minimal version of the normal kernel startup code for the boot loader used primarily to initialize the cache.
OEM hardware platform initialization code The OEM-specific code that can include functionality such as displaying a splash screen or checking switches to allow alternate entry to diagnostic code or to the firmware monitor.

A splash screen is an initial screen that is displayed by interactive software, which usually contains a logo, version information, author credits, or a copyright notice.

The following table summarizes the boot loader elements that you should implement if you want to download your run-time image.

Boot loader element Description
Image download code Code that downloads a run-time image using the download transport.
Ethernet I/O code Code that downloads a run-time image using an Ethernet connection.
Debug serial I/O code Routines that read and write data to the debug serial port.

To simplify development of the debug serial port support I/O code, use a standard universal asynchronous receiver transmitter (UART) on the target device. The standard UART should be 16550-compatible.

The boot loader uses the same debug serial port routines implemented in the OAL.

For more information, see Enabling the Debug Serial Port.

Flash write code (optional) Routines that write data to flash memory.

This code is necessary for your boot loader to support downloading and flashing the image into nonvolatile storage for later use.

Firmware monitor (optional) Routines that provide debugging support, such as dumping memory contents or disassembling code.

Once the boot loader is functioning properly, you can perform basic debugging by sending firmware monitor commands to the debug serial monitor port.

See Also

Ethernet Boot Loader

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.