xing778946279 2017-08-09 04:00 采纳率: 0%
浏览 643

SDRAM c语言访问 S3C2440

求大佬帮忙看一下哪错了 。。 led灯不亮。。head.S

.text
.global _start
_start:
ldr sp,=4096
bl disable_watch_dog
bl memsetup
bl copy_steppingstone_to_sdram
ldr pc,=on_sdram
on_sdram:
ldr sp,=0x34000000
bl main
halt_loop:
b halt_loop

one_led.c
#define GPFCON (*(volatile unsigned long )0x56000050)
#define GPFDAT (
(volatile unsigned long *)0x56000054)

int main()
{
GPFCON = 0x00000100; // 设置GPF4为输出口, 位[9:8]=0b01
GPFDAT = 0x00000000; // GPF4输出0,LED1点亮

return 0;

}

init.c
#define WAT_DOG (*(volatile unsigned long *) 0x53000000)
#define MEM_CTL_BASE 0x48000000

void disable_watch_dog(void)
{
WAT_DOG = 0x0;

}

void memsetup(void)
{
unsigned long const mem_cfg_val[]={
0x22011110,
0x00000700,//0
0x00000700,//1
0x00000700,//2
0x00000700,//3
0x00000700,//4
0x00000700,//5
0x00018005,
0x00018005,
0x008C07A3,
0x000000B1,
0x00000030,
0x00000030,
};
int i=0;
volatile unsigned long p=(volatile unsigned long)MEM_CTL_BASE;
for(;i<13;i++)
p[i]=mem_cfg_val[i];

}

void copy_steppingstone_to_sdram(void)
{
unsigned int *pdwSrc=(unsigned int *)0;
unsigned int *pdwDest=(unsigned int *)0x30000000;

    while(pdwSrc<(unsigned int *)4096)
    {
            *pdwDest=*pdwSrc;
            pdwDest++;
            pdwSrc++;
    }

}

Makefile
sdram.bin:head.S one_led.c init.c
arm-linux-gcc -g -c -o head.o head.S
arm-linux-gcc -g -c -o one_led.o one_led.c
arm-linux-gcc -g -c -o init.o init.c
arm-linux-ld -Ttext 0x30000000 head.o one_led.o init.o -o sdram_elf
arm-linux-objcopy -O binary -S sdram_elf sdram.bin
clean:
rm -f sdram.bin sdram_elf *.o

  • 写回答

1条回答 默认 最新

  • dabocaiqq 2018-06-14 16:33
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料