BoootLoad在线升级分为两个部分:Boot、APP
Boot
Boot为单片机复位启动以后运行的部分,这里面可以选择后续程序的跳转,以及升级文件的接收。
Boot中的要点就是程序跳转
void CAN_BOOT_JumpToApplication(__IO uint32_t Addr)
{
pFunction Jump_To_Application;
__IO uint32_t JumpAddress;
/* Test if user code is programmed starting from address "ApplicationAddress" */
if (((*(__IO uint32_t*)Addr) & 0x2FFE0000 ) == 0x20000000)
{
/* Jump to user application */
__ASM("CPSID I");
JumpAddress = *(__IO uint32_t*) (Addr + 4);
Jump_To_Application = (pFunction) JumpAddress;
__set_PRIMASK(1);//关闭所有中断
CAN_ITConfig(CAN1,CAN_IT_FMP0, DISABLE);
/* Initialize user application's Stack Pointer */
__set_MSP(*(__IO uint32_t*)Addr);
Jump_To_Application();
}
}
通过上面的文章可以了解到CortexM3从启动的首地