This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Initialise Information Memory on MSP430

I am storing some calibration variables in the info mem section of my MSP430 and I would like to initialise them to defaults when the part  is programmed . If I simply initialise the variables in code will they only get loaded when the part is programmed or will they be re-initialised everytime the part boots?

The obvious workaround here is to write a routine in the code that checks if the flash is empty and writes default values to it if it is. I'd much rather write directly to the infomem section of flash when I'm programming the part though.

  • Hi Pat,

    althought this might be better for the msp430 forum let me see if I can clarify for you.

    This will depend on where you put the code that initialized the variables.

    1 - If your msp supports it, and you put this initialization code in the boot strap loader (msp430 BSL) then they will get initialized every boot

    2 - If you initialize them using your code, then they will get initialized any time that piece of code is run.  So this depends on where/how you implement this.

    Does this help?  There are many useful examples and application notes on both the msp430 BSL and writing to flash.

    Best Regards,

    Lisa

  • I put the question here as I was unsure if the means of preloading the flash from the hex file was IDE specific rather than code specific.

    Currently I initialise the variables when I declare them but I don't explicitly write them to flash, I merely assign values to the variables which have been mapped to the flash. My impression here is that this cannot be written to flash of it's own accord at boot time but if it is placed in the correct location in the hex file then it will get written when the program is loaded to the part.

    FWIW this appears to be what is happening and as far as I can tell values I write to update the flash at runtime are not overwritten by the initialised values if the part reboots, which is obviously the goal.

    Thanks,