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

Reply via email to