adnanabbasi
Newbie level 3

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
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