|
回复 沙发 huo_hu 的帖子
谢谢,后来又遇到这样的问题
程序如下
void write(int16_t value_2,int16_t value_3)
{
int i;
char buf[512];
int *Data_location_ptr;
int *Segment_location_ptr;
char *Flash_ptr;
int16_t Segment_location=0;
int16_t Data_location=0;
Segment_location_ptr=(int *)0x1000;
Data_location_ptr=(int *)0x1080;
Segment_location=*Segment_location_ptr;
Data_location=*Data_location_ptr;
int16_t x= Segment_location*0x200;
// Flash pointer
Flash_ptr = (char *)(0x8000+x);
for(i=0;i
buf=*(Flash_ptr+i);
buf[Data_location]=value_2;
buf[Data_location+1]=value_3;
FCTL3 = FWKEY; // Clear Lock bit
FCTL1 = FWKEY + ERASE; // Set Erase bit
*Flash_ptr = 0; // Dummy write to erase Flash seg
FCTL1 = FWKEY + WRT;
for(int i=0;i
*(Flash_ptr+i) = buf;
Data_location+=2;
while(Data_location==512)
{
Data_location=Data_location-0x200;
Segment_location ++;
}
*Data_location_ptr=Data_location;
*Segment_location_ptr=Segment_location;
FCTL1 = FWKEY; // Clear WRT bit
FCTL3 = FWKEY + LOCK; // Set LOCK bit
}
Flash的地址是0x8000-0xffff
我发现在写数据的时候 0x6DEC位开始也同步写入相同数据,一直到6fff.然后报下面的错
The stack pointer for stack 'Stack' (currently Memory:0x6DEC) is outside the stack range (Memory:0x6F80 to Memory:0x7000) |
|