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 |
|
Remaps a flash memory address to a RAM address |
|
Erases flash memory |
OEMStartEraseFlash, OEMContinueEraseFlash, OEMFinishEraseFlash |
Writes to flash memory |
The following figure shows an example of the function call sequence when you download a run-time image into flash memory.
The following is a description of the process of downloading the OS image into flash memory, as shown in the preceding figure.
- 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:
- 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.
- The DownloadBin function then calls the OEMIsFlashAddr function to check if the run-time image will be downloaded into flash memory.
- 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.
- The DownloadBin function then calls OEMReadData function to copy the records of the BIN image to flash memory.
- 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.
- The DownloadBin function calls OEMContinueEraseFlash to continue erasing the flash memory as it copies the data records of the .bin image into it.
- 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.