Continue to Site

Welcome to

Welcome to our site! 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

Not open for further replies.


Newbie level 3
Mar 18, 2009
Reaction score
Trophy points
Activity points
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).



M. Adnan

Re: Required info about __no_init variables in IAR, MSP430F1


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


The microcontroller specialist

Not open for further replies.

Part and Inventory Search

Welcome to