|
函数执行到最后一个括号,跳不出去,为什么啊???
???????
void Write_FLASH_fun(uint32_t Address , uint32_t WriteData)
{
uint32_t BUF32[256] = {0xFFFFFFFF};
uint16_t SerialNumber = 0 , i = 0 , FLASHStatus; //ijһҳµÄµÚSerialNumberµØÖ· °´ÕÕ32λ¼ÆËã
uint32_t *Dest_Address = (void*)Address; //Ä¿µÄµØÖ·
uint8_t FLASH_Pages = 0xFF ; //Ò³ºÅ
uint32_t FLASH_Pages_Address = 0 ; //Ò³ÆðʼµØÖ·
FLASH_Pages = (Address - 0x08000000) / 0x800 ;
//Ò³ÆðʼµØÖ·
if(FLASH_Pages < 128)
{
FLASH_Pages_Address = FLASH_Pages * 0x800 + 0x08000000 ;
SerialNumber = Address - FLASH_Pages_Address ;
memcpy(BUF32 , ( uint32_t * )FLASH_Pages_Address , 2048);
//¸³Öµ
if(SerialNumber < 256)
{
BUF32[SerialNumber] = WriteData ;
}
//дFLASH
FLASH_Unlock(); //flash ½âËø
FLASH_ClearFlag(FLASH_FLAG_BSY|FLASH_FLAG_EOP | FLASH_FLAG_PGERR | FLASH_FLAG_WRPRTERR);//Çå³þ±ê־λ
i = FLASH_ErasePage( FLASH_Pages_Address ); //²Á³ýÒ»¸öFLASHÒ³Ã棬FLASH_ADRÒª²ÁµÄÆðʼµØÖ·
printf("FLASH_ErasePage() = %d , %d \r\n" , i , FLASH_Pages);
for( i = 0 ; i < 256 ; i++)
{
// FLASHStatus = FLASH_ProgramWord((FLASH_Pages_Address + i * 4 ), BUF32[i]);
while( FLASH_ProgramWord((FLASH_Pages_Address + i * 4 ), BUF32[i]) != 4)
{
printf("FLASH_ProgramWord() err ID= %08X \r\n" , (FLASH_Pages_Address + i * 4 ) );
}
}
FLASH_Lock(); //flash ¼ÓËø
printf("Write_FLASH_function %08X , %08X\r\n" , Address , WriteData);
}
else
{
printf("Address err\r\n");
}
printf("Write_FLASH_function %08X , %08X\r\n" , Address , WriteData);
} |
阿莫论坛20周年了!感谢大家的支持与爱护!!
曾经有一段真挚的爱情摆在我的面前,我没有珍惜,现在想起来,还好我没有珍惜……
|