[Top][All Lists]

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

[avr-libc-dev] Problem using section attribute

From: Roy Conrad
Subject: [avr-libc-dev] Problem using section attribute
Date: Wed, 17 Dec 2008 18:40:45 +0000


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
 .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)?



reply via email to

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