我写了个简单的流水灯裸机程序烧进板子里,但每次都要过好久才能开始运行程序,为什么?还有,我把程序下进0x3000 0000地址里,nand flash启动,为什么每次断电后再上电不能运行程序了?
程序为:
#include "def.h"
#include "option.h"
#include "2440addr.h"
#include "2440lib.h"
#include "2440slib.h"
#define LED1_ON ~(1<<5)
#define LED2_ON ~(1<<6)
#define LED3_ON ~(1<<7)
#define LED4_ON ~(1<<8)
#define LED1_OFF (1<<5)
#define LED2_OFF (1<<6)
#define LED3_OFF (1<<7)
#define LED4_OFF (1<<8)
void delay(int times)
{
int i;
for(;times>0;times--)
for(i=0;i<400;i++);
}
int Main()
{
rGPBCON = 0x155555;
/* 全亮*/
rGPBDAT = rGPBDAT&(LED1_ON)&(LED2_ON)&(LED3_ON)&(LED4_ON);
delay(10000);
/* 全灭*/
rGPBDAT = rGPBDAT|(LED1_OFF)|(LED2_OFF)|(LED3_OFF)|(LED4_OFF);
delay(10000);
while(1)
{
rGPBDAT=0x1CE;
delay(2000);
rGPBDAT=0x1AE;
delay(2000);
rGPBDAT=0x16E;
delay(2000);
rGPBDAT=0xEE;
delay(2000);
rGPBDAT=0x1EE;
delay(2000);
rGPBDAT=0xE;
delay(2000);
}
return 0;
} |