[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [avr-gcc-list] Howto put constants on fixed address

From: Weddington, Eric
Subject: RE: [avr-gcc-list] Howto put constants on fixed address
Date: Wed, 19 Dec 2007 09:19:09 -0700


> -----Original Message-----
> From: 
> address@hidden 
> [mailto:address@hidden
> org] On Behalf Of Zizka
> Sent: Wednesday, December 19, 2007 9:13 AM
> To: address@hidden
> Subject: [avr-gcc-list] Howto put constants on fixed address
> Hi, I need to put some constants on specific address, for 
> example 0x400.
> I've declared my constants in a section .foo:
> char __attribute__ ((section(".foo"))) myconsts="qwertyuiop";
> then I've compiled that code using:
> -Wl,-section-start=.foo=0x200
> But I get this error:
> .... ld.exe: section .foo [00000400 -> 0000040a] overlaps 
> section .text
> [00000000 -> 00001b7d]
> I've tried to change the linker script and so on, but I was unable to
> "insert" my code into the .text section. The only solution 
> was to place my
> section after the end of the .text section, so the sections 
> do not overlap,
> but that is not what I want. Is it possible to put section to 
> any address?
> Or are the sections "unbreakable"?

I thought this answer was in the avr-libc user manual somwhere.

The linker cannot do separate address spaces, it only knows about a
single address space. So .data, .bss, .eeprom are set at specific, very
high offsets to make them fit in this single address space and not
overlap the .text (code) section. Add the relevant offset to your
-section-start flag. See the default linker scripts to see how this

reply via email to

[Prev in Thread] Current Thread [Next in Thread]