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);

That should just about do it.
(Caveat: Untested; And the hour is late here.)

Better still, would be to use a custom linker script to manage location
of your extra stuff which goes into flash, by adding your own section.
(Oh, all right, that's a little bit more effort.)

Erik

-- 
Crime does not pay ... as well as politics.
                                                 -- A. E. Newman



_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to