Adding Support for Multiple-BIN Image Notification
Platform Builder and the BLCOMMON library support downloading multiple .bin files during the same download session. This is useful when developing a multiple-BIN 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 multiple-BIN 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
Last updated on Wednesday, April 13, 2005
© 2005 Microsoft Corporation. All rights reserved.