//head.S
_start:
loop:
//init.c
#include "lcd.h"
void init_sdram(void)
{
volatile unsigned int *p = BWSCON;
LOCKTIME = 0xffffffff;
MPLLCON = 0x000ad022;
CLKSLOW = 0x4;
CLKDIVN = 0x2;
CAMDIVN = 0x00;
GPHCON |= ((2 << 4) | (2 << 6));
ULCON0 = 0x03;
UCON0 = 0x0005;
UBRDIV0 = 0x49;
GPFCON = 0x5555;
GPFDAT =0x00;
p[0] = 0x22011110; //BWSCON
p[1] = 0x00000700; //BANKCON0
p[2] = 0x00000700; //BANKCON1
p[3] = 0x00000700; //BANKCON2
p[4] = 0x00000700; //BANKCON3
p[5] = 0x00000700; //BANKCON4
p[6] = 0x00000700; //BANKCON5
p[7] = 0x00018005; //BANKCON6
p[8] = 0x00018005; //BANKCON7
p[9] = 0x008C03C3;
p[10] = 0x000000B1; //BANKSIZE
p[11] = 0x00000030; //MRSRB6
p[12] = 0x00000030; //MRSRB7
int i = 0;
while(i<100000)i++;
while(i>0)i--;
while( !( (1<<2) & UTRSTAT ) ) ;
UTXH0 = 'a';
}
void nand_reset()
NFCONT &= (~(1<<1));
NFCMMD |= 0xff;
while(1)
if(NFSTAT & 1)
break;
NFCONT |=(1<<1);
void init_nand()
/* 设置时序 */
NFCONF |= ((0<<12)|(3<<8)|(0<<4));
/* 使能NAND Flash控制器, 初始化ECC, 禁止片选 */
NFCONT |= ((1<<4)|(1<<1)|(1<<0));
nand_reset();
void read_nand_to_sdram(void)
UTXH0 = 'b';
init_nand();
volatile unsigned char *p = (volatile unsigned char *)0x30000000;
NFCMMD = 0x00;
NFADDR =0x00 ;
for(i = 0;i<10;i++);
NFADDR = 0x20;
NFADDR = 0x00;
NFADDR = 0X00;
NFCMMD = 0X30;
for(i = 0;i<(16*1024);i++)
p[i] = (0xff & NFDATA);
i = 0;
UTXH0 = 'c';
//lcd.lds
SECTIONS{
first 0x0000 : AT(0){ head.o init.o }
second 0x30000000 : AT(4095){ main.o }
To all members,
This was already solved by owen himself. See his other post, A simple arm program question, could help me?