接口设计:
对SDRAM初始化
对内存控制器初始化
memsetup:
mov r1,#MEM_CTL_BASE
adrl r2,mem_cfg_val
add r3,r1,#52
ldr r4,[r2],#4
str r4,[r1],#4
cmp r1,r3
bne 1b
mov pc,lr
复制代码到SDRAM,将SRAM中的4K数据全部复制到SDRAM,
SRAM起始地址为0x00000000,SDRAM的起始地址为0x30000000
copy_steppingstone_to_sdram:
mov r1,#0
ldr r2,=SDRAM_BASE
mov r3 ,#4*1024
ldr r4,[r1],#4
str r4,[r2],#4
cmp r1,r3
bne 1b
mov pc,lr
align 4
存储控制器13个寄存器的设置值
mem_cfg_val:long 0x22011110
BWSCON :long 0x00000000
BANKCON0 long 0x00000700
BANKCON1 long 0x00000700
BANKCON2 long 0x00000700
BANKCON3 long 0x00000700
BANKCON4 long 0x00000700
BANKCON5 long 0x00000700
BANKCON6 long 0x00018005
BANKCON7 long 0x00018005
REFRESH long 0x008e07a3
BANKSIZE long 0x000000b2
MRSRB6 long 0x00000030 、
MRSRB7 long 0x00000030
NAND FLASH配置寄存器初始化
MemCfgInit(); //设置NAND FLASH的配置寄存器
void MemCfgInit(void)
{
//rCLKCON |= 0xffff0;
//enable nand flash control, initilize ecc, chip disable,
rNFCONF = (1<<15)|(1<<12)|(1<<11)|(7<<8)|(7<<4)|(7);
}
『本文转载自网络,版权归原作者所有,如有侵权请联系删除』