EmbeddedRelated.com
Forums

programming INFO FLASH

Started by jean_randhah September 11, 2002
Hi all!

I am using MSP430F1121 with IAR at the moment and am wondering how one can
programm the info flash of the device without having to write a programm that
eats up valuable programm space.
What I want to do is give the MSP some start values (wich can be
changed  during runtime). I have tried to initialize them in C, but
it won't work. Another possibility I can think of is to create an
assembler file that sets up the INFO segment. Later one is not
wanted, because there are several variables from different modules in
the info flash. So it would destroy the concept of modules somewhat!?!

Any ideas?

Thanks!

-Jean-

--------------------------------
http://randhahn.de




Beginning Microcontrollers with the MSP430

If I get this right, you want to declare constant values in C, to go into
Flash INFO memory.
Have a look at the #pragma directive summary under help -> contents -> C compiler.
 
This is how you would do it :
(Just an example !)

#pragma memory=constseg(INFO)

const unsigned char foo#;

const unsigned int foo_array [16]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};

#pragma memoryault

 
The memory=constseg(INFO) directs the compiler to place consts
in the INFO segment (defined in XCL linker file)
When finished declaring, memory is set back to default.
 
When loading, the values will be placed in INFO Flash.
 
Rgds
Kris
 
 
----- Original Message -----
From: jean_randhah
To: msp430@yahoogroups.com
Sent: Thursday, September 12, 2002 2:08 AM
Subject: [msp430] programming INFO FLASH

Hi all!

I am using MSP430F1121 with IAR at the moment and am wondering how one can programm the info flash of the device without having to write a programm that eats up valuable programm space.
What I want to do is give the MSP some start values (wich can be
changed  during runtime). I have tried to initialize them in C, but
it won't work. Another possibility I can think of is to create an
assembler file that sets up the INFO segment. Later one is not
wanted, because there are several variables from different modules in
the info flash. So it would destroy the concept of modules somewhat!?!

Any ideas?

Thanks!

-Jean-

--------------------------------
http://randhahn.de









">Yahoo! Terms of Service.


Thanks Kris!

I am gonna try that. Previously I had tried to use constants, but did
that without declaring the info flash as a constant segment.

-Jean-

----------------------------
http://randhahn.de




--- In msp430@y..., "jean_randhah" <jean@r...> wrote:
> Hi all!
> 
> I am using MSP430F1121 with IAR at the moment and am wondering how 
one can programm the info flash of the device without having to write 
a programm that eats up valuable programm space.
> What I want to do is give the MSP some start
values (wich can be
> changed  during runtime). I have tried to initialize them in C, but
> it won't work. Another possibility I can think of is to create an
> assembler file that sets up the INFO segment. Later one is not
> wanted, because there are several variables from different modules 
in
> the info flash. So it would destroy the concept of
modules 
somewhat!?!
> 
> Any ideas?
> 
> Thanks!
> 
> -Jean-

Hi Jean,

If you use the AQ430 tools for MSP430Fxxx 
(www.quadravox.com/aq430pa.htm), you can easily declare variables in 
C to be put in the info memory. For example (a program that doesn't 
do anything useful, but illustrates the solution):

file main1.c:
#include <msp430x14x.h>
_INFOMEM char info_segment_0[128]={1,2,3,4};
int i=3;
extern int bidon(int i);	
int main()
{
i=bidon(i);
return i+3;
}

File sub1.c:
#include <msp430x14x.h>
_INFOMEM char info_segment_1[128]={5,6,7,8};
int j=4;
int bidon(int i)
{
return i+j;
}	

When you link the program, the array info_segment0 will be placed a 
addres 0x1000, and the array info_segment0  at address 0x1080. Their 
first 4 bytes will be initialized as indicated. By using unions and 
structures, you can pretty much position any variable at any location 
in the info memory, and initialize them when you burn the program.

Regards

Michel
> 
> --------------------------------
> http://randhahn.de


With IAR (the same with most other compilers) there are #pragma directives.
One nice directive is:
#pragma memory=constseg(address)
It should be ended with:
#pragma memoryault

In the .XCL-linker file INFO (the address of above constseg) should be set
with
-Z(CODE)INFO00-10FF
So the linker gets to know, where INFO-FLASH is in memory.

With the following code You can access the variable cInfo from within all
modules, when You make it global, i.e. out of all functions, preferrably
before main(). And it works with IAR. And it is initialized with
"INFO".

#pragma memory=constseg(INFO)
char cInfo[]="INFO";
#pragma memoryault

Harald

-----Ursprgliche Nachricht-----
Von: jean_randhah [mailto:jean@jean...]
Gesendet am: Mittwoch, 11. September 2002 18:08
An: msp430@msp4...
Betreff: [msp430] programming INFO FLASH

Hi all!

I am using MSP430F1121 with IAR at the moment and am wondering how one can
programm the info flash of the device without having to write a programm
that eats up valuable programm space.
What I want to do is give the MSP some start values (wich can be
changed  during runtime). I have tried to initialize them in C, but
it won't work. Another possibility I can think of is to create an
assembler file that sets up the INFO segment. Later one is not
wanted, because there are several variables from different modules in
the info flash. So it would destroy the concept of modules somewhat!?!

Any ideas?

Thanks!

-Jean-

--------------------------------
http://randhahn.de





.

 

">http://docs.yahoo.com/info/terms/