⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 2440loader.c

📁 扬创2440引导程序,很有参考价值!欢迎下载!
💻 C
字号:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
/*++
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
--*/
/************************************************
 * NAME    : 2440loader.C			*
 * DESC    : 					*
 * History : 2002.02.25 ver 0.0			*
 *         : Modified for SMDK2440 PPC2003 BSP ( November 29, 2003 ) -> HMSEO

************************************************/

#include <stdlib.h>
#include <string.h>
#include "option.h"
#include "def.h"
#include "2440addr.h"
#include "2440lib.h"
#include "2440slib.h"
#include "2440addr.h"
#include "nand.h"
#define SIGN_ON "\nWinCE NAND Boot v1.00\n" __DATE__ " " __TIME__ "\n"

// HMSEO : Please check UUID memory location from inc\drv_glob.h file.
unsigned char * pbUUID = ((unsigned char *) (0x30030000 + 0x4608));

//
// Globals
//
DWORD JumpAddr;

DWORD ReadImageFromNand(DWORD dwEntry, DWORD dwSig);

/// Eboot
void loadboot(void)
{

	DWORD dwSector, dwLength;         // Start Sector & Length
    DWORD dwRAM, i;
    
	dwSector=32*2;//从block:2 page:0开始存放boot2
	dwLength=32*25;//一共2个block;block2-7;96K容量;如果boot2文件大于96K,需要修改该代码
	dwRAM=0x30000000;//boot2 load Start address;把NAND FLASH内容拷贝到0X30000000
		
		while (dwLength)		
		{

            FMD_ReadSector(dwSector,(LPBYTE)dwRAM,NULL, 1);
    		dwSector++;
    		dwLength--;
            dwRAM += SECTOR_SIZE;//该程序目前不做校验
           
        }
        
	Launch(0x30000000);//跳转到boot2,启动boot2,程序不会返回
}

void Main(void)
{
    DWORD 	err; //, t0 = 0;
	unsigned char i,j;
    
    //	By default, we launch image CE image. If you want to launch
    //	Eboot, you need to send char"e"or"E" to UART1 when it boots.

    DWORD	dwEntry = 1; 
    
    rGPBCON &= ~12;
	rGPBCON |= 4;	
	rGPBDAT &= ~2;
	Delay100us(100);
	rGPBDAT |= 2; 
    
    MMU_EnableICache();
    Uart_Init();
    Uart_SendString(SIGN_ON);
    NF_Init();
    Delay(1000);
	loadboot();   //will not return
	

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -