u32 StartAddr = 0x8000FC00;
u32 i;
u32 *pSave = (u32 *)(&SystemSave);
for(i=0;i<sizeof(SAVE_CONTENT)/sizeof(DWORD);i++)
{
*pSave = (*(vu32*) StartAddr);
pSave += 4;
StartAddr += 4;
}
u32 StartAddr = 0800FC00;
u32 i;
u32 *pSave = (u32 *)(&SystemSave);
FLASH_Status FLASHStatus = FLASH_BUSY;
FLASH_Unlock();
FLASH_ClearFlag(FLASH_FLAG_BSY | FLASH_FLAG_EOP | FLASH_FLAG_PGERR | FLASH_FLAG_WRPRTERR);
FLASHStatus = FLASH_ErasePage(StartAddr);
for(i=0;i<sizeof(SAVE_CONTENT)/sizeof(DWORD);i++)
{
FLASH_ProgramWord(StartAddr,*pSave);
pSave += 4;
StartAddr += 4;
}
FLASH_Lock();
这段读和写的程序都直接会触发进入到HardFault_Handler,大侠指点一下
|