|
From: | Bjoern Haase |
Subject: | Re: [avr-gcc-list] [avr-as]: How to assembler a 24-bit integer? |
Date: | Tue, 01 Nov 2011 10:47:02 +0100 |
User-agent: | Mozilla/5.0 (Windows NT 6.0; rv:5.0) Gecko/20110624 Thunderbird/5.0 |
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 likeconst __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 cyou 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
[Prev in Thread] | Current Thread | [Next in Thread] |