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: *(.eeprom_ext*) 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? Eric > -----Original Message----- > From: > avr-libc-dev-bounces+eweddington=cso.atmel....@nongnu.org > [mailto:avr-libc-dev-bounces+eweddington=cso.atmel....@nongnu. > org] On Behalf Of Roy Conrad > Sent: Wednesday, December 17, 2008 11:41 AM > To: avr-libc-dev@nongnu.org > 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 > AVR-libc-dev@nongnu.org > http://lists.nongnu.org/mailman/listinfo/avr-libc-dev > _______________________________________________ AVR-libc-dev mailing list AVR-libc-dev@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-libc-dev