Compartir a través de


Adding Support for Multiple-BIN Image Notification (Windows CE 5.0)

Send Feedback

Platform Builder and the BLCOMMON library support downloading multiple .bin files during the same download session. This is useful when developing a multi-BIN run-time image.

The BLCOMMON library can notify third-party code about each .bin file to be downloaded, and the .bin file's address and length, through a function pointer.

This information is useful when deciding how to temporarily cache a multi-BIN run-time image in RAM before writing it to flash memory. For more information, see OEMMultiBINNotify.

The following code example shows an implementation of OEMMultiBINNotify.

void OEMMultiBINNotify(const PMultiBINInfo pInfo)
{
    BYTE nCount;

    if (!pInfo || !pInfo->dwNumRegions)
    {
        EdbgOutputDebugString("WARNING: OEMMultiBINNotify: Invalid BIN region descriptor(s).\r\n");
        return;
    }

    g_dwMinImageStart = pInfo->Region[0].dwRegionStart;

    EdbgOutputDebugString("\r\nDownload BIN file information:\r\n");
    EdbgOutputDebugString("-----------------------------------------------------\r\n");
    for (nCount = 0 ; nCount < pInfo->dwNumRegions ; nCount++)
    {
        EdbgOutputDebugString("[%d]: Base Address=0x%x  Length=0x%x\r\n" , nCount, pInfo->Region[nCount].dwRegionStart, pInfo->Region[nCount].dwRegionLength);
        if (pInfo->Region[nCount].dwRegionStart < g_dwMinImageStart)
        {
            g_dwMinImageStart = pInfo->Region[nCount].dwRegionStart;
            if (g_dwMinImageStart == 0)
            {
                EdbgOutputDebugString("WARNING: OEMMultiBINNotify: Bad start address for region (%d).\r\n", nCount);
                return;
            }
        }
    }

    memcpy((LPBYTE)&g_BINRegionInfo, (LPBYTE)pInfo, sizeof(MultiBINInfo));
}

When using BLCOMMON during boot loader initialization, for example, OEMDebugInit, the multi-BIN notification function pointer should be assigned to the OEM's notification routine.

For example, to have BLCOMMON call OEMMultiBINNotify to validate the image signature, you should do the following in OEMDebugInit.

g_pOEMMultiBINNotify = OEMMultiBINNotify;

See Also

How to Develop a Boot Loader

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.