[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] Pointer to progmem, in assembler.
From: |
Erik Christiansen |
Subject: |
[avr-gcc-list] Pointer to progmem, in assembler. |
Date: |
Thu, 7 Aug 2003 19:05:25 +1000 |
User-agent: |
Mutt/1.3.28i |
Has anyone been haunted by the assembler error:
Error: invalid sections for operation on `L0' and `message'
which has plagued my last half dozen variations on the simple theme:
test.s >>>
#include <avr/io.h>
ldi ZH,pm_hi8(2*message)
ldi ZL,pm_lo8(2*message)
.section .progmem.data,"a",@progbits
message:
.asciz "Hello World"
<<<
(Used Artur's advice:
avr-gcc -x assembler-with-cpp -mmcu=atmega16 -DMCU=atmega16 test.s )
I tried checking how avr-gcc handles pointer to progmem, using part
of the avr-libc FAQ example:
const char foo[] PROGMEM = "Foo";
It generates pretty much the same thing:
>>>
...
.global foo
.section .progmem.data,"a",@progbits
.type foo, @object
.size foo, 4
foo:
.string "Foo"
.text
.global main
.type main, @function
main:
/* prologue: frame size=2 */
ldi r28,lo8(__stack - 2)
ldi r29,hi8(__stack - 2)
out __SP_H__,r29
out __SP_L__,r28
/* prologue end (size=4) */ Note:
ldi r24,lo8(foo) <-- avr-gcc doesn't even bother with
ldi r25,hi8(foo) <-- pm_hi8.
call fun
...
<<<
Going back to hi8,lo8 in my assembler code gives the same error, as
does leaving the string in .text.
Is anyone grinning, 'cos he recognises my dufus idiomatic omission?
Regards,
Erik
- [avr-gcc-list] Pointer to progmem, in assembler.,
Erik Christiansen <=