当前位置: 技术问答>linux和unix
一个奇怪的编译的问题!
来源: 互联网 发布时间:2016-11-22
本文导语: 本人宿主机:FEDORA 14: 交叉编译器:arm-linux-gcc 4.3.2 路径:usr/local/arm/ 在/etc/profile 添加 pathmunge /usr/local/arm/4.3.2/bin OK! 我自己写一个ARM的裸机程序:LED.S #*********************************************************************...
本人宿主机:FEDORA 14:
交叉编译器:arm-linux-gcc 4.3.2 路径:usr/local/arm/
在/etc/profile 添加
pathmunge /usr/local/arm/4.3.2/bin OK!
我自己写一个ARM的裸机程序:LED.S
#******************************************************************************
# File:led.S
# 功能:make the lighting
#@**
.text
.global _start
_start:
b led @jump tp led
led:
ldr r0,=0x56000010 @GPBCON =0X56000010
ldr r1,=0x00ddd7ff @GPBCON(5 6 8 10) are output
str r1,[r0]
ldr r3,=0x56000014
ldr r4,=0x0000
str r4,[r3]
b led
.end
编写的Mkafile如下:
led.bin:led.o
arm-linux-gcc -c -o led.o led.S
arm-linux-ld -Ttext 0x30000000 -g led.o -o led_elf
arm-linux-objcopy -O binary -S led_elf led.bin
clean:
rm -f led.bin led_elf *.o
执行过程:
方法1:直接make
出错结果如下:
cc -c -o led.o led.S
led.S: Assembler messages:
led.S:8: Error: no such instruction: `b led'
led.S:8: Error: junk at end of line, first unrecognized character is `@'
led.S:10: Error: no such instruction: `ldr r0,=0x56000010@GPBCON=0X56000010'
led.S:11: Error: no such instruction: `ldr r1,=0x00ddd7ff@GPBCON(5 6 8 10)are output'
led.S:12: Error: invalid char '[' beginning operand 2 `[r0]'
led.S:15: Error: no such instruction: `ldr r3,=0x56000014'
led.S:16: Error: no such instruction: `ldr r4,=0x0000'
led.S:17: Error: invalid char '[' beginning operand 2 `[r3]'
led.S:19: Error: no such instruction: `b led'
make: *** [led.o] 错误 1
方法2:1先arm-linux-gcc -c led.S -o led.o
2.make
没有错!生成led.bin len_elf
为什么第一种错误?
求解释!
交叉编译器:arm-linux-gcc 4.3.2 路径:usr/local/arm/
在/etc/profile 添加
pathmunge /usr/local/arm/4.3.2/bin OK!
我自己写一个ARM的裸机程序:LED.S
#******************************************************************************
# File:led.S
# 功能:make the lighting
#@**
.text
.global _start
_start:
b led @jump tp led
led:
ldr r0,=0x56000010 @GPBCON =0X56000010
ldr r1,=0x00ddd7ff @GPBCON(5 6 8 10) are output
str r1,[r0]
ldr r3,=0x56000014
ldr r4,=0x0000
str r4,[r3]
b led
.end
编写的Mkafile如下:
led.bin:led.o
arm-linux-gcc -c -o led.o led.S
arm-linux-ld -Ttext 0x30000000 -g led.o -o led_elf
arm-linux-objcopy -O binary -S led_elf led.bin
clean:
rm -f led.bin led_elf *.o
执行过程:
方法1:直接make
出错结果如下:
cc -c -o led.o led.S
led.S: Assembler messages:
led.S:8: Error: no such instruction: `b led'
led.S:8: Error: junk at end of line, first unrecognized character is `@'
led.S:10: Error: no such instruction: `ldr r0,=0x56000010@GPBCON=0X56000010'
led.S:11: Error: no such instruction: `ldr r1,=0x00ddd7ff@GPBCON(5 6 8 10)are output'
led.S:12: Error: invalid char '[' beginning operand 2 `[r0]'
led.S:15: Error: no such instruction: `ldr r3,=0x56000014'
led.S:16: Error: no such instruction: `ldr r4,=0x0000'
led.S:17: Error: invalid char '[' beginning operand 2 `[r3]'
led.S:19: Error: no such instruction: `b led'
make: *** [led.o] 错误 1
方法2:1先arm-linux-gcc -c led.S -o led.o
2.make
没有错!生成led.bin len_elf
为什么第一种错误?
求解释!
|
makefile改下