Partager via


Flash Memory (Boot Loader) (Compact 2013)

3/26/2014

The BLCOMMON library provides an infrastructure for downloading the run-time image into flash memory. The header file that defines the flash memory interface is %_WINCEROOT%\Public\Common\OAK\Inc\blcommon.h. The flash memory functions are typically located in %_WINCEROOT%\Platform\<BSP Name>\Src\Bootloader\Eboot and linked into Oal_flash.lib or directly into the boot loader executable; for example, Eboot.exe.

The following table lists the flash memory functions. For more information, see Boot Loader Flash Functions.

Purpose

Function name

Determines if an address lies in flash memory

OEMIsFlashAddr

Remaps a flash memory address to a RAM address

OEMMapMemAddr

Erases flash memory

OEMStartEraseFlash, OEMContinueEraseFlash, OEMFinishEraseFlash

Writes to flash memory

OEMWriteFlash

The following figure shows an example of the function call sequence when you download a run-time image into flash memory.

Downloading an image into flash memory on a device

The following is a description of the process of downloading the OS image into flash memory, as shown in the preceding figure.

  1. The BootloaderMain function calls the DownloadImage function, which in turn calls the DownloadBin function when the run-time image is in .bin format, or a similar function if the image is in .nb0 format. All three functions are implemented by the BLCOMMON library, so you do not need to modify them. The DownloadBin function calls several BSP functions, as described in the following list:
    1. The DownloadBin function calls the OEMReadData function to read the run-time image’s starting address and length. The OEMReadData function typically calls a hardware-specific function to perform the read operation.
    2. The DownloadBin function then calls the OEMIsFlashAddr function to check if the run-time image will be downloaded into flash memory.
    3. If the image is destined for flash memory, the DownloadBin function then calls the OEMStartEraseFlash function so that the flash memory will be erased as the image is downloaded. The OEMStartEraseFlash function typically calls a hardware-specific function to start erasing the flash memory.
    4. The DownloadBin function then calls OEMReadData function to copy the records of the BIN image to flash memory.
    5. As it reads the data of the .bin image, the DownloadBin function calls the OEMMapMemAddr function to map the flash memory addresses to a temporary location in RAM, which allows the run-time image to be downloaded while the slower flash memory erase operation takes place.
    6. The DownloadBin function calls OEMContinueEraseFlash to continue erasing the flash memory as it copies the data records of the .bin image into it.
    7. After all of the data records have been copied into flash memory, the DownloadBin function calls the OEMFinishEraseFlash function, which typically calls a hardware-specific function to finish the flash memory erasure.

See Also

Concepts

BL Common Boot Framework