Am 30.10.2011 21:43, schrieb Georg-Johann Lay:
Hi,
I need to assemble 24-bit integers in avr-as as if they were generated
from C code like
const __pgmx char c = 1;
const __pgmx char *pc = &c;
where __pgmx generates 24-bit addresses.
If pc just held a 16 bit address the code was
.global pc
.data
.type pc, @object
.size pc, 2
pc:
.word c
Now the question is: How to write down a 24-bit symbol?
.global pc
.data
.type pc, @object
.size pc, 3
pc:
.word c
.byte hlo8(c) ??? error from as
gives an error from the assembler, same for .byte hh8(c)
Moreover, a const-integer offset can be added to c:
.word c+2
.byte hlo8(c+2) ??? error from as
What is the right way to write it own?
Many thanks,
Johann
Dear Johann,
in order to initialize memory with 24 bit "data type" addresses, a
corresponding 24 bit "relocation" would be required in the ".elf" format
description. I.e. in order to realize what you want, a new ".elf" object
format version would have to be defined.
In case of 24 bit "program memory type" addresses, you could simply use
16 bit addresses. The linker will generate jump stubs. The 16 bit
address will then point to the jump instruction in the first 128k of the
memory.
For now, the reccommendation, I could give you is, to try to place all
of your "data type" constant tables in the first 64k of memory by use of
an appropriate linker script. As long as they reside within the first
64k, a 16 bit pointer will do.
The other option, that you might try to use is to use a 32 bit variable,
i.e. by using
.long c
you will be wasting one byte, but this might work. (unfortunately on
this machine here, I don't have a compiled version of avr-as available
right now to test it).
HTH,
Björn
_______________________________________________
AVR-GCC-list mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/avr-gcc-list