Hi,

I assume what you are trying to do here is store some data in flash as
non-volatile data.  Apart from your linker issue (the rule is that
everything in header files is declared "extern", with a matching non-extern
definition in one c file), there are a few other things to note when storing
data in flash.  Remember that while you can write to flash areas in any
order, you can only erase a whole segment at a time.  That means that when
you want to change the value of one parameter, you have to erase *all* the
parameters and re-write them.

I always find that the easiest way of dealing with this is to define a
structure :
    typedef struct {
        int systemPrefix;
        struct OBDDynamicVariables OBDDY[2];
        ...
    } Params;
typedef const Params *pFlashParams;

Don't bother actually creating a Params struct in flash (but if you have
parameters that change often but are seldom stored, make a mirror in ram),
simply make a pointer variable which you use to point to the current param
block in flash (typically 0x1000 or 0x1080 - the "information" flash
segments are best if you have less than 128 bytes parameters).  When you
want to update the parameters, you start by erasing another segment, then
copy over the old parameters, with the new modifications.  Then update your
pointer to point to the new parameters.  You'll also need some sort of
counter or time stamp so that when your program starts up, it knows which is
the newest set of parameters.

mvh.,

David



----- Original Message -----
From: Vijay
To: [email protected]
Sent: Friday, April 22, 2005 2:41 PM
Subject: [Mspgcc-users] help!!


hai guys,

    i have another error, when i am compiling i am getting the following
error....



Gsm.o(.flashA+0x6): In function `UartTaskComplete':
/cygdrive/c/Documents and Settings/Desktop/latestOBDISODriver/Gsm.c:38:
multiple definition of `OBDDY'
Main.o(.flashA+0x6):/cygdrive/c/Documents and Settings/Desktop/latestOBD
ISODriver/Main.c:38: first defined here
Gsm.o(.flashA+0x5a): In function `GsmTimeout':
/cygdrive/c/Documents and Settings/Desktop/latestOBDISODriver/Gsm.c:77:
multiple definition of `IMEINumber'
Main.o(.flashA+0x5a):/cygdrive/c/Documents and Settings/Desktop/latestOB
DISODriver/Main.c:110: first defined here
Gsm.o(.flashB+0x0): In function `UartTaskComplete':
/cygdrive/c/Documents and Settings/Desktop/latestOBDISODriver/Gsm.c:37:
multiple definition of `UserList'

msp430-ld: region data is full (JL2 section .flashA)
make: *** [JL2] Error 1

thes e varibles, like UserList,IMEINumber etc.. are flash variables and i
have declared it as follows in the header file:



const __attribute__ ((section (".flashA"))) int SystemPrefix;

const __attribute__ ((section (".flashA"))) struct OBDDynamicVariables
OBDDY[2];

const __attribute__ ((section (".flashA"))) struct OBDStaticVariables OBDST;

const __attribute__ ((section (".flashA"))) unsigned int IMEINumber[8];

const __attribute__ ((section (".flashA"))) unsigned int MyPhoneNumber[8];

const __attribute__ ((section (".flashA"))) unsigned int UserPhoneNumber[8];

const __attribute__ ((section (".flashA"))) int SystemStatus ;

i thought it might be becoz of multiple inclusion of header files,and i
added

#ifndef <filename>

#define<filename>

........#endif

in all the header file, but still i am having this probelm, i refrred to the
compile folder(mspgcc)in my drive and had a look in the ir include files ,
and did the same thing...of how they have included to avoid this ..still i
am helpless!! could any one suggest me ,to overcome this error,

thank you

vijay

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com



Reply via email to