各位大神,我最近在搞IAP在线升级,我碰到的问题是IAP跳转到APP程序后执行完一遍while循环后又返回到IAP程序了。APP程序就是个流水灯的小程序。
[mw_shl_code=c,true]void WR_IAP_TO_FLASH(void)
{
if(g_SysStatus.JumpToApp==0)return;
if(((*(vu32*)(FLASH_APP1_ADDR+4))&0xFF000000)==0x08000000)//??????·???0X08XXXXXX. ????????FLASH_APP1_ADDR+4????????????·????????ò??±í(APP???ò?????????·)
{
iap_load_app(FLASH_APP1_ADDR);//????FLASH APP?ú??
}else{
#ifdef DEBUG
DebugStrPrint("Illegal FLASH APP!\r\n");
#endif
return;
}
}[/mw_shl_code]
[mw_shl_code=c,true]void iap_load_app(u32 appxaddr)
{
if(((*(vu32*)appxaddr)&0x2FFE0000)==0x20000000) //?ì?é???????·??·???·¨.
{
delay_us(5000);
//??×??®?°?????ù??????
// SysTick_ITConfig(DISABLE);
CloseIQHard();
//
jump2app=(iapfun)*(vu32*)(appxaddr+4); //???§?ú??????????×???app???ò???????·(???????·) iapfun---????????
//appxaddr+4 ???·????????APP???ò?????ò??
//jump2app=(iapfun)*(vu32*)(appxaddr+4)??°?APP???????ò??×?????????????
//°?jump2app×?????????????
MSR_MSP(*(vu32*)appxaddr); //??????APP????????(???§?ú????????????×???????·????????·)
jump2app(); //??×???APP. ?é??????
NVIC_SystemReset();
}
} [/mw_shl_code]
void iap_load_app(u32 appxaddr)
{
if(((*(vu32*)appxaddr)&0x2FFE0000)==0x20000000) //?ì?é???????·??·???·¨.
{
jump2app=(iapfun)*(vu32*)(appxaddr+4);
//°?jump2app×?????????????
MSR_MSP(*(vu32*)appxaddr); //??????APP????????(???§?ú????????????×???????·????????·)
jump2app(); //??×???APP. ?é??????
}
}
APP程序开头如下:
int main(void)
{
SCB->VTOR = FLASH_BASE | 0x20000;
/* LED ?????????? */
LED_GPIO_Configuration();
// RelayGPIO_Init();
buzze();
GPIO_SetBits(GPIOB,GPIO_Pin_0);
GPIO_SetBits(GPIOB,GPIO_Pin_8);
Delay(0x0FFFFF);
GPIO_ResetBits(GPIOB,GPIO_Pin_8);
/* ·?·¨2????????????????IO */
while (1)
{
Delay(0x0FFFFF);
GPIO_ResetBits(GPIOC,GPIO_Pin_3);
Delay(0x0FFFFF);
GPIO_ResetBits(GPIOC,GPIO_Pin_4);
Delay(0x0FFFFF);
GPIO_ResetBits(GPIOC,GPIO_Pin_5);
Delay(0x0FFFFF);
GPIO_ResetBits(GPIOC,GPIO_Pin_6);
Delay(0x0FFFFF);
GPIO_ResetBits(GPIOC,GPIO_Pin_7);
GPIO_SetBits(GPIOC,GPIO_Pin_3);
Delay(0x0FFFFF);
GPIO_SetBits(GPIOC,GPIO_Pin_4);
Delay(0x0FFFFF);
GPIO_SetBits(GPIOC,GPIO_Pin_5);
Delay(0x0FFFFF);
GPIO_SetBits(GPIOC,GPIO_Pin_6);
Delay(0x0FFFFF);
GPIO_SetBits(GPIOC,GPIO_Pin_7);
}
}