|
发表于 2010-7-28 16:38:07
|
显示全部楼层
我试着把这个往s3c2440A上面改,结果出现了一些问题
start.s如下
.text
.align 4
.global begin
.type begin, function
.global _start
_start:
@set up irq stack
mov r0, #0xd2 @ make irq mode with all irqs disabled
msr cpsr, r0
ldr sp, =irq_stack @ set sp_irq = irq_stack
bl hello
stop: b stop
.data
.align 4
irq_stack:
.space 4096
hello.c如下
#define UTXH0 *(long*)0x50000020
int hello(void)
{
int i;
char * hellostr="helloworld";
for(i=0;i<10;i++)
{
UTXH0=hellostr;
}
return 0;
}
Makefile如下
CROSS:=arm-none-eabi
hello.bin:hello
$(CROSS)-objcopy -O binary hello hello.bin
hello:start.o hello.o
$(CROSS)-ld -Ttext=0x0000000 start.o hello.o -o hello
start.o:start.S
$(CROSS)-as start.S -o start.o
hello.o:hello.c
$(CROSS)-gcc -c -o hello.o hello.c
clean:
rm *.o *.bin hello hello.bin
skyeye.conf如下
#skyeye config file sample
#cpu: arm7tdmi
cpu:arm920t
#mach: at91
mach:s3c2440
#mach:s3c44b0
mem_bank: map=M, type=RW, addr=0x00000000, size=0x00040000,file=./hello.bin,boot=yes
mem_bank: map=I, type=RW, addr=0x50000000, size=0x08000000
uart:mod=term
log: logon=1, logfile=./sk2.log, start=0, end=300
skyeye版本为用sudo apt-get install安装的1.2.5,
直接启动skyeye,没出现helloworld,log文件记录如下
N 0 :p 0,i e3a000d2,
N 1 :p 4,i e129f000,
N 2 :p 8,i e59fd004,
N 3 :p c,i efffffff,
N 4 :p c,i efffffff,
N 5 :p c,i efffffff,
N 6 :p c,i efffffff,
N 7 :p c,i efffffff,
N 8 :p c,i efffffff,
N 9 :p c,i efffffff,
N a :p c,i efffffff,
N b :p c,i efffffff,
N c :p c,i efffffff,
后面一直是N c :p c,i efffffff,
如果用skyeye -d启动调试,则在gdb调试时能正常出现helloworld,若调试过程中输入命令c,则异常,log记录在c命令开始的那点起为N c :p c,i efffffff,
换用1.3.0版本,直接运行则出现segment fault错误
将#define UTXH0 *(long*)0x50000020改为#define UTXH0 *(long*)0x01D00020(s3c44b0uart0对应的地址)对skyeye.conf作相应更改,启动后能正常打印helloworld
为什么arm7的处理器直接改过去就行,arm9不行呢,是否arm9需要进行一些初始化才可以呢,请问一下不能成功的具体原因是什么,谢谢 |
|