简体   繁体   中英

AVR-GCC: Error: garbage at end of line

I have problem with stack init lines because avr-gcc returns

LED_Blink.asm:10: Error: garbage at end of line

On lines:

ldi r17, low(RAMEND)
ldi r17, high(RAMEND)

And I am confused. I have already defined RAMEND. I used avr-gcc with this command:

avr-gcc -x assembler -mmcu=atmega328p LED_Blink.asm

My assembly code:

.equ    SPL, 0x3d
.equ    SPH, 0x3e
.equ    RAMEND, 0x8ff

.equ    PORTB, 0x05
.equ    DDRB, 0x04
.org    0x000000
rjmp main
main:
    ldi r17, low(RAMEND)
    out SPL, r17
    ldi r17, high(RAMEND)
    out SPH, r17

    ldi r16, 0xff
    out DDRB, r16
    out PORTB, r16
loop:
    ldi r16, 32
    rcall outer_loop
    cbi PORTB, 5
    ldi r16, 32 
    rcall outer_loop
    sbi PORTB, 5
    rjmp loop
outer_loop:
    clr r24
    clr r25
delay_loop:
    adiw r24, 1
    brne delay_loop
    dec r16
    brne outer_loop
    ret

对于AVR的GNU汇编程序, lowhigh并不意味着什么,我认为你想使用lo8hi8分别取低和高字节。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM