IAR中,FLASH INFO存储器会被用作堆栈区吗?

liukaiyue   2004-11-17 12:10 楼主
如果不会的话那么什么情况下其中数据会变化呢?

回复评论 (6)

引用:

如果不会的话那么什么情况下其中数据会变化呢?
不会,当你对他进行操作的时候。
点赞  2004-11-17 13:41

请版主帮忙测试一下,急!!!!

为什么我用TI例程,10F0~10FF总是写不进,0可以写进去,其他数据不行,曾经正确过,但现在不知为何不行了。单片机是MSP430F417,请版主帮忙测试一下,急!!!!
#include "msp430x41x.h"
void write_SegA (char value);
void copy_A2B (void);

void main(void)
{
char value;
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
FLL_CTL0 = XCAP14PF; // Configure load caps
SCFQCTL|=SCFQ_4M;

FCTL2=FWKEY+FSSEL0+FN0;//FLASH'S TIME SEQUENCE CLOCK
value=0;
while(1)
{
write_SegA(value++);
copy_A2B();
}
}
void write_SegA (char value)
{
char *Flash_ptr; // Flash pointer
unsigned int i;

Flash_ptr = (char *) 0x1080; // Initialize Flash pointer
FCTL1 = FWKEY + ERASE; // Set Erase bit
FCTL3 = FWKEY; // Clear Lock bit
*Flash_ptr = 0; // Dummy write to erase Flash segment

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; // Reset LOCK bit
}


void copy_A2B (void)
{
char *Flash_ptrA; // Segment A pointer
char *Flash_ptrB; // Segment B pointer
unsigned int i;

Flash_ptrA = (char *) 0x1080; // Initialize Flash segment A pointer
Flash_ptrB = (char *) 0x1000; // Initialize Flash segment B pointer
FCTL1 = FWKEY + ERASE; // Set Erase bit
FCTL3 = FWKEY; // Clear Lock bit
*Flash_ptrB = 0; // Dummy write to erase Flash segment B
FCTL1 = FWKEY + WRT; // Set WRT bit for write operation

for (i=0; i<128; i++)
{
*Flash_ptrB++ = *Flash_ptrA++; // copy value segment A to segment B
}

FCTL1 = FWKEY; // Clear WRT bit
FCTL3 = FWKEY + LOCK; // Reset LOCK bit
}
点赞  2004-11-17 14:09
下面是汇编程序供参考,该程序没有问题,C语言的程序我整理完后再贴出来。
information_a equ 01000h
information_b equ 01080h
flash_busy_bit equ 01h
;--------------------------------------------------
;;要保存的数据
;--------------------------------------------------
erase_flash_a ;擦除段操作
mov #0A550h,&FCTL2
mov #0A500h,&FCTL3
erase_test_busy_a
bit #flash_busy_bit,&FCTL3
jnz erase_test_busy_a
mov #0A502h,&FCTL1
mov #1234h,&information_a
ret
;--------------------------------------------------
write_flash_a
mov #0A500h,&FCTL3
write_test_busy_a
bit #flash_busy_bit,&FCTL3
jnz write_test_busy_a
mov #0A540h,&FCTL1
mov s××e(R15),information_a(R15)
incd R15
dec.b &counter
jnz write_test_busy_a
ret
;--------------------------------------------------
erase_flash_b ;擦除段操作
mov #0A550h,&FCTL2
mov #0A500h,&FCTL3
erase_test_busy_b
bit #flash_busy_bit,&FCTL3
jnz erase_test_busy_b
mov #0A502h,&FCTL1
mov #1234h,&information_b
ret
;--------------------------------------------------
write_flash_b
mov #0A500h,&FCTL3
write_test_busy_b
bit #flash_busy_bit,&FCTL3
jnz write_test_busy_b
mov #0A540h,&FCTL1
mov frame_start(R15),information_b(R15)
incd R15
dec.b &counter
jnz write_test_busy_b
ret
点赞  2004-11-17 16:45
谢谢!我贴得C程序几乎就是例程,没怎么变化,曾经正确过,现在在不同的板子上结果也有差别。真是挺奇怪的
点赞  2004-11-17 16:54
程序看不出什么问题,明天测试看看情况。
点赞  2004-11-17 17:06
我下载程序时,有这样的提示信息
Driver does not support data coverage.
Driver does not support code coverage.
好像程序区和数据区有一部分写不进去。
点赞  2004-11-18 08:42
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复