(avr)gcc中的外部符号不起作用

时间:2015-11-15 01:48:35

标签: gcc assembly embedded avr avr-gcc

好吧,我在程序集中为avr uC(特别是在我的情况下为atmega8)编写了这个程序,我正在尝试使用外部符号让链接器稍后替换它。

这是代码

#Command to compile this is
#
# "avr-gcc -mmcu=atmega8 -nostartfiles -flto -c -x assembler-with-cpp-L./lib/ -I./include/ -Wall -Os -o sfade.o sfade.asm"

#include "avr/io.h"

.section        .text
.global main
.org 0x0000
main:
.L1:
        sbi _SFR_IO_ADDR(DDRB) , PIN
        in r24 , _SFR_IO_ADDR(TCCR1A)
        ori r24 , -127
        out _SFR_IO_ADDR(TCCR1A) , r24
        in r24 , _SFR_IO_ADDR(TCCR1B)
        ori r24 , 9
        out _SFR_IO_ADDR(TCCR1B) , r24
        ldi r24 , 100
        out _SFR_IO_ADDR(OCR1A) , r24
.L2:
        rjmp .L2

我正在使用

avr-gcc -mmcu=atmega8 -nostartfiles -flto -c -x assembler-with-cpp-L./lib/ -I./include/ -Wall -Os -o sfade.o sfade.asm

编译它,如上所述。

现在,编译失败了

sfade.asm:7: Error: constant value required

我尝试添加.extern PIN无效。

就这样问题的框架是清楚的,我想要做的是有一堆汇编代码,在链接时加载配置数据,以便我可以将它变成.o并将其放入库。

0 个答案:

没有答案