[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] How not to use special memory area
From: |
Erik Christiansen |
Subject: |
Re: [avr-gcc-list] How not to use special memory area |
Date: |
Mon, 22 Mar 2004 16:40:38 +1100 |
User-agent: |
Mutt/1.3.28i |
On Fri, Mar 19, 2004 at 09:47:59AM +0100, Adib Taraben wrote:
> The RAM is via glue-logik selected in the memory area 0x2000-0xffff.
> The area from 0x1000-0x1fff is used for external IO-Chips.
> I see the linkerscript from the ldscrips directory avrmega103.x etc.
> I have no glue how to extend the data section, so that it has a hole
> from 0x1000-0x1fff.
Hmmm ..., if internal and external RAM are treated uniformly, then you
lose control of which variables reside in the faster internal RAM. (That
could have ugly performance consequences.) Perhaps it would be better to
employ two memory segments, especially since that also provides the
hole, without additional effort? In the linker script then, one could
try something like:
MEMORY
{
text (rx) : ORIGIN = 0, LENGTH = 64K
data (rw!x) : ORIGIN = 0x800100, LENGTH = 4K /* Internal RAM */
data2 (rw!x) : ORIGIN = 0x802000, LENGTH = 0xe000 /* External RAM */
eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 2K
}
SECTIONS
{
...
/* Between .data & .bss sections is a good place: */
.data2 :
{
*(.data2) /* You may prefer other names. */
*(.ext_ram) /* Feel free to change them. */
} > data2
...
}
Now, if you're programming in C, __attribute__ ((section(".ext_ram")))
should put your variable outside, above the hole. In assembler (with
which I have more avr experience), you'd use: .section .ext_ram,"aw"
Please post on how it goes. :-)
HTH,
Erik
_______________________________________________
avr-gcc-list mailing list
address@hidden
http://www.avr1.org/mailman/listinfo/avr-gcc-list