Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Required info about __no_init variables in IAR, MSP430F149

Status
Not open for further replies.

adnanabbasi

Newbie level 3
Joined
Mar 18, 2009
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,318
Hi, everyone!
I need some information on __no_init type variables. I've gone through the IAR Compiler refrence guide which says that __no_init variables are not initialized when the system starts. Does this necessarily imply that these variables are not destroyed when the system shuts down? I've read in a blog that this __no_init directive only prevents initialization of these variables and it can not make sure that these variables will retain their value when the system shuts down.

Actually, I need to store certain variables that are required to retain their value even when the system in not powerd ON. Now, what will be the best mathod out of these two?.( If u know any mathod better then these two plz let me know)
i). Decleration of these variables by __no_init is enough for them to retain their value.(In this case they are stored in RAM but I dont know where they go from RAM when the system shuts down. If they stay there, how can they retain their value?. I think MSP stores them in ROM as well.... plz do explain). Is this the most safe mathod of saving veriables which are required to retain their value even when the device is OFF?.
ii). Decleration of these variables by __no_init at the address > 0x1000 is more safe. In this case 0x1000 is the start of the code memory which requires unlock for writing. The problem in this case is that every time I need to update these variables I've to unlock the flash, erase the sector and then write the new value. This is a tedius procedure and I want to avoid it as much as possible.

Which one of the above is a better and safe approach.? The target is to save and keep variables when the device is OFF. The device my remain off for a month or two and when it is in operation it may be turned ON and OFF a hundred times a day. Variables my get updated once in two months when in operation or a few times a day when someone is testing the product. The size of these variable my be around 180 bytes(Im using MSP430F149).

Thanx

Regards

M. Adnan
 

bobcat1

Advanced Member level 4
Joined
Jul 10, 2002
Messages
1,288
Helped
99
Reputation
198
Reaction score
34
Trophy points
1,328
Activity points
8,547
Re: Required info about __no_init variables in IAR, MSP430F1

Hi

The "_NO_INIT" only implies to variable placed in RAM

Since ram contents tend to get random value during power up the compiler fill the ram area with "0" on start up (before he jump into the MAIN loop)

Using _NO_INIT macro help you avoid reupload data into ram upon HOT RESET

Hot reset are reset that don't harm the ram contents

All the best

Bobi

The microcontroller specialist
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top