Share via


Startup (Boot Loader) (Compact 7)

3/12/2014

Some of the startup tasks performed by the boot loader include initializing the CPU, clearing the instruction and data caches, clearing the translation look-aside buffers (TLBs), configuring and enabling the RAM controller, clearing the interrupts, and initializing the real-time clock (RTC). For details, see Boot Loader.

All boot loaders can use the BLCOMMON library that is provided with Windows Embedded Compact. The library provides much of the boot loader functionality. The BLCOMMON code is located in Platform\Common\Src\Boot\Blcommon. The interface is defined in blcommon.h.

Although much boot loader functionality is provided for you, you must implement some hardware-specific functions that interact with the BLCOMMON library. The hardware-specific code is typically located in one of the following locations:

  • Platform\<BSP Name>\Src\Boot
  • Platform\<BSP Name>\Src\Bootloader

To enable basic functionality, you typically modify the functions shown in the following table. In addition to these functions, you modify the initialization functions for these components (OEMInitDebugSerial, OEMPreDownload, and others) that are listed in the tables in Serial Debugging (Boot Loader) and Download Transport (Boot Loader).

The following table describes the boot loader startup functions.

Purpose Function name Typical file name

Enters the boot loader and initializes the CPU

StartUp

startup.s

Initializes hardware components

OEMPlatformInit

main.c

Launches the run-time image

OEMLaunch

main.c

For a complete list of boot loader functions, see Boot Loader Reference.

The following figure shows the function call sequence for the boot loader until it passes control to the OAL.

Boot loader startup sequence

Below is a description of the boot loader startup sequence shown in the preceding figure.

  1. The StartUp function is the entry point to the boot loader executable; it is the first function the boot loader executes. The StartUp function, which is typically written in assembly language, performs low-level hardware initialization.
  2. The StartUp function calls the BootloaderMain function, which is implemented in the BLCOMMON library, so you do not need to modify it. The BootloaderMain function performs further initialization of the hardware and calls several BSP functions, as described below.
    1. The BootloaderMain function calls the OEMDebugInit function, which initializes the debug serial port by calling the OEMInitDebugSerial function. After the debug serial port is initialized, you can communicate with your device through a serial port connection by using a terminal emulator to display the boot loader’s output and accept your input.
    2. The BootloaderMain function then calls the OEMPlatformInit function to further initialize hardware such as an Ethernet controller.
    3. The BootloaderMain function calls the OEMPreDownload function, which you can customize to prompt for user input, such as to modify the network settings of an Ethernet controller. The OEMPreDownload function uses the BLMenu function to provide the user interface for the configuration.
    4. The BootloaderMain function then calls the DownloadImage function, which is implemented in the BLCOMMON library, to download the run-time image into RAM on the device. For an example of the functions that are called when the boot loader downloads the run-time image into flash memory, see Flash Memory (Boot Loader).
    5. Finally, the BootloaderMain function calls the OEMLaunch function to find and jump to the address of the first instruction of the run-time image. At this point, the boot process ends and the boot loader jumps to the OAL’s Startup function, which is the entry point of the run-time image. That process is described in Startup (OAL).

See Also

Concepts

Boot Loader Code Overview