[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] ldd Y+const not working, bug?
From: |
Klaus Rudolph |
Subject: |
[avr-gcc-list] ldd Y+const not working, bug? |
Date: |
Mon, 08 Nov 2004 00:16:18 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.6) Gecko/20040114 |
Hi all,
why the following code did not compile:
-----------
#include <avr/io.h>
.lcomm table1 10
.lcomm table2 10
example:
ldi YL, lo8(table1)
ldi YH, hi8(table1)
ldi r16, 0x10
lloop:
ld r17, Y+
std Y+10-1, r17 ;1
std Y+(table2-table1)-1, r17 ;2
dec r16
brne lloop
ret
is_constant:
ldi r16, (table2-table1)-1 ;3
-----
Compile give the following error messages:
avr-gcc -mmcu=at90s8515 -Wa,--gstabs,-D -xassembler-with-cpp -Wa,-alh
test.s -nostdlib -o test.o > test.lst
test.s: Assembler messages:
test.s:16: Error: constant value required
test.s:16: Error: number must be less than 64
test.s:23: Warning: expression possibly out of 8-bit range
the expression (2) should result in the same like (1) but it is not
allowed to
build a difference of to constants here :-(
in (3) the difference will be calculated correct and the code is
ok.00000010 <is_constant>:
10: 09 e0 ldi r16, 0x09 ; 9
What this means:
The compiler/assembler/linker is able to build link time constants from
differences of
link time constants. But why this will not work for ldd/std???
For me it seams to be a bug!
To add a line like (1) to the code there must be a test in #if .....
#error #endif so that
a handcrafted constant like the 10-1 in (1) could be checked in compile
or link.
Any idea for such a test? Otherwice the ldd is not usable at all :-(
Thanks
Klaus
- [avr-gcc-list] ldd Y+const not working, bug?,
Klaus Rudolph <=