[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] storing values at a spcified location in FLASH..?
From: |
Andy Warner |
Subject: |
Re: [avr-gcc-list] storing values at a spcified location in FLASH..? |
Date: |
Thu, 13 Jan 2005 10:53:00 -0600 |
User-agent: |
Mutt/1.2.5i |
Eivind Sivertsen wrote:
> Hi guys,
>
> I am looking for a way to store values at specified locations in flash, for
> instance calibration values, serial number...etc...
> I know that other compilers may use preprocessor directives to do this, but
> I cant find the combination that does the trick with WinAVR...
> The solution below seems to just add the data at the flash location wherever
> code ends.
Is it important to you that the values are stored at a particular
physical address in flash, or just that your program can always
access the values in flash reliably ?
I ask because you can just ask the linker to "put them in the
flash somewhere", and have it tell you where it put them
(by means of a variable.) Unless you have a compelling reason
to anchor the data at a _specific_ flash location, I would
always recommend letting the linker take care of this kind of
detail - it's way better at it than most programmers, and it
will not break as the code grows/moves.
There was a recent thread about this on this list, check the
archives for the "Including a binary file as resource" thread.
Using objcopy like your example was discussed, along with
the fact that objcopy helpfully creates symbols with the
start/end/size of the data, you should be able to use those
symbols and let go of exactly _where_ in flash the data ended
up (unless you have a solid reason for having the data nailed down
at a specific flash address.)
--
address@hidden
Andy Warner Voice: (612) 801-8549 Fax: (208) 575-5634