[Top][All Lists]

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

RE: [avr-libc-dev] Problem using section attribute

From: Weddington, Eric
Subject: RE: [avr-libc-dev] Problem using section attribute
Date: Wed, 17 Dec 2008 11:49:14 -0700

Hi Roy,

You'll have to use a custom linker file. Start with the standard linker file 
(*.x) and modify it to add your section for the external eeprom. See the GNU ld 
user manual (part of GNU Binutils) for more information on the linker file 
format. In your .eeprom_ext section in the linker file, you'll have a line that 
will use wildcards to match all of the subsections, like so:
The first * matches all files. The second * matches all endings after the 
".eeprom_ext", and it is this that will pull in all those sub-sections.

Do you have your external EEPROM memory-mapped?


> -----Original Message-----
> From: 
> address@hidden 
> [mailto:address@hidden
> org] On Behalf Of Roy Conrad
> Sent: Wednesday, December 17, 2008 11:41 AM
> To: address@hidden
> Subject: [avr-libc-dev] Problem using section attribute
> Hi!
> I'm using the section attribute on variables that are supposed to be
> stored in an external eeprom:
> #define EEPROMEXT   __attribute__((section(".eeprom_ext")))
> uint8_t EEPROMEXT  outputs;
> In the Makefile I set the starting address for that section:
> LDFLAGS += -Wl,--section-start=.eeprom_ext=0x400000
> Until now everithing is working ok.
> The problem arises when I define another variable in another 
> unit (*.c file):
> uint8_t EEPROMEXT inputs;
> I have a *.map file with:
> .eeprom_ext          0x0000000000400000     0x166f
>  .eeprom_ext         0x0000000000400000     0x166f main.o
>                 0x0000000000400000                outputs
> .eeprom_ext.1        0x00000000008005fc     0x19c8 load address
> 0x000000000001e1f2
>  .eeprom_ext         0x00000000008005fc     0x19c8 sec.o
>                 0x00000000008005fc                inputs
> If I change units order the Makefile (sec.o main.o instead of main.o
> sec.o), inputs is assigned to .eeprom_ext and outputs to eeprom_ext.1.
> The address of .eeprom_ext.1 (0x00000000008005fc) is the same as the
> beginning of .bss section.
> I assume this is a linker issue.
> What should I change so that outputs and inputs variables stay in the
> same .eeprom_ext section, but being in different units (*.c files)?
> Thanks.
> Roy
> _______________________________________________
> AVR-libc-dev mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/avr-libc-dev

reply via email to

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