public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* adding a new section and make it start at address 0
@ 2003-02-05 18:19 Till Harbaum
  0 siblings, 0 replies; only message in thread
From: Till Harbaum @ 2003-02-05 18:19 UTC (permalink / raw)
  To: gcc-help

Hi list,

i am having a small problem and have been unable to solve it using google etc.

There's a port for the avr compiler of gcc called avr-gcc. This compiler suite 
supports the eeprom memory of the avr by using a seperate section named 
.eeprom for this. Data can be stored at compile time in this segment like 
this:

short __attribute__((section (".eeprom"))) x = 1234;

And access to this segment is done via special functions to access the right 
part of the eeprom. Using the address of x as an offset into the eeprom.

In order to allow tests and debugging on the pc, i'd like to be able to use 
the exact same machanisms on the pc using gcc 3.2 to save data in a seperate 
file.

What i am doing is, i put the data into a section called .eeprom as shown 
above and tell the linker, that this section is to begin at offset 0: 
gcc -Wl,--section-start=.eeprom=0x0 -o test test.o

The problem is, once i tell the linker to do this, it creates a new segment 
called .eeprom and renames my old one to .eeprom.1. Objdump shows this:

0 .eeprom       00000000  00000000  00000000  00004200  2**0
                  CONTENTS

16 .eeprom.1     00000002  0804c0b0  0804c0b0  000040b0  2**1
                  CONTENTS, ALLOC, LOAD, DATA

My question now is: Why doesn't the linker use the new start address i supply 
for my .eeprom section? How can i make it work on my existing section instead 
of creating a new (empty and useless one) instead of creating a new section 
and renaming my original one?

Thanks,
  Till

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-02-05 18:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-05 18:19 adding a new section and make it start at address 0 Till Harbaum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).