stm32 iap boot 程序

作者:fly 发布于:2014-6-16 15:29 分类:嵌入式

本文出自www.forwhat.cn

        uint32_t FlashData;
	GPIO_Configuration();
	FlashData=*(vu32*)(FLASH_ADR);
	if(FlashData==0xaa55aa00)
	{
		int i=0;
		FLASH_Unlock();		
		for(i=5;i<60;i++)
		{
			FLASH_ErasePage(2048*i);
		}		
                   for(i=0;i<0x1b000;i+=4)
		{
			FlashData=*(vu32*)(FLASH_SOURCE+i);
			FLASH_ProgramWord(i+FLASH_DEST,FlashData);	
	         }                
		FLASH_Lock();	
	}
	if (((*(__IO uint32_t*)FLASH_DEST) & 0x2FFE0000 ) == 0x20000000)
	{
		Delay(1000);
		JumpAddress = *(__IO uint32_t*) (0x2804);
		Jump_To_Application = (pFunction) JumpAddress;
		__set_MSP(*(__IO uint32_t*) FLASH_DEST);
		Jump_To_Application();
	}
	while (1)
	{
	}

 

发表评论:

 
Powered by emlog sitemap