@******************************************************************************
@ File:head.S
@ 功能:通过它转入C程序
@******************************************************************************
.text
.global _start
_start:
ldr r0 , =0x53000000
mov r1 , #0x0
str r1 , [r0]
ldr sp , =1024*4 @设置堆栈指针,不知道为什么,当我想把程序直接下载到
@sdram上运行的话,必须把设置堆栈指针这条命令去掉,才
@能成功,不明白啊????
bl main
halt_loop:
b halt_loop
#define GPBCON (*(volatile unsigned long *)0x56000010)
#define GPBDAT (*(volatile unsigned long *)0x56000014)
#define GPB5_out (1<<(5*2))
#define GPB6_out (1<<(6*2))
#define GPB7_out (1<<(7*2))
#define GPB8_out (1<<(8*2))
void wait(volatile unsigned long dly)
{
for(; dly > 0; dly--);
}
int main(void)
{
unsigned long i = 5;
GPBCON = GPB5_out|GPB6_out|GPB7_out|GPB8_out; // 将LED1-3对应的GPF4/5/6三个引脚设为输出
while(1){
wait(30000);
GPBDAT = (~(1<<i)); // 根据i的值,点亮LED1-3
if(++i == 9)
i = 5;
}
return 0;
}
1、直接下载到sdram中运行,必须把ldr sp , =1024*4指令注释;如果是下载到nand中运行,则这条指令必须有。不明白为什么????