5xx-超出64 k地址的flash 读和写和segment A 的读写理解
}
FCTL1 = FWKEY; // Clear WRT bit FCTL3 = FWKEY+LOCK; // Set LOCK bit }
//------------------------------------------------------------------------------ // Input = value, holds value to write to Seg C
//------------------------------------------------------------------------------ void write_SegC(char value) {
unsigned int i;
//unsigned int *Flash_ptr = (unsigned int *)0x10000;
char * Flash_ptr; // Initialize Flash pointer Flash_ptr = (char *) 0x1880;
__disable_interrupt(); // 5xx Workaround: Disable global // interrupt while erasing. Re-Enable // GIE if needed FCTL3 = FWKEY; // Clear Lock bit FCTL1 = FWKEY+ERASE; // Set Erase bit
*(unsigned int *)Flash_ptr = 0; // Dummy write to erase Flash seg FCTL1 = FWKEY+WRT; // Set WRT bit for write operation
for (i = 0; i < 128; i++) {
*Flash_ptr++ = value++; // Write value to flash }
FCTL1 = FWKEY; // Clear WRT bit FCTL3 = FWKEY+LOCK; // Set LOCK bit }
//------------------------------------------------------------------------------ // Copy Seg C to Seg D
//------------------------------------------------------------------------------ void copy_C2D(void) {
unsigned int i; char *Flash_ptrC; char *Flash_ptrD;
Flash_ptrC = (char *) 0x1880; // Initialize Flash segment C ptr Flash_ptrD = (char *) 0x1800; // Initialize Flash segment D ptr