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

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

[avr-gcc-list] Re: End of program symbol


From: Björn Haase
Subject: [avr-gcc-list] Re: End of program symbol
Date: Sat, 10 Jun 2006 02:45:25 +0200
User-agent: KMail/1.7.1

> Message: 1
> Date: Thu, 8 Jun 2006 11:16:53 -0700
> From: Simon Han <address@hidden>
> Subject: [avr-gcc-list] End of program symbol
> To: address@hidden
> Message-ID: <address@hidden>
> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
>
> Hello,
>
>       I am working on a simple file system for logging data in program
> flash.  I would like my simple file system uses the flash starting at
> the end of my program.  My question is that whether there is any
> support for this.  Specifically, I need a symbol that defines the end
> of program so that I can use it as my starting address for the file
> system.
>
>       Looking at ldscripts/avr5.x, I found that _etext is defined at the
> end of .text section.  However, unlike .data section, there is no
> PROVIDE statement like PROVIDE (__data_end = .) ;
>
>       Would this simply be changing "_etext = . ;" to "PROVIDE (_etext
> = .) ;"?
>
>       Since the default linker script does not use PROVIDE, I just want to
> double check my 'hack' before doing it.
>
> Thank you for any help,
> Simon
>
The symbol that you want to use is existing and it's name is

__data_load_end

. You need to consider that ld places the initialization data of the static 
ram variables behind the last program instruction. You must not overwrite 
them. I think, the best solution for your issue probably is to use a 
custom-designed linker script. There you also could use ALIGN( ... )
for satisfying your specific block position constraint. Maybe use the usual 
template as starting point and maybe look at the m68hc12-gcc or arm-gcc 
mailing list for information on how to edit this (this is usually not 
necessary for avr).

HTH,

Bjoern.

P.S.:

When trying to add program code without using ld keep in mind that you will be 
yourself be responsible for initializing static ram variables at program 
startup. Usually ld and avr-libc do that for you, but if you use non-standard 
methods, better be careful. Also your method will fail for > 128k devices as 
soon as you are using pointers to functions.




reply via email to

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