avr-gcc-list
[Top][All Lists]
Advanced

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

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


From: TODD BATZLER
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
'standard'
 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 >>>
Hi,
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


Cheers,
Eivind



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



_______________________________________________
AVR-GCC-list mailing list
address@hidden 
http://lists.nongnu.org/mailman/listinfo/avr-gcc-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]