Share via


Implementing the OEMMapMemAddr Function (Windows Embedded CE 6.0)

1/5/2010

You need to implement code that maps the flash memory image to a temporary location in RAM. This temporary RAM cache allows the run-time image to be downloaded while the slower flash memory erase operation takes place.

Typically, a flash memory image is downloaded to the RAM location first while the flash memory erase operation happens in parallel. If run-time image validation happens first, the erase operation is put on hold until the run-time image is completely downloaded and verified.

The OEMMapMemAddr function is called to perform address translation between the flash memory address and a location in RAM where the run-time image is to be temporarily stored. It is called for a .bin file on a record-by-record basis.

To implement the OEMMapMemAddr function

  • Edit the file Flash.c by adding the code necessary to fully implement the OEMMapMemAddr function.

    The following code example shows the implementation of the OEMMapMemAddr function for the hardware platform used in this boot loader example.

    #define FCACHE 0x30040000
    LPBYTE OEMMapMemAddr (DWORD dwImageStart, DWORD dwAddr)
    {
        if (OEMIsFlashAddr(dwAddr))
        {
            //
            // This image is destined for flash; cache it in RAM temporarily.
            //
            dwAddr -= dwImageStart;
            dwAddr += FCACHE;
        }
    
        return((LPBYTE) dwAddr);
    }
    

See Also

Tasks

How to Develop a Boot Loader