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

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

Re: [avr-gcc-list] including default eeprom values in flash memory


From: David Kelly
Subject: Re: [avr-gcc-list] including default eeprom values in flash memory
Date: Wed, 21 Oct 2009 11:48:18 -0500
User-agent: Mutt/1.4.2.3i

On Wed, Oct 21, 2009 at 07:40:50AM -0700, Parthasaradhi Nayani wrote:
> 
> >From: Michael Clift <address@hidden>
> >
> >??? Hi, I am using winavr, and would like to include the default
> >eeprom values (normally output >to .eep) in flash memory. I want to
> >do this so that my application can easily default the >eeprom. 
> 
> Hello,
> EEPROM data in FLASH memory? then the easy way is to use the PGM space
> attribute to the variables you want in flash.

Ditto. Declare the variables twice, once with a name that is obvious to
you is EEPROM in the EEPROM space, and again with a name that is obvious
to you is stored in FLASH. Then when/if you wish to restore EEPROM
contents to their initial default values use the PGM modifier to read
from FLASH and call the routine(s) used to write EEPROM.

Duplicating the default data in your source code sounds wasteful but it
will be easier to understand 6 months from now than an edit of the
Makefile plus hacks to the memory segment definitions. I think it is
possible that way to write the .eeprom segment to two places in memory,
is just that you don't want to do it that way when there is an easier
way that is also easier to understand.

-- 
David Kelly N4HHE, address@hidden
========================================================================
Whom computers would destroy, they must first drive mad.




reply via email to

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