I am developing firmware for a simple application for the MSP430G2553 which accepts a four digit passcode and stores it in memory. I had a working example but now I need the uC to store the passcode in flash so that it is preserved even when power to the chip is off (IE: batteries run out or some other power failure occurs). I am having trouble understanding the code needed to initialize an array in flash memory at a specific location in flash (I want to stay well away from the calibration data and program data). I want to initialize an array of 4 integers beginning at info memory segment B (which I understand to be somewhere around 0x10BF and lower to 0x107F) and then be able to read the data as if it were a normal array. I am still trying to grasp the concept of pointers in C (I am a novice programmer) and my attempts at accomplishing the above goal include creating an array of pointers like so:
int* array[4] = { (int*) 0x10BF, (int*) 0x10AF, (int*) 0x109F, (int*) 0x108F};
I then store values in these flash locations (at least I think I do) using code similar to TI examples given for this device series (flashwrite_01.c or whatever). When I try to read the values, they do not appear to be the same data which I had written to the locations. Would the problem be that it is not an unsigned integer array and these hex values try to represent negative values? And making the array constant makes me unable to write to it (at least the way I am doing it), I understand that it should be initializing a constant array of pointers which indicate an address in memory, but I don't know what I'm doing wrong. I am unable to post my exact code (the example above is what I can recall from memory, no pun intended) as I am away from my developing computer. I am sorry to be such a noobie but other topics which I have found do not address my exact problem and I do not wish to edit the .cmd file to set the starting address for flash writing. If you would like code examples I will be able to post them later, thank you!
TL;DR: I wish to initialize an array of pointers which point to four addresses in flash memory starting at info block b to store four integer values, how would initialize/use the array to read as if it were a regular array? What is the best method to accomplish this?
Platform: MSP430G2553
IDE: CCS V4.0