Exemple #1
0
void main(void)
{
	INT32 nRet;
	
	OEMWriteDebugLED(0, 0x0);

	// Set up the copy section data.
	if (!SetupCopySection(pTOC))
	{
		while(1);
	}

	// Clear LEDs.
	OEMWriteDebugLED(0, 0x0);

	OEMInitDebugSerial();
	OEMWriteDebugString(L" [NBL2] main() Starts !\r\n");
	OEMWriteDebugString(L" [NBL2] Serial Initialized...\r\n");

	nRet = FIL_Init();
	if (nRet != FIL_SUCCESS)
	{
		OEMWriteDebugString(L" [NBL2:ERR] FIL_Init() : Failed\r\n");
		while(1);
	}
	OEMWriteDebugString(L" [NBL2] FIL_Init() : Passed\r\n");

	ShadowEboot();

	OEMWriteDebugString(L" [NBL2] Launch Eboot...\r\n");

	OEMLaunchImage(EBOOT_VIRTUAL_BASEADDR);
}
Exemple #2
0
void main(void)
{
    register nBlock;
    register nPage;
    register nBadBlocks;
    volatile unsigned char *pBuf;

    // Set up copy section (initialized globals).
    //
    // NOTE: after this call, globals become valid.
    //
    SetupCopySection(pTOC);

    // Enable the ICache.
    //System_EnableICache();        // I-Cache was already enabled in startup.s

    // Set up all GPIO ports for LED.
    //Port_Init();
    //Led_Display(0xf);

    // UART Initialize
#if UART_DEBUG
    Uart_Init();
    Uart_SendString("\r\nWinCE 6.0 Steploader for SMDK6410\r\n");
    // Initialize the NAND flash interface.
    Uart_SendString("NAND Initialize\n\r");
#endif    
    g_bLargeBlock = NAND_Init();
  

    // Copy image from NAND flash to RAM.
    pBuf = (unsigned char *)LOAD_ADDRESS_PHYSICAL;
    nBadBlocks = 0;
    //Led_Display(0x4);    
    for (nPage = LOAD_IMAGE_PAGE_OFFSET; nPage < (LOAD_IMAGE_PAGE_OFFSET + LOAD_IMAGE_PAGE_COUNT) ; nPage++)
    {
        //Led_Display(0x1);      
        nBlock = ((nPage / NAND_PAGES_PER_BLOCK) + nBadBlocks);

        if (!NAND_ReadPage(nBlock, (nPage % NAND_PAGES_PER_BLOCK), pBuf))
        {
            if ((nPage % NAND_PAGES_PER_BLOCK) != 0)
            {
                //Led_Display(0x9);    // real ECC Error.
#if UART_DEBUG
                Uart_SendString("ECC Error.\r\n");
#endif

                while(1)
                {
                    // Spin forever...
                }
            }

            // ECC error on a block boundary is (likely) a bad block - retry the page 0 read on the next block.
            nBadBlocks++;
            nPage--;

            continue;
        }

        pBuf += NAND_BYTES_PER_PAGE;
    }

    //Led_Display(0x6);
#if UART_DEBUG
    Uart_SendString("Launch Eboot...\n\r");
#endif

    ((PFN_IMAGE_LAUNCH)(LOAD_ADDRESS_PHYSICAL))();
}