Implementing the OEMMapMemAddr Function

You need to implement code that maps the flash memory image to a temporary location in RAM. This temporary RAM cache allows the 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 image validation happens first, the erase operation is put on hold until the 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 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

How to Develop a Boot Loader

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.