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

📄 bootmain.c

📁 思创S3C44B0黄金开发板一个简化版本的BOOTLOADER
💻 C
字号:
#include "inc\44b.h"
#include "platform.h"
#include "common.h"

#define U32 unsigned int
#define Uart_Printf OutPut
#define Uart_GetKey GetKey

void BoardInit (void);
typedef void (*FUNC)(void);


void Bios(void)
{
      unsigned int *p, *q, i;
      FUNC fp;
      OutPut(0,"\n\nBooting arm bios...\n");
          
      //
      // Copy  kernel
      //   
      p = (U32*)0x0110000;
      q = (U32*)0x0C100000;

      for (i=0;i<((0x10000)>>2);i++) {
             *q++ = *p ++;
      }


      //
      // Transfer to kernel
      //
      fp = (FUNC)0xc100000;
      (*fp)();
}

/****************************************************************************
The main function
****************************************************************************/
void Main(void)
{
  U32 *p;
  U32 *q;
  U32 i,s1,s2;
  FUNC fp;
  char c;


  BoardInit ();


  Uart_Printf(0,"\n\n\n");
  Uart_Printf(0,"*******************************\n");
  Uart_Printf(0,"*     Welcome to S3C44B0X     *\n");
  Uart_Printf(0,"*    Strong Embedded Studio   *\n");
  Uart_Printf(0,"*        www.8800.org         *\n");
  Uart_Printf(0,"*         (2003-2004)         *\n");
  Uart_Printf(0,"*******************************\n\n");
  
  
  Uart_Printf(0,"Boot to uClinux (Y/N)?");
  
  c = 0;
  while (Uart_GetKey(0));
    
  do {
     c = Uart_GetKey(0);
  } while (!c) ;
    
  if (c=='Y' || c=='y') {
  
      Uart_Printf(0,"\n\nuClinux boot loader...\n");
      

      //
      // Copy  kernel
      //   
      p = (U32*)0x0020000;
      q = (U32*)0xC008000;

      for (i=0;i<((0xD0000)>>2);i++) {
             *q++ = *p ++;
      }

      //
      // Copy RomFs
      //
      p = (U32*)0x0120000;
      q = (U32*)0xC700000;
      for (i=0;i<((0xD0000)>>2);i++) {
             *q++ = *p ++;
      }
    
            
      //
      // Transfer to kernel
      //
      fp = (FUNC)0xc008000;
      (*fp)();
  }
  
  if (c=='s' || c=='S') {    
    Uart_Printf(0,"\n");
    Shell();
  }
  
  Uart_Printf(0,"\n\nBurn Flash (Y/N)?");
  
  do {
      c = Uart_GetKey(0);
  } while (!c) ;
  
  if (c=='Y' || c=='y' ) {
     int i=0,j=0;
     while (1) {
       Uart_Printf(0,"\n\nEnter password:");
       while (i<6) {
         do {
           c = Uart_GetKey(0);
           if (!c)  c = Uart_GetKey(1);
         } while (!c) ;
         i++;
         j+=c;
         Uart_Printf(0,"%c",c);
       }
       
       //
       // The password is 123456
       // Disable cache for FLASH
       //
       if (j==309) {
         Uart_Printf(0,"\n\n");
         rNCACHBE0 =0x20000000;
         Burn();
         break;
       }
       
       Uart_Printf(0,"\nPassword Error!");
       i = 0;
       j = 0;
     }
  }

  Shell ();

  Uart_Printf(0,"\n\n");
  
}
//***************************************************************************

⌨️ 快捷键说明

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