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

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

Re: [avr-gcc-list] a symbol for end of program memory used?


From: Dave Hylands
Subject: Re: [avr-gcc-list] a symbol for end of program memory used?
Date: Thu, 29 Apr 2010 07:31:55 -0700

HI Erik,

Whoops - meant to send to the list...

On Thu, Apr 29, 2010 at 6:18 AM, Erik Christiansen
<address@hidden> wrote:
> On Wed, Apr 28, 2010 at 12:07:18PM -0700, Paul Stoffregen wrote:
>> So far, I'm using "__data_load_end" to know where the unused flash memory
>> begins.  Is that the best way?  Does the linker provide any special symbols
>> or other way I can get the end of allocated flash memory as a constant
>> which I can use in my program?
>
> Looking at the avr linker script which I last used, __data_load_end
> seems a suitable choice for your purpose, _if_ you have nothing in
> .eeprom. All that follows then is .bss and .noinit, neither of which
> produce loadable data.
>
> And given:
>
>  .data    : AT (ADDR (.text) + SIZEOF (.text))
>
>   __data_load_start = LOADADDR(.data);
>   __data_load_end = __data_load_start + SIZEOF(.data);
>
> it is then an LMA you can use in that case.
>
> But the .eeprom output section specifies an LMA coincident with
> __data_load_end. To be safe, I'd place something like the following
> after the end of the .eeprom output section in the linker script:
>
>   __vacant_flash = __data_load_end + SIZEOF(.eeprom);
>
>   or with same effect:
>
>   __vacant_flash = LOADADDR(.eeprom) + SIZEOF(.eeprom);

Why include the .eeprom section? This is an image of what's to be
included in the EEPROM and normally isn't written to the flash.

I guess you could use it as a "default", so whether you include it or
not in the vacant_flash calculaton should depend on whether you
include it in the .hex file to you use to load to flash.

-- 
Dave Hylands
Shuswap, BC, Canada
http://www.DaveHylands.com/




reply via email to

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