I'm working with MSP430F2618 and IAR IDE.I've created the parameter on flash memory by compiler word const,for e.g.: const uint8 my_array[30];
In memory view,i saw that the parameter was located on address 0x33f6.After activating write_fl(),i saw that the erased segment was started on 0x3200 and ended on 0x33ff .As you could see,i couldn't update all my_array(30 cells) with the value ,the reset procedure was activated on my target.
My question is why the erased segment was not started from 0x33f6 ?
write_fl(my_array,30,1); ///function calling
void write_fl(char* flashMemory,uint16 lengthValue,char value) //function prototype
{
char *Flash_ptr; // Flash pointer
unsigned int i;
uint16 dataFlashSize = lengthValue;
Flash_ptr = flashMemory; // Initialize Flash pointer
FCTL3 = FWKEY; // Clear Lock bit
FCTL1 = FWKEY + ERASE; // Set Erase bit
*Flash_ptr = 0; // Dummy write to erase Flash seg
FCTL1 = FWKEY + WRT; // Set WRT bit for write operation
for (i = 0; i < dataFlashSize; i++)
{
*Flash_ptr++ = value; // Write value to flash
}
FCTL1 = FWKEY; // Clear WRT bit
FCTL3 = FWKEY + LOCK; // Set LOCK bit
}