[Top][All Lists]

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

Re: [avr-gcc-list] initialized progmem data at fix address

Subject: Re: [avr-gcc-list] initialized progmem data at fix address
Date: Thu, 14 Apr 2005 08:55:12 -0500

The problem with this is it moves the start of the 'text' section to 
the place where you want to put the version string.  The flash space
between 0 and FLASHDATA is not used. 

 I was trying to solve this problem once before where I had a company
 requiring a 16 byte field located at flash address 0x100. 

I declared the section as you suggest but the linker simply starts all
program storage in flash following the 16 byte field as if the lower 
0x100 bytes of flash don't exist. (And are thus "wasted".)

The gcc linker doesn't recognize that a small code module could
fit in this space.

The IAR EW linker I use at "work", when compiling the same 
application, has no issues "injecting" this 16 byte section at the
specified address and 'wrapping' it with initialization code or small
modules that fit around it.

Has anyone got a gcc linker 'fix' that gets around this problem?
And of course, I'm no expert, so if I'm doing something wrong, please
educate me.

>>> Eivind Sivertsen <address@hidden> 04/14/05 3:15 AM >>>
I dont know if the #pragma option works, but I know you can do this 
(e.g. in your main .c file):

// 1) Define the segment.
#define FLASHDATA __attribute__ ((section (".flashdata")))

// 2) Declare the data array.
const unsigned char data_array[] FLASHDATA = {0xd9, 0xce, 0xe3, ..., 
...etc, etc};

Then add this linker command under the others in the makefile:

LDFLAGS += -Wl,--section-start=.flashdata=0x1E800


>use: #pragma yoursection="ANYNAME"
>then in your makefile write:
>LDFLAGS += -Wl,--section-start=.text=$(ANYNAME_ADDRESS)
>Attention: gcc understands 8000 as BYTE address!
>>how can i create an initialized progmem data at fix address in
>>flash in C?
>>  ie.: bootloader version number:
>>  uint16_t version;   // at address 0x1E800
>>thanks: Andras
>>AVR-GCC-list mailing list
>AVR-GCC-list mailing list

AVR-GCC-list mailing list
This message may contain privileged and/or
confidential information.  If you have received
this e-mail in error or are not the intended
recipient, you may not use, copy, disseminate
or distribute it; do not open any attachments,
delete it immediately from your system and notify
the sender promptly by e-mail that you have done so.
Thank you.
<<<< Disclaimer>>>>

reply via email to

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