avr-libc-dev
[Top][All Lists]
Advanced

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

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


From: Roy Conrad
Subject: Re: [avr-libc-dev] Problem using section attribute
Date: Thu, 18 Dec 2008 11:37:50 +0000

Hi Eric!

I'm not sure about what you mean by memory-mapped, but it's working
just like eeprom variables using avr-libc.
In this case I've created specific functions to read and write from
external eeprom that use the variable address given by the
compiler/linker. This address is the external eeprom address.
I used 0x400000 as the start address just to not collide with the
0x800000 from internal eeprom.

Roy

2008/12/17 Weddington, Eric <address@hidden>:
> 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:
>> 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]